[PATCH] virtio-scsi: Skip setting affinity on uninitialized vq

2014-04-11 Thread Fam Zheng
virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
the vqs. The latter calls virtscsi_set_affinity, so let's check the
pointer there before setting affinity on it.

This fixes a panic when setting device's num_queues=2 on RHEL 6.5:

qemu-system-x86_64 ... \
-device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
-drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
-device scsi-hd,drive=drive-scsi-disk,...

[0.354734] scsi0 : Virtio SCSI HBA
[0.379504] BUG: unable to handle kernel NULL pointer dereference at 
0020
[0.380141] IP: [] __virtscsi_set_affinity+0x4f/0x120
[0.380141] PGD 0
[0.380141] Oops:  [#1] SMP
[0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
[0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
[0.380141] task: 88003c9f ti: 88003c9f8000 task.ti: 
88003c9f8000
[0.380141] RIP: 0010:[]  [] 
__virtscsi_set_affinity+0x4f/0x120
[0.380141] RSP: :88003c9f9c08  EFLAGS: 00010256
[0.380141] RAX:  RBX: 88003c3a9d40 RCX: 1070
[0.380141] RDX: 0002 RSI:  RDI: 
[0.380141] RBP: 88003c9f9c28 R08: 000136c0 R09: 88003c801c00
[0.380141] R10: 81475229 R11: 0008 R12: 
[0.380141] R13: 81cc7ca8 R14: 88003cac3d40 R15: 88003cac37a0
[0.380141] FS:  () GS:88003e40() 
knlGS:
[0.380141] CS:  0010 DS:  ES:  CR0: 8005003b
[0.380141] CR2: 0020 CR3: 01c0e000 CR4: 06f0
[0.380141] Stack:
[0.380141]  88003c3a9d40  88003cac3d80 
88003cac3d40
[0.380141]  88003c9f9c48 814742e8 88003c26d000 
88003c26d000
[0.380141]  88003c9f9c68 81474321 88003c26d000 
88003c3a9d40
[0.380141] Call Trace:
[0.380141]  [] virtscsi_set_affinity+0x28/0x40
[0.380141]  [] virtscsi_remove_vqs+0x21/0x50
[0.380141]  [] virtscsi_init+0x91/0x240
[0.380141]  [] ? vp_get+0x50/0x70
[0.380141]  [] virtscsi_probe+0xf4/0x280
[0.380141]  [] virtio_dev_probe+0xe5/0x140
[0.380141]  [] driver_probe_device+0x89/0x230
[0.380141]  [] __driver_attach+0x9b/0xa0
[0.380141]  [] ? driver_probe_device+0x230/0x230
[0.380141]  [] ? driver_probe_device+0x230/0x230
[0.380141]  [] bus_for_each_dev+0x8c/0xb0
[0.380141]  [] driver_attach+0x19/0x20
[0.380141]  [] bus_add_driver+0x198/0x220
[0.380141]  [] driver_register+0x5f/0xf0
[0.380141]  [] ? spi_transport_init+0x79/0x79
[0.380141]  [] register_virtio_driver+0x1b/0x30
[0.380141]  [] init+0x88/0xd6
[0.380141]  [] ? scsi_init_procfs+0x5b/0x5b
[0.380141]  [] do_one_initcall+0x7f/0x10a
[0.380141]  [] kernel_init_freeable+0x14a/0x1de
[0.380141]  [] ? kernel_init_freeable+0x1de/0x1de
[0.380141]  [] ? rest_init+0x80/0x80
[0.380141]  [] kernel_init+0x9/0xf0
[0.380141]  [] ret_from_fork+0x7c/0xb0
[0.380141]  [] ? rest_init+0x80/0x80
[0.380141] RIP  [] __virtscsi_set_affinity+0x4f/0x120
[0.380141]  RSP 
[0.380141] CR2: 0020
[0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
[0.475018] Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0009
[0.475018]
[0.475068] Kernel Offset: 0x0 from 0x8100 (relocation range: 
0x8000-0x9fff)
[0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0009

Signed-off-by: Fam Zheng 
---
 drivers/scsi/virtio_scsi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 16bfd50..3019267 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -750,8 +750,12 @@ static void __virtscsi_set_affinity(struct virtio_scsi 
*vscsi, bool affinity)
 
vscsi->affinity_hint_set = true;
} else {
-   for (i = 0; i < vscsi->num_queues; i++)
+   for (i = 0; i < vscsi->num_queues; i++) {
+   if (!vscsi->req_vqs[i].vq) {
+   continue;
+   }
virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1);
+   }
 
vscsi->affinity_hint_set = false;
}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] blk-mq: move request structures into struct blk_mq_tags

2014-04-11 Thread Christoph Hellwig
On Thu, Apr 10, 2014 at 08:42:27PM -0600, Jens Axboe wrote:
> Great. Will you send out an updated patchset?

I was waiting for you to apply the previous series, but I'll just resend my
whole set of outstanding patches, it'll need a bit of rebasing against
your updated tree anyway.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 71231] System unresponsable after a lot of LUNs have been added to the system

2014-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=71231

--- Comment #13 from Alex  ---
Thanks for these tips.
It looks like disabling serial console helps.

But I need this one.
I will try to get his patches working so that I can enbale serial console
again.

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: aic94xx: maybe uninitialized variable in asd_process_ctrl_a_user

2014-04-11 Thread Paul Bolle
On Thu, 2014-04-10 at 22:13 -0700, Filipe Brandenburger wrote:
> While building a recent kernel with -Werror I found this warning:
> 
> drivers/scsi/aic94xx/aic94xx_sds.c: In function 'asd_read_flash':
> drivers/scsi/aic94xx/aic94xx_sds.c:597:21: error: 'offs' may be used
> uninitialized in this function [-Werror=maybe-uninitialized]
> drivers/scsi/aic94xx/aic94xx_sds.c:985:6: note: 'offs' was declared here

This warning is actually rather old.

> This looks like a valid complaint from the compiler, since in
> asd_process_ctrl_a_user if the call to asd_find_flash_de fails (and
> returns -ENOENT) then offs will not be set, but that will not prevent
> the variable to be later passed to the call to asd_read_flash_seg
> later in that same function.
> 
> Would you please have a look at it? Let me know if there's a more
> appropriate way to report these issues (e.g. bug tracker.)

I tried a few times to fix this warning.

In the end I just asked Fedora to disable aic94xx in their kernel builds
(which they did for Rawhide, their development branch). See
https://lists.fedoraproject.org/pipermail/kernel/2014-January/004759.html for 
all the boring details.


Paul Bolle

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [SCSI] libsas: replace IS_ERR and PTR_ERR with PTR_ERR_OR_ZERO

2014-04-11 Thread Duan Jiong
This patch fixes coccinelle error regarding usage of IS_ERR and
PTR_ERR instead of PTR_ERR_OR_ZERO.

Signed-off-by: Duan Jiong 
---
 drivers/scsi/libsas/sas_scsi_host.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/scsi/libsas/sas_scsi_host.c 
b/drivers/scsi/libsas/sas_scsi_host.c
index 25d0f12..400a2aa 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -1093,9 +1093,7 @@ int sas_init_queue(struct sas_ha_struct *sas_ha)
 
core->queue_thread = kthread_run(sas_queue_thread, sas_ha,
 "sas_queue_%d", core->shost->host_no);
-   if (IS_ERR(core->queue_thread))
-   return PTR_ERR(core->queue_thread);
-   return 0;
+   return PTR_ERR_OR_ZERO(core->queue_thread);
 }
 
 void sas_shutdown_queue(struct sas_ha_struct *sas_ha)
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: hpsa driver bug crack kernel down!

2014-04-11 Thread David Woodhouse
On Thu, 2014-04-10 at 17:17 -0600, Shuah Khan wrote:
> This smells very much like the problem that was solved couple of years
> ago for SI domain. It is likely that path is broken with the DMAR
> device scope array change. Please take a look to see if the following
> no longer occurs. Looks like BIOS could be expecting this RMRR to be
> still mapped.
> 
>/*
>  * We want to prevent any device associated with an RMRR from
>  * getting placed into the SI Domain. This is done because
>  * problems exist when devices are moved in and out of domains
>  * and their respective RMRR info is lost. We exempt USB 
> devices
>  * from this process due to their usage of RMRRs that are 
> known
>  * to not be needed after BIOS hand-off to OS.
>  */
> if (device_has_rmrr(dev) &&
> (pdev->class >> 8) != PCI_CLASS_SERIAL_USB)
> return 0;

Yeah, I'd be inclined to agree although I've tested with graphics
*since* these patches. That's another case where we need to preserve the
RMRR mapping after the driver takes over — and it *was* working.

-- 
David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation


smime.p7s
Description: S/MIME cryptographic signature


[no subject]

2014-04-11 Thread Mercantile Finance

We are Christain organization we give out  loan/financial help contact us
via email: mercantilefinanceloanserv...@yahoo.com



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[no subject]

2014-04-11 Thread Mercantile Finance

We are Christain organization we give out  loan/financial help contact us
via email: mercantilefinanceloanserv...@yahoo.com



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] scsi: lpfc: lpfc_init: use kcalloc for allocating memory

2014-04-11 Thread Matei Oprea
It's easier to use kcalloc for allocating arrays. While at it
also remove useless casting value.

Signed-off-by: Matei Oprea 
Cc: ROSEdu Kernel Community 
---
 drivers/scsi/lpfc/lpfc_init.c | 13 +++--
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 635eeb3..7e58c22 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4742,12 +4742,13 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
phba->cfg_sg_seg_cnt = LPFC_DEFAULT_MENLO_SG_SEG_CNT;
}
 
-   if (!phba->sli.ring)
-   phba->sli.ring = (struct lpfc_sli_ring *)
-   kzalloc(LPFC_SLI3_MAX_RING *
-   sizeof(struct lpfc_sli_ring), GFP_KERNEL);
-   if (!phba->sli.ring)
-   return -ENOMEM;
+   if (!phba->sli.ring) {
+   phba->sli.ring = kcalloc(LPFC_SLI3_MAX_RING,
+sizeof(struct lpfc_sli_ring),
+GFP_KERNEL);
+   if (!phba->sli.ring)
+   return -ENOMEM;
+   }
 
/*
 * Since lpfc_sg_seg_cnt is module parameter, the sg_dma_buf_size
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: hpsa driver bug crack kernel down!

2014-04-11 Thread Woodhouse, David
On Thu, 2014-04-10 at 09:19 -0700, Davidlohr Bueso wrote:
> Attaching a dmesg from one of the kernels that boots. It doesn't appear
> to have much of the related information... is there any debug config
> option I can enable that might give you more data?

I'd like the contents of /sys/firmware/acpi/tables/DMAR please. And
please could you also apply this patch to both the last-working and
first-failing kernels and show me the output in both cases?

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index dd576c0..d52ac03 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -683,6 +683,12 @@ static struct intel_iommu *device_to_iommu(int segment, u8 
bus, u8 devfn)
 out:
rcu_read_unlock();
 
+   if (iommu)
+   printk("Device %x:%02x:%02x.%d on IOMMU at %llx\n", segment, 
bus,
+  PCI_SLOT(devfn), PCI_FUNC(devfn), drhd->reg_base_addr);
+   else
+   printk("Device %x:%02x:%02x.%d on no IOMMU\n", segment, bus,
+  PCI_SLOT(devfn), PCI_FUNC(devfn));
return iommu;
 }
 


-- 
  Sent with Evolution's ActiveSync support.

David WoodhouseOpen Source Technology Centre
david.woodho...@intel.com  Intel Corporation






smime.p7s
Description: S/MIME cryptographic signature


SUSPECT: General web-mail maintenance

2014-04-11 Thread Semple, Kylie M
General web-mail maintenance
Dear Account Owner,
 THIS MESSAGE IS DIRECTED TO THOSE USING Office Outlook Web Access Web-mail 
(2007 version). We want to upgrade all Microsoft Exchange email account 
scheduled for today as part of our duty to strengthen security of your mailbox. 
CLICK HERE to upgrade your account to Outlook Web Apps 
2014. If your settings is not updated today, your account will be inactive and 
cannot send or receive message any longer.
Sincerely,
IT Helpdesk DEPT
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 71231] System unresponsable after a lot of LUNs have been added to the system

2014-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=71231

Alex  changed:

   What|Removed |Added

  Component|SCSI|Other
Product|IO/Storage  |Other

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 71231] System unresponsable after a lot of LUNs have been added to the system

2014-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=71231

--- Comment #14 from Alex  ---
My Grub entry is:

title   Test
root(hd0,0)
kernel  /boot/vmlinuz-3.10.25 root=/dev/sdb2 ro console=ttyS0
boot

Removing "console=ttyS0" will fix this problem.
But this isn't a solution for me.

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Bug 71231] System unresponsable after a lot of LUNs have been added to the system

2014-04-11 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=71231

--- Comment #15 from Alex  ---
After disabling ACPI Processor and cpuidle, I get these four different stack
traces (system is working, but not rebooting anymore for example) several
times:


Call Trace:
 [] __mutex_lock_slowpath+0x5d/0x1d0
 [] ? __mutex_lock_slowpath+0x1a8/0x1d0
 [] mutex_lock+0x1d/0x40
 [] sysfs_dentry_revalidate+0x35/0x100
 [] lookup_fast+0x299/0x2e0
 [] ? __inode_permission+0x46/0x70
 [] link_path_walk+0x19a/0x800
 [] ? physflat_send_IPI_mask+0x9/0x10
 [] path_openat.isra.68+0x94/0x450
 [] ? __mutex_lock_slowpath+0x1a8/0x1d0
 [] do_filp_open+0x3c/0x90
 [] ? __alloc_fd+0x42/0x100
 [] do_sys_open+0xef/0x1d0
 [] ? do_notify_resume+0x51/0x80
 [] compat_SyS_open+0x16/0x20
 [] sysenter_dispatch+0x7/0x25

Call Trace:
 [] default_idle+0x9/0x10
 [] arch_cpu_idle+0xa/0x10
 [] cpu_startup_entry+0x91/0x180
 [] start_secondary+0x1a0/0x1a4

Call Trace:
 [] ? simple_read_from_buffer+0x42/0xa0
 [] sysfs_read_file+0xe3/0x190
 [] vfs_read+0xa4/0x180
 [] SyS_read+0x4d/0x90
 [] sysenter_dispatch+0x7/0x25

Call Trace:
 [] __mutex_lock_slowpath+0x5d/0x1d0
 [] mutex_lock+0x1d/0x40
 [] sysfs_getattr+0x2b/0x60
 [] vfs_getattr+0x24/0x40
 [] vfs_fstat+0x38/0x70
 [] ? __alloc_fd+0x42/0x100
 [] sys32_fstat64+0x15/0x30
 [] ? do_sys_open+0x164/0x1d0
 [] sysenter_dispatch+0x7/0x25


I have booted this Multiprocessor server with 40 FC-LUNs connected
(multipathing --> 80).

-- 
You are receiving this mail because:
You are the assignee for the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/4] blk-mq: move request structures into struct blk_mq_tags

2014-04-11 Thread Jens Axboe

On 04/11/2014 01:33 AM, Christoph Hellwig wrote:

On Thu, Apr 10, 2014 at 08:42:27PM -0600, Jens Axboe wrote:

Great. Will you send out an updated patchset?


I was waiting for you to apply the previous series, but I'll just resend my
whole set of outstanding patches, it'll need a bit of rebasing against
your updated tree anyway.


I'll take a look at the previous series and apply/comment.

--
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] virtio-scsi: Skip setting affinity on uninitialized vq

2014-04-11 Thread Greg KH
On Fri, Apr 11, 2014 at 03:23:45PM +0800, Fam Zheng wrote:
> virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
> the vqs. The latter calls virtscsi_set_affinity, so let's check the
> pointer there before setting affinity on it.
> 
> This fixes a panic when setting device's num_queues=2 on RHEL 6.5:
> 
> qemu-system-x86_64 ... \
> -device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
> -drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
> -device scsi-hd,drive=drive-scsi-disk,...
> 
> [0.354734] scsi0 : Virtio SCSI HBA
> [0.379504] BUG: unable to handle kernel NULL pointer dereference at 
> 0020
> [0.380141] IP: [] __virtscsi_set_affinity+0x4f/0x120
> [0.380141] PGD 0
> [0.380141] Oops:  [#1] SMP
> [0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
> [0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
> [0.380141] task: 88003c9f ti: 88003c9f8000 task.ti: 
> 88003c9f8000
> [0.380141] RIP: 0010:[]  [] 
> __virtscsi_set_affinity+0x4f/0x120
> [0.380141] RSP: :88003c9f9c08  EFLAGS: 00010256
> [0.380141] RAX:  RBX: 88003c3a9d40 RCX: 
> 1070
> [0.380141] RDX: 0002 RSI:  RDI: 
> 
> [0.380141] RBP: 88003c9f9c28 R08: 000136c0 R09: 
> 88003c801c00
> [0.380141] R10: 81475229 R11: 0008 R12: 
> 
> [0.380141] R13: 81cc7ca8 R14: 88003cac3d40 R15: 
> 88003cac37a0
> [0.380141] FS:  () GS:88003e40() 
> knlGS:
> [0.380141] CS:  0010 DS:  ES:  CR0: 8005003b
> [0.380141] CR2: 0020 CR3: 01c0e000 CR4: 
> 06f0
> [0.380141] Stack:
> [0.380141]  88003c3a9d40  88003cac3d80 
> 88003cac3d40
> [0.380141]  88003c9f9c48 814742e8 88003c26d000 
> 88003c26d000
> [0.380141]  88003c9f9c68 81474321 88003c26d000 
> 88003c3a9d40
> [0.380141] Call Trace:
> [0.380141]  [] virtscsi_set_affinity+0x28/0x40
> [0.380141]  [] virtscsi_remove_vqs+0x21/0x50
> [0.380141]  [] virtscsi_init+0x91/0x240
> [0.380141]  [] ? vp_get+0x50/0x70
> [0.380141]  [] virtscsi_probe+0xf4/0x280
> [0.380141]  [] virtio_dev_probe+0xe5/0x140
> [0.380141]  [] driver_probe_device+0x89/0x230
> [0.380141]  [] __driver_attach+0x9b/0xa0
> [0.380141]  [] ? driver_probe_device+0x230/0x230
> [0.380141]  [] ? driver_probe_device+0x230/0x230
> [0.380141]  [] bus_for_each_dev+0x8c/0xb0
> [0.380141]  [] driver_attach+0x19/0x20
> [0.380141]  [] bus_add_driver+0x198/0x220
> [0.380141]  [] driver_register+0x5f/0xf0
> [0.380141]  [] ? spi_transport_init+0x79/0x79
> [0.380141]  [] register_virtio_driver+0x1b/0x30
> [0.380141]  [] init+0x88/0xd6
> [0.380141]  [] ? scsi_init_procfs+0x5b/0x5b
> [0.380141]  [] do_one_initcall+0x7f/0x10a
> [0.380141]  [] kernel_init_freeable+0x14a/0x1de
> [0.380141]  [] ? kernel_init_freeable+0x1de/0x1de
> [0.380141]  [] ? rest_init+0x80/0x80
> [0.380141]  [] kernel_init+0x9/0xf0
> [0.380141]  [] ret_from_fork+0x7c/0xb0
> [0.380141]  [] ? rest_init+0x80/0x80
> [0.380141] RIP  [] __virtscsi_set_affinity+0x4f/0x120
> [0.380141]  RSP 
> [0.380141] CR2: 0020
> [0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
> [0.475018] Kernel panic - not syncing: Attempted to kill init! 
> exitcode=0x0009
> [0.475018]
> [0.475068] Kernel Offset: 0x0 from 0x8100 (relocation range: 
> 0x8000-0x9fff)
> [0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! 
> exitcode=0x0009
> 
> Signed-off-by: Fam Zheng 
> ---
>  drivers/scsi/virtio_scsi.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)



This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read Documentation/stable_kernel_rules.txt
for how to do this properly.


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 00/12] scsi/NCR5380: fix debugging macros and #include structure

2014-04-11 Thread Sam Creasey
Acked-by: Sam Creasey 

On Wed, Mar 19, 2014 at 11:35:16PM +1100, Finn Thain wrote:
> 
> This patch series addresses several issues with NCR5380 drivers:
> 
> 1. The complex network of #include directives.
> 
> 2. Three inconsistent implementations of the core driver all attempting
>to share the same macro definitions in NCR5380.h.
> 
> 3. Broken debugging code.
> 
> In the past these issues have led to compiler warnings and ugly hacks to
> fix build failures.
> 
> This patch series fixes the debugging code by reducing the divergence
> between the various core driver implementations.
> 
> The final two patches in the series further reduce divergence by refactoring
> sun3_scsi.c and sun3_scsi_vme.c so that they follow the same structure as
> the other NCR5380 drivers.
> 
> By the end of this patch series over 800 net lines of code have been
> removed. This is mostly duplicated code that's easily eliminated once the
> debugging code is made consistent (and some dead code is removed).
> 
> Better uniformity and less duplication should assist future work such as
> modernization and trivial clean-up.
> 
> To make code review easier I've tried to keep these patches succinct and
> free of extraneous changes. Though I did run checkpatch.pl, I've ignored
> whitespace issues in existing code. I will send separate patches for
> whitespace clean-up of NCR5380 drivers.
> 
> All NCR5380 drivers have been compile-tested with this patch series:
>   arm/cumana_1.c
>   arm/oak.c
>   atari_scsi.c
>   dmx3191d.c
>   dtc.c
>   g_NCR5380.c
>   g_NCR5380_mmio.c
>   mac_scsi.c
>   pas16.c
>   sun3_scsi.c
>   sun3_scsi_vme.c
>   t128.c
> 
> I've successfully regression tested this patch series using mac_scsi on a 
> PowerBook 180. The debugging macros are now usable again.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/3] m68k/atari - atari_scsi: change abort/reset return codes

2014-04-11 Thread Sam Creasey
Acked-by: Sam Creasey 

On Thu, Mar 13, 2014 at 01:30:15AM +1100, Finn Thain wrote:
> 
> This is a larger version of Michael's patch. It takes care of the header 
> files and comments and it addresses sun3_NCR5380 as well as atari_NCR5380. 
> This means that the initio.h include (!) can be dropped from sun3_scsi.h.
> 
> Signed-off-by: Finn Thain 
> 
> ---
> 
> This version defines RESET_RUN_DONE in sun3_scsi.c, to avoid changing 
> driver behaviour whilst trying to keep sun3_NCR5380.c in sync with 
> atari_NCR5380.c (from which it was originally copied).
> 
> 
> Index: linux-m68k/drivers/scsi/atari_NCR5380.c
> ===
> --- linux-m68k.orig/drivers/scsi/atari_NCR5380.c  2014-03-13 
> 01:12:33.0 +1100
> +++ linux-m68k/drivers/scsi/atari_NCR5380.c   2014-03-13 01:13:55.0 
> +1100
> @@ -2683,11 +2683,11 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>   local_irq_restore(flags);
>   cmd->scsi_done(cmd);
>   falcon_release_lock_if_possible(hostdata);
> - return SCSI_ABORT_SUCCESS;
> + return SUCCESS;
>   } else {
>  /*   local_irq_restore(flags); */
>   printk("scsi%d: abort of connected command failed!\n", 
> HOSTNO);
> - return SCSI_ABORT_ERROR;
> + return FAILED;
>   }
>   }
>  #endif
> @@ -2711,7 +2711,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>* yet... */
>   tmp->scsi_done(tmp);
>   falcon_release_lock_if_possible(hostdata);
> - return SCSI_ABORT_SUCCESS;
> + return SUCCESS;
>   }
>   }
>  
> @@ -2729,7 +2729,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>   if (hostdata->connected) {
>   local_irq_restore(flags);
>   ABRT_PRINTK("scsi%d: abort failed, command connected.\n", 
> HOSTNO);
> - return SCSI_ABORT_SNOOZE;
> + return FAILED;
>   }
>  
>   /*
> @@ -2764,7 +2764,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>   ABRT_PRINTK("scsi%d: aborting disconnected command.\n", 
> HOSTNO);
>  
>   if (NCR5380_select(instance, cmd, (int)cmd->tag))
> - return SCSI_ABORT_BUSY;
> + return FAILED;
>  
>   ABRT_PRINTK("scsi%d: nexus reestablished.\n", HOSTNO);
>  
> @@ -2791,7 +2791,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>   local_irq_restore(flags);
>   tmp->scsi_done(tmp);
>   
> falcon_release_lock_if_possible(hostdata);
> - return SCSI_ABORT_SUCCESS;
> + return SUCCESS;
>   }
>   }
>   }
> @@ -2816,7 +2816,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>*/
>   falcon_release_lock_if_possible(hostdata);
>  
> - return SCSI_ABORT_NOT_RUNNING;
> + return FAILED;
>  }
>  
>  
> @@ -2825,7 +2825,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
>   *
>   * Purpose : reset the SCSI bus.
>   *
> - * Returns : SCSI_RESET_WAKEUP
> + * Returns : SUCCESS or FAILURE
>   *
>   */
>  
> @@ -2834,7 +2834,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
>   SETUP_HOSTDATA(cmd->device->host);
>   int i;
>   unsigned long flags;
> -#if 1
> +#if defined(RESET_RUN_DONE)
>   Scsi_Cmnd *connected, *disconnected_queue;
>  #endif
>  
> @@ -2859,7 +2859,14 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
>* through anymore ... */
>   (void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
>  
> -#if 1/* XXX Should now be done by midlevel code, but it's broken XXX 
> */
> + /* MSch 20140115 - looking at the generic NCR5380 driver, all of this
> +  * should go.
> +  * Catch-22: if we don't clear all queues, the SCSI driver lock will
> +  * not be released by atari_scsi_reset()!
> +  */
> +
> +#if defined(RESET_RUN_DONE)
> + /* XXX Should now be done by midlevel code, but it's broken XXX */
>   /* XXX see belowXXX */
>  
>   /* MSch: old-style reset: actually abort all command processing here */
> @@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
>* the midlevel code that the reset was SUCCESSFUL, and there is no
>* need to 'wake up' the commands by a request_sense
>*/
> - return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
> + return SUCCESS;
>  #else /* 1 */
>  
>   /* MSch: new-style reset handling: let the mid-level do what it can */
> @@ -2963,6 +2970,6 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
>   local_irq_restore(flags);
>  
>   /* we did no complete reset of all commands, so a wakeup is required */
> 

Re: [PATCH] Update Maintainers for IBM Power 842, vscsi, and vfc drivers

2014-04-11 Thread Robert Jennings
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512



On 04/09/2014 01:32 PM, Nathan Fontenot wrote:
> Update the MAINTAINERS file to indicate the current maintainers
> for the IBM Power 842 Compression driver, IBM Power Virtual SCSI
> driver and the IBM Power Virtual FC Driver.
> 
> Signed-off-by: Nathan Fontenot 

Nathan, sorry I didn't take care of this before I gave up
r...@linux.ibm.com.

Acked-by: Robert Jennings 

> --- MAINTAINERS |   16 +++- 1 file changed, 11 
> insertions(+), 5 deletions(-)
> 
> Index: linux/MAINTAINERS 
> ===
>
>
> 
- --- linux.orig/MAINTAINERS2014-04-08 14:14:57.0 -0500
> +++ linux/MAINTAINERS 2014-04-08 14:25:29.0 -0500 @@ 
> -4358,7 +4358,7 @@ F: drivers/crypto/nx/
> 
> IBM Power 842 compression accelerator -M: Robert Jennings 
>  +M: Nathan Fontenot 
>  S: Supported F: 
> drivers/crypto/nx/nx-842.c F: include/linux/nx842.h @@ -4374,12 
> +4374,18 @@ S:Supported F:drivers/net/ethernet/ibm/ibmveth.*
> 
> -IBM Power Virtual SCSI/FC Device Drivers -M: Robert Jennings 
>  +IBM Power Virtual SCSI Device Drivers
> +M: Nathan Fontenot  L: 
> linux-scsi@vger.kernel.org S: Supported -F:   drivers/scsi/ibmvscsi/
>  -X:  drivers/scsi/ibmvscsi/ibmvstgt.c +F: 
> drivers/scsi/ibmvscsi/ibmvscsi* +F:   drivers/scsi/ibmvscsi/viosrp.h
>  + +IBM Power Virtual FC Device Drivers +M:   Brian King 
>  +L:   linux-scsi@vger.kernel.org +S: 
> Supported +F: drivers/scsi/ibmvscsi/ibmvfc*
> 
> IBM ServeRAID RAID DRIVER P:  Jack Hammer
> 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCgAGBQJTSA1/AAoJEHQMPZ7t8u1zbmwQAJXdfa1pObeOpukcuE924zGH
jKxeDsFSLSrkxltO7vVMZ/y2LsKJtOaNXy1GzSqX7y3TbaDv2hWYi+GcI6/AlBl+
cgTtMBfYmSUpyuOxEdDzkj4KRx8cF02V0ajCcCqkwTqwvDw5JWBR3/sjDTAvYhes
RzCv3Fl6F3Nf0ksTmmmUxlAmXUITH++4paYTZjrTW2N4YVUKVVzszr4K0dFqqqlW
Ffi/brOXPF7ItfdL4/cEm5j2cZPh/zMLHJb24z67WMmzhCIUELzBjlEFRsBalaz/
X+/pKED01KqNiOpWOLR7FKWZlNkiHV2ZB9QxoUAsepI/s94TxOK94nNHiT6feunG
5WQjrwiWYC2ntG/arNITtz/t+Hs0OKsAvT5mCQ4W+e+UzHB/61zeN3p2/avrA0H6
A33yN2BeHkUyR3ra4uzhn+Sx2nOJvArMNGrnw+LAxrxg17ymE7qGvAqGmDExeTRl
dLJv58B94QlchIgApuESQ4pLGvftvgT0bE/34DgWcTIBzQyTneTn5UTCOYR9h6hA
wpDPmujlt5aEEb2Pm11pJSJ7lvY8MoPOqyc7aHWPkz7t6qfKEdJ8IquRFAyqi+/6
MeiinUCUW1Tp4gif+sy+Dc8UIsMIniUDeyA0//aWZCkA+CfF++P89WWdke/c2t+X
otp+JW8ZqTgHZi1DUuiv
=TcEI
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: LSI SAS - SSDs with DRAT and DZAT

2014-04-11 Thread Bernd Schubert

On 02/12/2014 03:27 AM, Kurt Miller wrote:

I can report that the Samsung 840 Pro*does*  support trim on the LSI
SAS2008. As suspected it supports deterministic read zeros after trim.

One other thing to note, in my testing the P16 LSI firmware has broken
trim support. P14 and P15 report incorrect values for
/sys/block/sdX/queue/discard_granularity. P17 and P18 appear to work
fine and report correct values for discard_granularity.


We are just looking for SSDs for our new compute cluster and would like 
to get SSDs that support trim on LSI sas controllers out of the box.
Unfortunately, for a test sample of Samsungs MZ7WD240HCFV discard is not 
enabled by default, so probably DRAT and DZAT are missing
(I can't test that right now, as 'hdparm -I' does not seem to work with 
devices attached to the controller).


A colleague just told me that Samsung 840 Pro are also not an ideal 
option, as these have set overprovisioning to 0 bytes by default and 
there only seems to be windows tool to set it to a higher value. Not a 
nice idea if you want to do that for dozens or hundreds of drives.


Any other suggestions for ~240GB SSDs supporting DRAT and DZAT or 
trim-on-lsi-sas in general? The LSI support link sent by Kurt [1] is 
also not perfect with respect to trim, as it lists Intel510, although we 
definitely know that Intel510s are disabled by default and forcing 
write-same trim causes data corruption (unmap works, though).



Thanks in advance,
Bernd


[1]

http://www.lsi.com/downloads/Public/Host%20Bus%20Adapters/Host%20Bus%20Adapters%20Common%20Files/LSI_6Gb_SAS_SATA_HBA_Compatibility_List.pdf



--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/6] qla4xxx: 5.04.00-k6: Updates for scsi "misc" branch

2014-04-11 Thread Mike Christie
On 04/09/2014 08:12 PM, vikas.chaudh...@qlogic.com wrote:
> From: Vikas Chaudhary 
> 
> James,
> 
> Please apply the following patches to the scsi tree at your earliest 
> convenience.
> 
> Adheer Chandravanshi (2):
>   qla4xxx: Fix smatch warning in func qla4xxx_get_ep_param
>   qla4xxx: Fix smatch warning in func qla4xxx_conn_get_param
> 
> Nilesh Javali (2):
>   qla4xxx: Export sysfs DDBs from DPC handler
>   qla4xxx: Fix memory leak for ha->saved_acb
> 
> Tej Parkash (1):
>   qla4xxx: Disable INTx interrupt for ISP82XX
> 
> Vikas Chaudhary (1):
>   qla4xxx: Update driver version to 5.04.00-k6
> 

Looks ok.

Reviewed-by: Mike Christie 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL] async scsi resume for 3.15

2014-04-11 Thread James Bottomley
On Thu, 2014-04-10 at 18:24 -0700, Dan Williams wrote:
> Hi Linus,
> 
> James might still be in the process of sending this your way.  However,
> given the proximity to -rc1, my reasoning for sending this directly is:
> 
> 1/ It provides a tangible speed up for a non-esoteric use case (laptop
> resume):
> 
>   
> https://01.org/suspendresume/blogs/tebrandt/2013/hard-disk-resume-optimization-simpler-approach
> 
> 2/ You already pulled the first half of this enabling from Tejun.
> Quoting Tejun's ATA pull request:
> 
>   "Dan finishes the patchset to make libata PM operations
>asynchronous.  Combined with one patch being routed through scsi,
>this should speed resume measurably."
> 
> 3/ As far as I can tell it is acceptable to James:
> 
>   http://marc.info/?l=linux-scsi&m=139499409510791&w=2
>   http://marc.info/?l=linux-scsi&m=139508044602605&w=2
>   http://marc.info/?l=linux-scsi&m=139536062515216&w=2
> 
> 4/ I promised Todd I would get it upstream before he returns from
> vacation.
> 
> Please pull, thank you.

OK, so this missed the SCSI cutoff window because the series wasn't
finalised until 17 March and, originally, I thought Linus would cut us
off at -rc7 which was 16 March.  In reality we got an extra week, but I
spent that ironing out a few late arriving bugs in the tree itself
rather than integrating features.

For drivers, I'm willing to buck the release protocols a bit because
they're self contained, but for core features, they are supposed to be
all finalised by -rc5.  Plus Linus bites me every time I do it even for
drivers, so I was actually letting the scars heal a bit.

I also don't see this in linux-next, unless I'm not looking in the right
place, so it would be a bit of a risk adding it just before -rc1.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL] async scsi resume for 3.15

2014-04-11 Thread Dan Williams
On Fri, Apr 11, 2014 at 11:20 AM, James Bottomley
 wrote:
> On Thu, 2014-04-10 at 18:24 -0700, Dan Williams wrote:
>> Hi Linus,
>>
>> James might still be in the process of sending this your way.  However,
>> given the proximity to -rc1, my reasoning for sending this directly is:
>>
>> 1/ It provides a tangible speed up for a non-esoteric use case (laptop
>> resume):
>>
>>   
>> https://01.org/suspendresume/blogs/tebrandt/2013/hard-disk-resume-optimization-simpler-approach
>>
>> 2/ You already pulled the first half of this enabling from Tejun.
>> Quoting Tejun's ATA pull request:
>>
>>   "Dan finishes the patchset to make libata PM operations
>>asynchronous.  Combined with one patch being routed through scsi,
>>this should speed resume measurably."
>>
>> 3/ As far as I can tell it is acceptable to James:
>>
>>   http://marc.info/?l=linux-scsi&m=139499409510791&w=2
>>   http://marc.info/?l=linux-scsi&m=139508044602605&w=2
>>   http://marc.info/?l=linux-scsi&m=139536062515216&w=2
>>
>> 4/ I promised Todd I would get it upstream before he returns from
>> vacation.
>>
>> Please pull, thank you.
>
> OK, so this missed the SCSI cutoff window because the series wasn't
> finalised until 17 March and, originally, I thought Linus would cut us
> off at -rc7 which was 16 March.  In reality we got an extra week, but I
> spent that ironing out a few late arriving bugs in the tree itself
> rather than integrating features.
>
> For drivers, I'm willing to buck the release protocols a bit because
> they're self contained, but for core features, they are supposed to be
> all finalised by -rc5.  Plus Linus bites me every time I do it even for
> drivers, so I was actually letting the scars heal a bit.
>
> I also don't see this in linux-next, unless I'm not looking in the right
> place, so it would be a bit of a risk adding it just before -rc1.
>
[forgive the resend... google apps converted the last one to html]

Correct, I did not push to -next as not to collide with an appearance
in scsi-misc.  However, it is on korg, so the 0-day kbuild robot has
seen it.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] Fix USB deadlock caused by SCSI error handling

2014-04-11 Thread Andreas Reis
I did set the scsi_logging_level as you wrote, but it still resulted 
into exactly the same dmesg (resp. sudo journalctl -b 0) output with the 
entire patchset (including the "scmd->eh_eflags = 0;"). Except for the 
reverted "do nothing"s, for course.


However, I did miss to mention the following which is printed once with 
or without the scsi_logging_level change:


[16254.735372] sd 9:0:0:0: Device offlined - not ready after error recovery
[16254.735393] sd 9:0:0:0: rejecting I/O to offline device
[16254.735397] sd 9:0:0:0: [sdf] killing request
[16254.735488] sd 9:0:0:0: [sdf] Unhandled error code
[16254.735489] sd 9:0:0:0: [sdf]
[16254.735490] Result: hostbyte=0x01 driverbyte=0x00
[16254.735492] sd 9:0:0:0: [sdf] CDB:
[16254.735493] cdb[0]=0x2a: 2a 00 03 1c 10 f8 00 00 f0 00
[16254.735498] end_request: I/O error, dev sdf, sector 52171000

Another:

[19389.907015] sd 11:0:0:0: Device offlined - not ready after error recovery
[19389.907037] sd 11:0:0:0: [sdf] Unhandled error code
[19389.907044] sd 11:0:0:0: [sdf]
[19389.907049] Result: hostbyte=0x05 driverbyte=0x00
[19389.907055] sd 11:0:0:0: [sdf] CDB:
[19389.907060] cdb[0]=0x28: 28 00 03 13 0d 28 00 00 08 00
[19389.907083] end_request: I/O error, dev sdf, sector 51580200
[19389.907121] sd 11:0:0:0: rejecting I/O to offline device
[19389.907126] sd 11:0:0:0: killing request

In case it matters, the stick's partition stays readable with regard to 
any data on it that has been cached.


On 10.04.2014 13:37, Hannes Reinecke wrote:

Andreas, can you test with the entire patch series and enable
'scsi_logging_level -s -E 5' prior to running the tests?

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 26/42] qla2xxx: Avoid escalating the SCSI error handler if the command is not found in firmware.

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

If the firmware cannot find the command specified then return SUCCESS to the
error handler so as not to needlessly escalate.  Also cleanup the resources for
the command since we cannot expect the original command to returned in
interrupt context.

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_def.h |2 ++
 drivers/scsi/qla2xxx/qla_mbx.c |5 -
 drivers/scsi/qla2xxx/qla_os.c  |   24 
 3 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index a81e8ba..6c9724c 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1755,6 +1755,8 @@ typedef struct {
 #define CS_PORT_CONFIG_CHG 0x2A/* Port Configuration Changed */
 #define CS_PORT_BUSY   0x2B/* Port Busy */
 #define CS_COMPLETE_CHKCOND0x30/* Error? */
+#define CS_IOCB_ERROR  0x31/* Generic error for IOCB request
+  failure */
 #define CS_BAD_PAYLOAD 0x80/* Driver defined */
 #define CS_UNKNOWN 0x81/* Driver defined */
 #define CS_RETRY   0x82/* Driver defined */
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index a2e3787..01d9f54 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2644,7 +2644,10 @@ qla24xx_abort_command(srb_t *sp)
ql_dbg(ql_dbg_mbx, vha, 0x1090,
"Failed to complete IOCB -- completion status (%x).\n",
le16_to_cpu(abt->nport_handle));
-   rval = QLA_FUNCTION_FAILED;
+   if (abt->nport_handle == CS_IOCB_ERROR)
+   rval = QLA_FUNCTION_PARAMETER_ERROR;
+   else
+   rval = QLA_FUNCTION_FAILED;
} else {
ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x1091,
"Done %s.\n", __func__);
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index b182d276..8f1a098 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -945,7 +945,7 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
int ret;
unsigned int id, lun;
unsigned long flags;
-   int wait = 0;
+   int rval, wait = 0;
struct qla_hw_data *ha = vha->hw;
 
if (!CMD_SP(cmd))
@@ -974,10 +974,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
sp_get(sp);
 
spin_unlock_irqrestore(&ha->hardware_lock, flags);
-   if (ha->isp_ops->abort_command(sp)) {
-   ret = FAILED;
+   rval = ha->isp_ops->abort_command(sp);
+   if (rval) {
+   if (rval == QLA_FUNCTION_PARAMETER_ERROR) {
+   /*
+* Decrement the ref_count since we can't find the
+* command
+*/
+   atomic_dec(&sp->ref_count);
+   ret = SUCCESS;
+   } else
+   ret = FAILED;
+
ql_dbg(ql_dbg_taskm, vha, 0x8003,
-   "Abort command mbx failed cmd=%p.\n", cmd);
+   "Abort command mbx failed cmd=%p, rval=%x.\n", cmd, rval);
} else {
ql_dbg(ql_dbg_taskm, vha, 0x8004,
"Abort command mbx success cmd=%p.\n", cmd);
@@ -985,6 +995,12 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
}
 
spin_lock_irqsave(&ha->hardware_lock, flags);
+   /*
+* Clear the slot in the oustanding_cmds array if we can't find the
+* command to reclaim the resources.
+*/
+   if (rval == QLA_FUNCTION_PARAMETER_ERROR)
+   vha->req->outstanding_cmds[sp->handle] = NULL;
sp->done(ha, sp, 0);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 25/42] qla2xxx: IOCB data should be copied to I/O mem using memcpy_toio.

2014-04-11 Thread Saurav Kashyap
From: Atul Deshmukh 

Signed-off-by: Atul Deshmukh 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_mr.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index eb9be2e..3fdf844 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -3427,7 +3427,7 @@ qlafx00_fxdisc_iocb(srb_t *sp, struct fxdisc_entry_fx00 
*pfxiocb)
sp->fcport->vha, 0x3047,
(uint8_t *)&fx_iocb, sizeof(struct fxdisc_entry_fx00));
 
-   memcpy((void *)pfxiocb, &fx_iocb,
+   memcpy_toio((void __iomem *)pfxiocb, &fx_iocb,
sizeof(struct fxdisc_entry_fx00));
wmb();
 }
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/42] qla2xxx: Allow the next firmware dump if the previous dump capture fails for ISP8044.

2014-04-11 Thread Saurav Kashyap
Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_def.h |1 +
 drivers/scsi/qla2xxx/qla_nx.c  |   12 ++--
 drivers/scsi/qla2xxx/qla_nx2.c |3 +++
 drivers/scsi/qla2xxx/qla_os.c  |1 +
 4 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 89bece7..bab1cf1 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -3141,6 +3141,7 @@ struct qla_hw_data {
uint32_tfw_dump_len;
int fw_dumped;
int fw_dump_reading;
+   int prev_minidump_failed;
dma_addr_t  eft_dma;
void*eft;
 /* Current size of mctp dump is 0x086064 bytes */
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 81388e9..3c5819a 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -3142,18 +3142,18 @@ qla82xx_check_md_needed(scsi_qla_host_t *vha)
 
if (ql2xmdenable) {
if (!ha->fw_dumped) {
-   if (fw_major_version != ha->fw_major_version ||
+   if ((fw_major_version != ha->fw_major_version ||
fw_minor_version != ha->fw_minor_version ||
-   fw_subminor_version != ha->fw_subminor_version) {
+   fw_subminor_version != ha->fw_subminor_version) ||
+   (ha->prev_minidump_failed)) {
ql_dbg(ql_dbg_p3p, vha, 0xb02d,
-   "Firmware version differs "
-   "Previous version: %d:%d:%d - "
-   "New version: %d:%d:%d\n",
+   "Firmware version differs Previous version: 
%d:%d:%d - New version: %d:%d:%d, prev_minidump_failed: %d.\n",
fw_major_version, fw_minor_version,
fw_subminor_version,
ha->fw_major_version,
ha->fw_minor_version,
-   ha->fw_subminor_version);
+   ha->fw_subminor_version,
+   ha->prev_minidump_failed);
/* Release MiniDump resources */
qla82xx_md_free(vha);
/* ALlocate MiniDump resources */
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index e381835..d36a623 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -3125,6 +3125,7 @@ skip_nxt_entry:
"Dump data mismatch: Data collected: "
"[0x%x], total_data_size:[0x%x]\n",
data_collected, ha->md_dump_size);
+   rval = QLA_FUNCTION_FAILED;
goto md_failed;
}
 
@@ -3149,10 +3150,12 @@ qla8044_get_minidump(struct scsi_qla_host *vha)
 
if (!qla8044_collect_md_data(vha)) {
ha->fw_dumped = 1;
+   ha->prev_minidump_failed = 0;
} else {
ql_log(ql_log_fatal, vha, 0xb0db,
"%s: Unable to collect minidump\n",
__func__);
+   ha->prev_minidump_failed = 1;
}
 }
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 1b1cd75..0114ea4 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2885,6 +2885,7 @@ skip_dpc:
 
base_vha->flags.init_done = 1;
base_vha->flags.online = 1;
+   ha->prev_minidump_failed = 0;
 
ql_dbg(ql_dbg_init, base_vha, 0x00f2,
"Init done and hba is online.\n");
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/42] qla2xxx: Track the process when the ROM_LOCK failure happens

2014-04-11 Thread Saurav Kashyap
From: Hiral Patel 

Signed-off-by: Hiral Patel 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx.c |   20 ++--
 drivers/scsi/qla2xxx/qla_nx.h |3 ---
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 3c5819a..61774bc 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -860,13 +860,14 @@ qla82xx_rom_lock(struct qla_hw_data *ha)
}
timeout++;
}
-   qla82xx_wr_32(ha, QLA82XX_ROM_LOCK_ID, ROM_LOCK_DRIVER);
+   qla82xx_wr_32(ha, QLA82XX_ROM_LOCK_ID, ha->portnum);
return 0;
 }
 
 static void
 qla82xx_rom_unlock(struct qla_hw_data *ha)
 {
+   qla82xx_wr_32(ha, QLA82XX_ROM_LOCK_ID, 0x);
qla82xx_rd_32(ha, QLA82XX_PCIE_REG(PCIE_SEM2_UNLOCK));
 }
 
@@ -950,6 +951,7 @@ static int
 qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, int *valp)
 {
int ret, loops = 0;
+   uint32_t lock_owner = 0;
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
while ((qla82xx_rom_lock(ha) != 0) && (loops < 5)) {
@@ -958,8 +960,10 @@ qla82xx_rom_fast_read(struct qla_hw_data *ha, int addr, 
int *valp)
loops++;
}
if (loops >= 5) {
+   lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
ql_log(ql_log_fatal, vha, 0x00b9,
-   "Failed to acquire SEM2 lock.\n");
+   "Failed to acquire SEM2 lock, Lock Owner %u.\n",
+   lock_owner);
return -1;
}
ret = qla82xx_do_rom_fast_read(ha, addr, valp);
@@ -1057,6 +1061,7 @@ static int
 ql82xx_rom_lock_d(struct qla_hw_data *ha)
 {
int loops = 0;
+   uint32_t lock_owner = 0;
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
while ((qla82xx_rom_lock(ha) != 0) && (loops < 5)) {
@@ -1065,8 +1070,9 @@ ql82xx_rom_lock_d(struct qla_hw_data *ha)
loops++;
}
if (loops >= 5) {
+   lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
ql_log(ql_log_warn, vha, 0xb010,
-   "ROM lock failed.\n");
+   "ROM lock failed, Lock Owner %u.\n", lock_owner);
return -1;
}
return 0;
@@ -2811,12 +2817,14 @@ static void
 qla82xx_rom_lock_recovery(struct qla_hw_data *ha)
 {
scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
+   uint32_t lock_owner = 0;
 
-   if (qla82xx_rom_lock(ha))
+   if (qla82xx_rom_lock(ha)) {
+   lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
/* Someone else is holding the lock. */
ql_log(ql_log_info, vha, 0xb022,
-   "Resetting rom_lock.\n");
-
+   "Resetting rom_lock, Lock Owner %u.\n", lock_owner);
+   }
/*
 * Either we got the lock, or someone
 * else died while holding it.
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h
index d57f6fe..d978a5d 100644
--- a/drivers/scsi/qla2xxx/qla_nx.h
+++ b/drivers/scsi/qla2xxx/qla_nx.h
@@ -333,9 +333,6 @@
 #define QLA82XX_ROMUSB_ROM_INSTR_OPCODE(ROMUSB_ROM + 0x0004)
 #define QLA82XX_ROMUSB_GLB_CAS_RST (ROMUSB_GLB + 0x0038)
 
-/* Lock IDs for ROM lock */
-#define ROM_LOCK_DRIVER   0x0d417340
-
 #define QLA82XX_PCI_CRB_WINDOWSIZE 0x0010   /* all are 1MB windows */
 #define QLA82XX_PCI_CRB_WINDOW(A) \
(QLA82XX_PCI_CRBSPACE + (A)*QLA82XX_PCI_CRB_WINDOWSIZE)
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 22/42] qla2xxx: Include file for msleep declartion in qla_nx2.c file.

2014-04-11 Thread Saurav Kashyap
From: Atul Deshmukh 

Signed-off-by: Atul Deshmukh 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx2.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index e631db4..73ca8ed 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 
 #include "qla_def.h"
 #include "qla_gbl.h"
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 21/42] qla2xxx: Use proper log message for flash lock failed error.

2014-04-11 Thread Saurav Kashyap
From: Atul Deshmukh 

Signed-off-by: Atul Deshmukh 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c |2 +-
 drivers/scsi/qla2xxx/qla_nx.c  |4 
 drivers/scsi/qla2xxx/qla_nx2.c |4 ++--
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 08572b9..e48084f 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -49,7 +49,7 @@
  * |  || 0x800b,0x8039  |
  * | AER/EEH  |   0x9011   |   |
  * | Virtual Port |   0xa007   |   |
- * | ISP82XX Specific |   0xb155   | 0xb002,0xb024  |
+ * | ISP82XX Specific |   0xb157   | 0xb002,0xb024  |
  * |  || 0xb09e,0xb0ae  |
  * |  || 0xb0e0-0xb0ef  |
  * |  || 0xb085,0xb0dc  |
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index c268b3f..190283e 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -848,6 +848,7 @@ qla82xx_rom_lock(struct qla_hw_data *ha)
 {
int done = 0, timeout = 0;
uint32_t lock_owner = 0;
+   scsi_qla_host_t *vha = pci_get_drvdata(ha->pdev);
 
while (!done) {
/* acquire semaphore2 from PCI HW block */
@@ -856,6 +857,9 @@ qla82xx_rom_lock(struct qla_hw_data *ha)
break;
if (timeout >= qla82xx_rom_lock_timeout) {
lock_owner = qla82xx_rd_32(ha, QLA82XX_ROM_LOCK_ID);
+   ql_log(ql_log_warn, vha, 0xb157,
+   "%s: Simultaneous flash access by following ports, 
active port = %d: accessing port = %d",
+   __func__, ha->portnum, lock_owner);
return -1;
}
timeout++;
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index e38d84c..e631db4 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -448,8 +448,8 @@ qla8044_flash_lock(scsi_qla_host_t *vha)
lock_owner = qla8044_rd_reg(ha,
QLA8044_FLASH_LOCK_ID);
ql_log(ql_log_warn, vha, 0xb113,
-   "%s: flash lock by %d failed, held by %d\n",
-   __func__, ha->portnum, lock_owner);
+   "%s: Simultaneous flash access by following ports, 
active port = %d: accessing port = %d",
+   __func__, ha->portnum, lock_owner);
ret_val = QLA_FUNCTION_FAILED;
break;
}
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 39/42] qla2xxx: ABTS cause double free of qla_tgt_cmd +.

2014-04-11 Thread Saurav Kashyap
From: Quinn Tran 

Fix double free problem within qla2xxx driver where
current code prematurely free qla_tgt_cmd while firmware
still has the command.  When firmware release the command
after abort, the code attempt a second free as part of
command completion processing.

When TCM start the free process, NULL pointer was hit.

--
WARNING: CPU: 8 PID: 43613 at lib/list_debug.c:62 __list_del_entry+0x82/0xd0()
list_del corruption. next->prev should be 88082b5cfb08, but was 
6b6b6b6b6b6b6b6b
CPU: 8 PID: 43613 Comm: kworker/8:0 Tainted: GF   W  O 
3.13.0-rc3-nab_t10dif+ #6
Hardware name: HP ProLiant DL380p Gen8, BIOS P70 08/20/2012
Workqueue: events cache_reap
003e 88081b2e3c78 815a051f 003e
88081b2e3cc8 88081b2e3cb8 8104fc2c 
88082b5cfb00 88081c788d00 88082b5d7200 88082b5d3080
Call Trace:
[] dump_stack+0x49/0x62
[] warn_slowpath_common+0x8c/0xc0
[] warn_slowpath_fmt+0x46/0x50
[] __list_del_entry+0x82/0xd0
[] process_one_work+0x12c/0x510
[] ? process_one_work+0x173/0x510
[] worker_thread+0x11f/0x3a0
[] ? manage_workers+0x170/0x170
[] kthread+0xf6/0x120
[] ? __lock_release+0x133/0x1b0
[] ? __init_kthread_worker+0x70/0x70
[] ret_from_fork+0x7c/0xb0
[] ? __init_kthread_worker+0x70/0x70
---[ end trace dfc05c3f7caf8ebe ]---
BUG: unable to handle kernel NULL pointer dereference at 0008
IP: [] process_one_work+0x31/0x510
---

Signed-off-by: Quinn Tran 
Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_target.c |   29 ++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c 
b/drivers/scsi/qla2xxx/qla_target.c
index f24d44c..b1d10f9 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -2681,7 +2681,18 @@ static void qlt_send_term_exchange(struct scsi_qla_host 
*vha,
rc = __qlt_send_term_exchange(vha, cmd, atio);
spin_unlock_irqrestore(&vha->hw->hardware_lock, flags);
 done:
-   if (rc == 1) {
+   /*
+* Terminate exchange will tell fw to release any active CTIO
+* that's in FW posession and cleanup the exchange.
+*
+* "cmd->state == QLA_TGT_STATE_ABORTED" means CTIO is still
+* down at FW.  Free the cmd later when CTIO comes back later
+* w/aborted(0x2) status.
+*
+* "cmd->state != QLA_TGT_STATE_ABORTED" means CTIO is already
+* back w/some err.  Free the cmd now.
+*/
+   if ((rc == 1) && (cmd->state != QLA_TGT_STATE_ABORTED)) {
if (!ha_locked && !in_interrupt())
msleep(250); /* just in case */
 
@@ -2689,6 +2700,7 @@ done:
qlt_unmap_sg(vha, cmd);
vha->hw->tgt.tgt_ops->free_cmd(cmd);
}
+   return;
 }
 
 void qlt_free_cmd(struct qla_tgt_cmd *cmd)
@@ -2906,6 +2918,7 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
case CTIO_LIP_RESET:
case CTIO_TARGET_RESET:
case CTIO_ABORTED:
+   /* driver request abort via Terminate exchange */
case CTIO_TIMEOUT:
case CTIO_INVALID_RX_ID:
/* They are OK */
@@ -2974,9 +2987,18 @@ static void qlt_do_ctio_completion(struct scsi_qla_host 
*vha, uint32_t handle,
break;
}
 
-   if (cmd->state != QLA_TGT_STATE_NEED_DATA)
+
+   /* "cmd->state == QLA_TGT_STATE_ABORTED" means
+* cmd is already aborted/terminated, we don't
+* need to terminate again.  The exchange is already
+* cleaned up/freed at FW level.  Just cleanup at driver
+* level.
+*/
+   if ((cmd->state != QLA_TGT_STATE_NEED_DATA) &&
+   (cmd->state != QLA_TGT_STATE_ABORTED)) {
if (qlt_term_ctio_exchange(vha, ctio, cmd, status))
return;
+   }
}
 skip_term:
 
@@ -3007,7 +3029,8 @@ skip_term:
"not return a CTIO complete\n", vha->vp_idx, cmd->state);
}
 
-   if (unlikely(status != CTIO_SUCCESS)) {
+   if (unlikely(status != CTIO_SUCCESS) &&
+   (cmd->state != QLA_TGT_STATE_ABORTED)) {
ql_dbg(ql_dbg_tgt_mgt, vha, 0xf01f, "Finishing failed CTIO\n");
dump_stack();
}
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/42] qla2xxx: Add ISP8044 serdes bsg interface.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_bsg.c |   47 +-
 drivers/scsi/qla2xxx/qla_bsg.h |7 
 drivers/scsi/qla2xxx/qla_dbg.c |2 +-
 drivers/scsi/qla2xxx/qla_def.h |7 
 drivers/scsi/qla2xxx/qla_gbl.h |5 +++
 drivers/scsi/qla2xxx/qla_mbx.c |   72 
 6 files changed, 137 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 71ff340..467c694 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -2054,9 +2054,49 @@ qla26xx_serdes_op(struct fc_bsg_job *bsg_job)
bsg_job->reply->reply_payload_rcv_len = sizeof(sr);
break;
default:
-   ql_log(ql_log_warn, vha, 0x708c,
+   ql_dbg(ql_dbg_user, vha, 0x708c,
"Unknown serdes cmd %x.\n", sr.cmd);
-   rval = -EDOM;
+   rval = -EINVAL;
+   break;
+   }
+
+   bsg_job->reply->reply_data.vendor_reply.vendor_rsp[0] =
+   rval ? EXT_STATUS_MAILBOX : 0;
+
+   bsg_job->reply_len = sizeof(struct fc_bsg_reply);
+   bsg_job->reply->result = DID_OK << 16;
+   bsg_job->job_done(bsg_job);
+   return 0;
+}
+
+static int
+qla8044_serdes_op(struct fc_bsg_job *bsg_job)
+{
+   struct Scsi_Host *host = bsg_job->shost;
+   scsi_qla_host_t *vha = shost_priv(host);
+   int rval = 0;
+   struct qla_serdes_reg_ex sr;
+
+   memset(&sr, 0, sizeof(sr));
+
+   sg_copy_to_buffer(bsg_job->request_payload.sg_list,
+   bsg_job->request_payload.sg_cnt, &sr, sizeof(sr));
+
+   switch (sr.cmd) {
+   case INT_SC_SERDES_WRITE_REG:
+   rval = qla8044_write_serdes_word(vha, sr.addr, sr.val);
+   bsg_job->reply->reply_payload_rcv_len = 0;
+   break;
+   case INT_SC_SERDES_READ_REG:
+   rval = qla8044_read_serdes_word(vha, sr.addr, &sr.val);
+   sg_copy_from_buffer(bsg_job->reply_payload.sg_list,
+   bsg_job->reply_payload.sg_cnt, &sr, sizeof(sr));
+   bsg_job->reply->reply_payload_rcv_len = sizeof(sr);
+   break;
+   default:
+   ql_dbg(ql_dbg_user, vha, 0x70cf,
+   "Unknown serdes cmd %x.\n", sr.cmd);
+   rval = -EINVAL;
break;
}
 
@@ -2121,6 +2161,9 @@ qla2x00_process_vendor_specific(struct fc_bsg_job 
*bsg_job)
case QL_VND_SERDES_OP:
return qla26xx_serdes_op(bsg_job);
 
+   case QL_VND_SERDES_OP_EX:
+   return qla8044_serdes_op(bsg_job);
+
default:
return -ENOSYS;
}
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index e5c2126..4e49d0a 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -24,6 +24,7 @@
 #define QL_VND_READ_I2C0x11
 #define QL_VND_FX00_MGMT_CMD   0x12
 #define QL_VND_SERDES_OP   0x13
+#defineQL_VND_SERDES_OP_EX 0x14
 
 /* BSG Vendor specific subcode returns */
 #define EXT_STATUS_OK  0
@@ -225,4 +226,10 @@ struct qla_serdes_reg {
uint16_t val;
 } __packed;
 
+struct qla_serdes_reg_ex {
+   uint16_t cmd;
+   uint32_t addr;
+   uint32_t val;
+} __packed;
+
 #endif
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 7cf1044..ba72e16 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -15,7 +15,7 @@
  * |  || 0x0144,0x0146 |
  * |  || 0x015b-0x0160 |
  * |  || 0x016e-0x0170 |
- * | Mailbox commands |   0x1187   | 0x1018-0x1019 |
+ * | Mailbox commands |   0x118d   | 0x1018-0x1019 |
  * |  || 0x10ca |
  * |  || 0x1115-0x1116  |
  * |  || 0x111a-0x111b |
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index bab1cf1..2326827 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -965,6 +965,13 @@ struct mbx_cmd_32 {
  */
 #define MBC_WRITE_MPI_REGISTER 0x01/* Write MPI Register. */
 
+/*
+ * ISP8044 mailbox commands
+ */
+#define MBC_SET_GET_ETH_SERDES_REG 0x150
+#define HCS_WRITE_SERDES   0x3
+#define HCS_READ_SERDES0x4
+
 /* Firmware return data sizes */
 #define FCAL_MAP_SIZE  128
 
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index e665e81..b66710b 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -347,6 +347,11 @@ extern int
 qla2x00_r

[PATCH 11/42] qla2xxx: Check for peg alive counter and clear any outstanding mailbox command.

2014-04-11 Thread Saurav Kashyap
From: Giridhar Malavali 

Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx2.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 6d73e2e..131a9d5 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -2124,6 +2124,13 @@ qla8044_watchdog(struct scsi_qla_host *vha)
test_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags))) {
dev_state = qla8044_rd_direct(vha, QLA8044_CRB_DEV_STATE_INDEX);
 
+   if (qla8044_check_fw_alive(vha)) {
+   ha->flags.isp82xx_fw_hung = 1;
+   ql_log(ql_log_warn, vha, 0xb10a,
+   "Firmware hung.\n");
+   qla82xx_clear_pending_mbx(vha);
+   }
+
if (qla8044_check_temp(vha)) {
set_bit(ISP_UNRECOVERABLE, &vha->dpc_flags);
ha->flags.isp82xx_fw_hung = 1;
@@ -2144,7 +2151,7 @@ qla8044_watchdog(struct scsi_qla_host *vha)
qla2xxx_wake_dpc(vha);
} else  {
/* Check firmware health */
-   if (qla8044_check_fw_alive(vha)) {
+   if (ha->flags.isp82xx_fw_hung) {
halt_status = qla8044_rd_direct(vha,
QLA8044_PEG_HALT_STATUS1_INDEX);
if (halt_status &
@@ -2180,12 +2187,8 @@ qla8044_watchdog(struct scsi_qla_host *vha)
__func__);
set_bit(ISP_ABORT_NEEDED,
&vha->dpc_flags);
-   qla82xx_clear_pending_mbx(vha);
}
}
-   ha->flags.isp82xx_fw_hung = 1;
-   ql_log(ql_log_warn, vha, 0xb10a,
-   "Firmware hung.\n");
qla2xxx_wake_dpc(vha);
}
}
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 23/42] qla2xxx: Remove unnecessary printk_ratelimited from qla_nx2.c

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx2.c |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 73ca8ed..75e947a 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -2397,8 +2397,6 @@ qla8044_minidump_process_rdmem(struct scsi_qla_host *vha,
}
 
if (j >= MAX_CTL_CHECK) {
-   printk_ratelimited(KERN_ERR
-   "%s: failed to read through agent\n", __func__);
write_unlock_irqrestore(&ha->hw_lock, flags);
return QLA_SUCCESS;
}
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/42] qla2xxx: Allow ISP83XX and ISP27XX both to write req_q_out register.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_mbx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 2528709..9570597 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3697,7 +3697,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct 
req_que *req)
spin_lock_irqsave(&ha->hardware_lock, flags);
if (!(req->options & BIT_0)) {
WRT_REG_DWORD(req->req_q_in, 0);
-   if (!IS_QLA83XX(ha) || !IS_QLA27XX(ha))
+   if (!IS_QLA83XX(ha) && !IS_QLA27XX(ha))
WRT_REG_DWORD(req->req_q_out, 0);
}
spin_unlock_irqrestore(&ha->hardware_lock, flags);
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 18/42] qla2xxx: Update entry type 270 to match spec update.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Increment the address by 4 on each iteration.

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_tmpl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index 8dc9813..f7d04d4 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -613,7 +613,7 @@ qla27xx_fwdt_entry_t270(struct scsi_qla_host *vha,
qla27xx_write_reg(reg, 0xc0, addr|0x8000, buf);
qla27xx_insert32(addr, buf, len);
qla27xx_read_off(reg, 0xc4, buf, len);
-   addr++;
+   addr += sizeof(uint32_t);
}
 
return false;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 13/42] qla2xxx: Correction to ISP27xx template entry types 256 and 258.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

The window address inserted into the dump should be have been
incremented by 1 rather than 4.

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_tmpl.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index 2909804..8469405 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -249,7 +249,7 @@ qla27xx_read_window(__iomem struct device_reg_24xx *reg,
qla27xx_insert32(base, buf, len);
readn(window, buf, len);
window += width;
-   base += width;
+   base++;
}
 }
 
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/42] qla2xxx: Correct operations for ISP27xx template types 270 and 271.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |2 +-
 drivers/scsi/qla2xxx/qla_tmpl.c |   21 -
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 97255f7..c6ecd24 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -60,7 +60,7 @@
  * |  || 0xb13c-0xb140  |
  * |  || 0xb149
|
  * | MultiQ   |   0xc00c   |   |
- * | Misc |   0xd2ff   | 0xd017-0xd019 |
+ * | Misc |   0xd300   | 0xd017-0xd019 |
  * |  || 0xd020
|
  * |  || 0xd02e-0xd0ff |
  * |  || 0xd101-0xd1fe |
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index a804e9b..2909804 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -192,6 +192,19 @@ static inline void (*qla27xx_read_vector(uint width))(void 
*, void *, ulong *)
 }
 
 static inline void
+qla27xx_read_off(__iomem struct device_reg_24xx *reg,
+   uint offset, void *buf, ulong *len)
+{
+   void *window = (void *)reg + offset;
+
+   if (buf) {
+   ql_dbg(ql_dbg_misc, NULL, 0xd300,
+   "%s: @%x\n", __func__, offset);
+   }
+   qla27xx_read32(window, buf, len);
+}
+
+static inline void
 qla27xx_read_reg(__iomem struct device_reg_24xx *reg,
uint offset, void *buf, ulong *len)
 {
@@ -590,7 +603,6 @@ qla27xx_fwdt_entry_t270(struct scsi_qla_host *vha,
struct qla27xx_fwdt_entry *ent, void *buf, ulong *len)
 {
struct device_reg_24xx __iomem *reg = qla27xx_isp_reg(vha);
-   void *window = (void *)reg + 0xc4;
ulong dwords = ent->t270.count;
ulong addr = ent->t270.addr;
 
@@ -599,9 +611,8 @@ qla27xx_fwdt_entry_t270(struct scsi_qla_host *vha,
qla27xx_write_reg(reg, IOBASE_ADDR, 0x40, buf);
while (dwords--) {
qla27xx_write_reg(reg, 0xc0, addr|0x8000, buf);
-   qla27xx_read_reg(reg, 0xc4, buf, len);
qla27xx_insert32(addr, buf, len);
-   qla27xx_read32(window, buf, len);
+   qla27xx_read_off(reg, 0xc4, buf, len);
addr++;
}
 
@@ -614,12 +625,12 @@ qla27xx_fwdt_entry_t271(struct scsi_qla_host *vha,
 {
struct device_reg_24xx __iomem *reg = qla27xx_isp_reg(vha);
ulong addr = ent->t271.addr;
+   ulong data = ent->t271.data;
 
ql_dbg(ql_dbg_misc, vha, 0xd20f,
"%s: wrremreg [%lx]\n", __func__, *len);
qla27xx_write_reg(reg, IOBASE_ADDR, 0x40, buf);
-   qla27xx_read_reg(reg, 0xc4, buf, len);
-   qla27xx_insert32(addr, buf, len);
+   qla27xx_write_reg(reg, 0xc4, data, buf);
qla27xx_write_reg(reg, 0xc0, addr, buf);
 
return false;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/42] qla2xxx: Log when device state is moved to failed state.

2014-04-11 Thread Saurav Kashyap
From: Giridhar Malavali 

Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx2.c |   31 +++
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 86cf108..e381835 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -1655,6 +1655,19 @@ qla8044_set_drv_active(struct scsi_qla_host *vha)
qla8044_wr_direct(vha, QLA8044_CRB_DRV_ACTIVE_INDEX, drv_active);
 }
 
+static int
+qla8044_check_drv_active(struct scsi_qla_host *vha)
+{
+   uint32_t drv_active;
+   struct qla_hw_data *ha = vha->hw;
+
+   drv_active = qla8044_rd_direct(vha, QLA8044_CRB_DRV_ACTIVE_INDEX);
+   if (drv_active & (1 << ha->portnum))
+   return QLA_SUCCESS;
+   else
+   return QLA_TEST_FAILED;
+}
+
 static void
 qla8044_clear_idc_dontreset(struct scsi_qla_host *vha)
 {
@@ -1837,14 +1850,16 @@ qla8044_device_state_handler(struct scsi_qla_host *vha)
 
while (1) {
if (time_after_eq(jiffies, dev_init_timeout)) {
-   ql_log(ql_log_warn, vha, 0xb0cf,
-   "%s: Device Init Failed 0x%x = %s\n",
-   QLA2XXX_DRIVER_NAME, dev_state,
-   dev_state < MAX_STATES ?
-   qdev_state(dev_state) : "Unknown");
-
-   qla8044_wr_direct(vha, QLA8044_CRB_DEV_STATE_INDEX,
-   QLA8XXX_DEV_FAILED);
+   if (qla8044_check_drv_active(vha) == QLA_SUCCESS) {
+   ql_log(ql_log_warn, vha, 0xb0cf,
+   "%s: Device Init Failed 0x%x = %s\n",
+   QLA2XXX_DRIVER_NAME, dev_state,
+   dev_state < MAX_STATES ?
+   qdev_state(dev_state) : "Unknown");
+   qla8044_wr_direct(vha,
+   QLA8044_CRB_DEV_STATE_INDEX,
+   QLA8XXX_DEV_FAILED);
+   }
}
 
dev_state = qla8044_rd_direct(vha, QLA8044_CRB_DEV_STATE_INDEX);
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 41/42] qla2xxx: Remove wait for online from host reset handler.

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

This can block progress of the SCSI error handler thread and cause long I/O
outages.  Instead just fail immediately if another reset is going on or we are
accessing flash memory.

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c |1 +
 drivers/scsi/qla2xxx/qla_os.c  |   51 
 2 files changed, 6 insertions(+), 46 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 96f7d71..c72ee97b 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -46,6 +46,7 @@
  * |  || 0x70d7-0x70db  |
  * |  || 0x70de-0x70df  |
  * | Task Management  |   0x803d   | 0x8000,0x800b  |
+ * |  || 0x8019 |
  * |  || 0x8025,0x8026  |
  * |  || 0x8031,0x8032  |
  * |  || 0x8039,0x803c  |
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5a70e24..5a430c7 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -865,51 +865,6 @@ qla2x00_wait_for_hba_ready(scsi_qla_host_t *vha)
msleep(1000);
 }
 
-/*
- * qla2x00_wait_for_reset_ready
- *Wait till the HBA is online after going through
- *<= MAX_RETRIES_OF_ISP_ABORT  or
- *finally HBA is disabled ie marked offline or flash
- *operations are in progress.
- *
- * Input:
- * ha - pointer to host adapter structure
- *
- * Note:
- *Does context switching-Release SPIN_LOCK
- *(if any) before calling this routine.
- *
- * Return:
- *Success (Adapter is online/no flash ops) : 0
- *Failed  (Adapter is offline/disabled/flash ops in progress) : 1
- */
-static int
-qla2x00_wait_for_reset_ready(scsi_qla_host_t *vha)
-{
-   int return_status;
-   unsigned long   wait_online;
-   struct qla_hw_data *ha = vha->hw;
-   scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
-
-   wait_online = jiffies + (MAX_LOOP_TIMEOUT * HZ);
-   while (((test_bit(ISP_ABORT_NEEDED, &base_vha->dpc_flags)) ||
-   test_bit(ABORT_ISP_ACTIVE, &base_vha->dpc_flags) ||
-   test_bit(ISP_ABORT_RETRY, &base_vha->dpc_flags) ||
-   ha->optrom_state != QLA_SWAITING ||
-   ha->dpc_active) && time_before(jiffies, wait_online))
-   msleep(1000);
-
-   if (base_vha->flags.online &&  ha->optrom_state == QLA_SWAITING)
-   return_status = QLA_SUCCESS;
-   else
-   return_status = QLA_FUNCTION_FAILED;
-
-   ql_dbg(ql_dbg_taskm, vha, 0x8019,
-   "%s return status=%d.\n", __func__, return_status);
-
-   return return_status;
-}
-
 int
 qla2x00_wait_for_chip_reset(scsi_qla_host_t *vha)
 {
@@ -1274,7 +1229,11 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *cmd)
ql_log(ql_log_info, vha, 0x8018,
"ADAPTER RESET ISSUED nexus=%ld:%d:%d.\n", vha->host_no, id, lun);
 
-   if (qla2x00_wait_for_reset_ready(vha) != QLA_SUCCESS)
+   /*
+* No point in issuing another reset if one is active.  Also do not
+* attempt a reset if we are updating flash.
+*/
+   if (qla2x00_reset_active(vha) || ha->optrom_state != QLA_SWAITING)
goto eh_host_reset_lock;
 
if (vha != base_vha) {
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/42] qla2xxx: Issue abort command for outstanding commands during cleanup when only firmware is alive.

2014-04-11 Thread Saurav Kashyap
From: Giridhar Malavali 

Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 5511e24..81388e9 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -3682,8 +3682,10 @@ qla82xx_chip_reset_cleanup(scsi_qla_host_t *vha)
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++) {
sp = req->outstanding_cmds[cnt];
if (sp) {
-   if (!sp->u.scmd.ctx ||
-   (sp->flags & 
SRB_FCP_CMND_DMA_VALID)) {
+   if ((!sp->u.scmd.ctx ||
+   (sp->flags &
+   SRB_FCP_CMND_DMA_VALID)) &&
+   !ha->flags.isp82xx_fw_hung) {
spin_unlock_irqrestore(
&ha->hardware_lock, flags);
if 
(ha->isp_ops->abort_command(sp)) {
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 36/42] qla2xxx: Add MBC option for fast SFP data access.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_attr.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 900411a..16fe519 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -664,7 +664,7 @@ do_read:
}
 
rval = qla2x00_read_sfp(vha, ha->sfp_data_dma, ha->sfp_data,
-   addr, offset, SFP_BLOCK_SIZE, 0);
+   addr, offset, SFP_BLOCK_SIZE, BIT_1);
if (rval != QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0x706d,
"Unable to read SFP data (%x/%x/%x).\n", rval,
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 24/42] qla2xxx: ISP8044 poll ipmdio bus timeout improvement.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx2.c |   15 +++
 1 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index 75e947a..e5b4a40 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -175,18 +175,17 @@ qla8044_poll_wait_ipmdio_bus_idle(struct scsi_qla_host 
*vha,
uint32_t temp;
 
/* jiffies after 100 msecs */
-   timeout = jiffies + (HZ / 1000) * TIMEOUT_100_MS;
+   timeout = jiffies + msecs_to_jiffies(TIMEOUT_100_MS);
do {
temp = qla8044_ipmdio_rd_reg(vha, addr1, addr3, mask, addr2);
if ((temp & 0x1) != 1)
break;
-   } while (!time_after_eq(jiffies, timeout));
-
-   if (time_after_eq(jiffies, timeout)) {
-   ql_log(ql_log_warn, vha, 0xb152,
-   "Error in processing mdiobus idle\n");
-   return -1;
-   }
+   if (time_after_eq(jiffies, timeout)) {
+   ql_log(ql_log_warn, vha, 0xb152,
+   "Error in processing mdiobus idle\n");
+   return -1;
+   }
+   } while (1);
 
return 0;
 }
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/42] qla2xxx: Do not schedule reset when one is already active when receiving an invalid status handle.

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

If an adapter reset is already in progress, do not schedule another one when
we receive an invalid status handle.

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_isr.c |   12 +++-
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index 95314ef..7549d09 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -2009,11 +2009,13 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct 
rsp_que *rsp, void *pkt)
ql_dbg(ql_dbg_io, vha, 0x3017,
"Invalid status handle (0x%x).\n", sts->handle);
 
-   if (IS_P3P_TYPE(ha))
-   set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
-   else
-   set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
-   qla2xxx_wake_dpc(vha);
+   if (!test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) {
+   if (IS_P3P_TYPE(ha))
+   set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
+   else
+   set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
+   qla2xxx_wake_dpc(vha);
+   }
return;
}
 
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 42/42] qla2xxx: Update the driver version to 8.07.00.08-k.

2014-04-11 Thread Saurav Kashyap
Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_version.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index cdd2fc6..4d2c98c 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  "8.07.00.02-k"
+#define QLA2XXX_VERSION  "8.07.00.08-k"
 
 #define QLA_DRIVER_MAJOR_VER   8
 #define QLA_DRIVER_MINOR_VER   7
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 37/42] qla2xxx: Remove mapped vp index iterator macro dead code.

2014-04-11 Thread Saurav Kashyap
From: Himanshu Madhani 

Signed-off-by: Himanshu Madhani 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_fw.h |7 ---
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 2cdedd9..eb8f572 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -1137,13 +1137,6 @@ struct device_reg_24xx {
 #define MIN_MULTI_ID_FABRIC64  /* Must be power-of-2. */
 #define MAX_MULTI_ID_FABRIC256 /* ... */
 
-#define for_each_mapped_vp_idx(_ha, _idx)  \
-   for (_idx = find_next_bit((_ha)->vp_idx_map,\
-   (_ha)->max_npiv_vports + 1, 1); \
-   _idx <= (_ha)->max_npiv_vports; \
-   _idx = find_next_bit((_ha)->vp_idx_map, \
-   (_ha)->max_npiv_vports + 1, _idx + 1))  \
-
 struct mid_conf_entry_24xx {
uint16_t reserved_1;
 
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/42] qla2xxx: Correct ISP83xx/ISP27xx mislogic in setting out_mb in qla25xx_init_req_que().

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_mbx.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 9570597..601562f 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -3688,7 +3688,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct 
req_que *req)
 
if (IS_QLA81XX(ha) || IS_QLA83XX(ha) || IS_QLA27XX(ha))
mcp->in_mb |= MBX_1;
-   if (IS_QLA83XX(ha) || !IS_QLA27XX(ha)) {
+   if (IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
mcp->out_mb |= MBX_15;
/* debug q create issue in SR-IOV */
mcp->in_mb |= MBX_9 | MBX_8 | MBX_7;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 19/42] qla2xxx: Change copyright year to 2014 in all the source files.

2014-04-11 Thread Saurav Kashyap
From: Armen Baloyan 

Signed-off-by: Armen Baloyan 
Signed-off-by: Saurav Kashyap 
---
 Documentation/scsi/LICENSE.qla2xxx  |2 +-
 drivers/scsi/qla2xxx/qla_attr.c |2 +-
 drivers/scsi/qla2xxx/qla_bsg.c  |2 +-
 drivers/scsi/qla2xxx/qla_bsg.h  |2 +-
 drivers/scsi/qla2xxx/qla_dbg.c  |2 +-
 drivers/scsi/qla2xxx/qla_dbg.h  |2 +-
 drivers/scsi/qla2xxx/qla_def.h  |2 +-
 drivers/scsi/qla2xxx/qla_dfs.c  |2 +-
 drivers/scsi/qla2xxx/qla_fw.h   |2 +-
 drivers/scsi/qla2xxx/qla_gbl.h  |2 +-
 drivers/scsi/qla2xxx/qla_gs.c   |2 +-
 drivers/scsi/qla2xxx/qla_init.c |2 +-
 drivers/scsi/qla2xxx/qla_inline.h   |2 +-
 drivers/scsi/qla2xxx/qla_iocb.c |2 +-
 drivers/scsi/qla2xxx/qla_isr.c  |2 +-
 drivers/scsi/qla2xxx/qla_mbx.c  |2 +-
 drivers/scsi/qla2xxx/qla_mid.c  |2 +-
 drivers/scsi/qla2xxx/qla_mr.c   |2 +-
 drivers/scsi/qla2xxx/qla_mr.h   |2 +-
 drivers/scsi/qla2xxx/qla_nx.c   |2 +-
 drivers/scsi/qla2xxx/qla_nx.h   |2 +-
 drivers/scsi/qla2xxx/qla_nx2.c  |2 +-
 drivers/scsi/qla2xxx/qla_nx2.h  |2 +-
 drivers/scsi/qla2xxx/qla_os.c   |2 +-
 drivers/scsi/qla2xxx/qla_settings.h |2 +-
 drivers/scsi/qla2xxx/qla_sup.c  |2 +-
 drivers/scsi/qla2xxx/qla_tmpl.c |2 +-
 drivers/scsi/qla2xxx/qla_tmpl.h |2 +-
 drivers/scsi/qla2xxx/qla_version.h  |2 +-
 29 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/Documentation/scsi/LICENSE.qla2xxx 
b/Documentation/scsi/LICENSE.qla2xxx
index 5020b7b..52f0b43 100644
--- a/Documentation/scsi/LICENSE.qla2xxx
+++ b/Documentation/scsi/LICENSE.qla2xxx
@@ -1,4 +1,4 @@
-Copyright (c) 2003-2013 QLogic Corporation
+Copyright (c) 2003-2014 QLogic Corporation
 QLogic Linux FC-FCoE Driver
 
 This program includes a device driver for Linux 3.x.
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index bc0cee3..900411a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_bsg.c b/drivers/scsi/qla2xxx/qla_bsg.c
index 467c694..524f9eb 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.c
+++ b/drivers/scsi/qla2xxx/qla_bsg.c
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2012 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_bsg.h b/drivers/scsi/qla2xxx/qla_bsg.h
index 4e49d0a..d38f9ef 100644
--- a/drivers/scsi/qla2xxx/qla_bsg.h
+++ b/drivers/scsi/qla2xxx/qla_bsg.h
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index b063c39..08572b9 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
index feae593..e1fc4e6 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index dd9b7fe0..a81e8ba 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_dfs.c b/drivers/scsi/qla2xxx/qla_dfs.c
index 32ab809..2ca39b8 100644
--- a/drivers/scsi/qla2xxx/qla_dfs.c
+++ b/drivers/scsi/qla2xxx/qla_dfs.c
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+ * Copyright (c)  2003-2014 QLogic Corporation
  *
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index 3a7353e..a9f86e7 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -1,6 +1,6 @@
 /*
  * QLogic Fibre Channel HBA Driver
- * Copyright (c)  2003-2013 QLogic Corporation
+

[PATCH 08/42] qla2xxx: Add pci device id 0x2271.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_def.h |8 ++--
 drivers/scsi/qla2xxx/qla_os.c  |   21 +++--
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6a10613..89bece7 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2907,6 +2907,8 @@ struct qla_hw_data {
 #define PCI_DEVICE_ID_QLOGIC_ISP8031   0x8031
 #define PCI_DEVICE_ID_QLOGIC_ISP2031   0x2031
 #define PCI_DEVICE_ID_QLOGIC_ISP2071   0x2071
+#define PCI_DEVICE_ID_QLOGIC_ISP2271   0x2271
+
uint32_tdevice_type;
 #define DT_ISP2100  BIT_0
 #define DT_ISP2200  BIT_1
@@ -2928,7 +2930,8 @@ struct qla_hw_data {
 #define DT_ISPFX00 BIT_17
 #define DT_ISP8044 BIT_18
 #define DT_ISP2071 BIT_19
-#define DT_ISP_LAST(DT_ISP2071 << 1)
+#define DT_ISP2271 BIT_20
+#define DT_ISP_LAST(DT_ISP2271 << 1)
 
 #define DT_T10_PI   BIT_25
 #define DT_IIDMABIT_26
@@ -2959,6 +2962,7 @@ struct qla_hw_data {
 #define IS_QLA8031(ha) (DT_MASK(ha) & DT_ISP8031)
 #define IS_QLAFX00(ha) (DT_MASK(ha) & DT_ISPFX00)
 #define IS_QLA2071(ha) (DT_MASK(ha) & DT_ISP2071)
+#define IS_QLA2271(ha) (DT_MASK(ha) & DT_ISP2271)
 
 #define IS_QLA23XX(ha)  (IS_QLA2300(ha) || IS_QLA2312(ha) || IS_QLA2322(ha) || 
\
IS_QLA6312(ha) || IS_QLA6322(ha))
@@ -2967,7 +2971,7 @@ struct qla_hw_data {
 #define IS_QLA25XX(ha)  (IS_QLA2532(ha))
 #define IS_QLA83XX(ha) (IS_QLA2031(ha) || IS_QLA8031(ha))
 #define IS_QLA84XX(ha)  (IS_QLA8432(ha))
-#define IS_QLA27XX(ha)  (IS_QLA2071(ha))
+#define IS_QLA27XX(ha)  (IS_QLA2071(ha) || IS_QLA2271(ha))
 #define IS_QLA24XX_TYPE(ha) (IS_QLA24XX(ha) || IS_QLA54XX(ha) || \
IS_QLA84XX(ha))
 #define IS_CNA_CAPABLE(ha) (IS_QLA81XX(ha) || IS_QLA82XX(ha) || \
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 19e99cc..1b1cd75 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2270,6 +2270,13 @@ qla2x00_set_isp_flags(struct qla_hw_data *ha)
ha->device_type |= DT_IIDMA;
ha->fw_srisc_address = RISC_START_ADDRESS_2400;
break;
+   case PCI_DEVICE_ID_QLOGIC_ISP2271:
+   ha->device_type |= DT_ISP2271;
+   ha->device_type |= DT_ZIO_SUPPORTED;
+   ha->device_type |= DT_FWI2;
+   ha->device_type |= DT_IIDMA;
+   ha->fw_srisc_address = RISC_START_ADDRESS_2400;
+   break;
}
 
if (IS_QLA82XX(ha))
@@ -2346,7 +2353,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8031 ||
pdev->device == PCI_DEVICE_ID_QLOGIC_ISPF001 ||
pdev->device == PCI_DEVICE_ID_QLOGIC_ISP8044 ||
-   pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071) {
+   pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2071 ||
+   pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2271) {
bars = pci_select_bars(pdev, IORESOURCE_MEM);
mem_only = 1;
ql_dbg_pci(ql_dbg_init, pdev, 0x0007,
@@ -5325,7 +5333,7 @@ qla2x00_timer(scsi_qla_host_t *vha)
 #define FW_ISP82XX 7
 #define FW_ISP2031 8
 #define FW_ISP8031 9
-#define FW_ISP2071 10
+#define FW_ISP27XX 10
 
 #define FW_FILE_ISP21XX"ql2100_fw.bin"
 #define FW_FILE_ISP22XX"ql2200_fw.bin"
@@ -5337,7 +5345,7 @@ qla2x00_timer(scsi_qla_host_t *vha)
 #define FW_FILE_ISP82XX"ql8200_fw.bin"
 #define FW_FILE_ISP2031"ql2600_fw.bin"
 #define FW_FILE_ISP8031"ql8300_fw.bin"
-#define FW_FILE_ISP2071"ql2700_fw.bin"
+#define FW_FILE_ISP27XX"ql2700_fw.bin"
 
 
 static DEFINE_MUTEX(qla_fw_lock);
@@ -5353,7 +5361,7 @@ static struct fw_blob qla_fw_blobs[FW_BLOBS] = {
{ .name = FW_FILE_ISP82XX, },
{ .name = FW_FILE_ISP2031, },
{ .name = FW_FILE_ISP8031, },
-   { .name = FW_FILE_ISP2071, },
+   { .name = FW_FILE_ISP27XX, },
 };
 
 struct fw_blob *
@@ -5382,8 +5390,8 @@ qla2x00_request_firmware(scsi_qla_host_t *vha)
blob = &qla_fw_blobs[FW_ISP2031];
} else if (IS_QLA8031(ha)) {
blob = &qla_fw_blobs[FW_ISP8031];
-   } else if (IS_QLA2071(ha)) {
-   blob = &qla_fw_blobs[FW_ISP2071];
+   } else if (IS_QLA27XX(ha)) {
+   blob = &qla_fw_blobs[FW_ISP27XX];
} else {
return NULL;
}
@@ -5714,6 +5722,7 @@ static struct pci_device_id qla2xxx_pci_tbl[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLOGIC_ISPF001) },
{ PCI_DEVICE(PCI_VENDOR_ID_QLOGIC, PCI_DEVICE_ID_QLO

[PATCH 38/42] qla2xxx: T10-Dif: add T10-PI support

2014-04-11 Thread Saurav Kashyap
From: Quinn Tran 

Add support for T10-Dif for Target Mode to qla driver.
The driver will look for firmware attribute that support
this feature.  When the feature is present, the capabilities
will be report to TCM layer.

Add CTIO CRC2 iocb to build T10-Dif commands.
Add support routines to process good & error cases.

Signed-off-by: Quinn Tran 
Signed-off-by: Nicholas Bellinger 
Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c |2 +-
 drivers/scsi/qla2xxx/qla_def.h |   14 +-
 drivers/scsi/qla2xxx/qla_gbl.h |7 +
 drivers/scsi/qla2xxx/qla_inline.h  |   13 +-
 drivers/scsi/qla2xxx/qla_iocb.c|  132 ++--
 drivers/scsi/qla2xxx/qla_isr.c |9 +-
 drivers/scsi/qla2xxx/qla_os.c  |2 +-
 drivers/scsi/qla2xxx/qla_target.c  |  621 ++--
 drivers/scsi/qla2xxx/qla_target.h  |   84 +-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c |   41 +++-
 10 files changed, 850 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index cdff3aa..781ca5b 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -66,7 +66,7 @@
  * |  || 0xd030-0xd0ff |
  * |  || 0xd101-0xd1fe |
  * |  || 0xd213-0xd2fe |
- * | Target Mode |   0xe070   | 0xe021 |
+ * | Target Mode |   0xe078   ||
  * | Target Mode Management  |   0xf072   | 0xf002-0xf003  |
  * |  || 0xf046-0xf049  |
  * | Target Mode Task Management  |  0x1000b  ||
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 5c590d4..1fa0104 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1629,10 +1629,20 @@ typedef struct {
 #define PO_MODE_DIF_PASS   2
 #define PO_MODE_DIF_REPLACE3
 #define PO_MODE_DIF_TCP_CKSUM  6
-#define PO_ENABLE_DIF_BUNDLING BIT_8
 #define PO_ENABLE_INCR_GUARD_SEED  BIT_3
-#define PO_DISABLE_INCR_REF_TAGBIT_5
 #define PO_DISABLE_GUARD_CHECK BIT_4
+#define PO_DISABLE_INCR_REF_TAGBIT_5
+#define PO_DIS_HEADER_MODE BIT_7
+#define PO_ENABLE_DIF_BUNDLING BIT_8
+#define PO_DIS_FRAME_MODE  BIT_9
+#define PO_DIS_VALD_APP_ESCBIT_10 /* Dis validation for escape tag/h */
+#define PO_DIS_VALD_APP_REF_ESC BIT_11
+
+#define PO_DIS_APP_TAG_REPLBIT_12 /* disable REG Tag replacement */
+#define PO_DIS_REF_TAG_REPLBIT_13
+#define PO_DIS_APP_TAG_VALDBIT_14 /* disable REF Tag validation */
+#define PO_DIS_REF_TAG_VALDBIT_15
+
 /*
  * ISP queue - 64-Bit addressing, continuation crc entry structure definition.
  */
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index a96efff..d48dea8 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -220,6 +220,13 @@ extern unsigned long qla2x00_get_async_timeout(struct 
scsi_qla_host *);
 
 extern void *qla2x00_alloc_iocbs(scsi_qla_host_t *, srb_t *);
 extern int qla2x00_issue_marker(scsi_qla_host_t *, int);
+extern int qla24xx_walk_and_build_sglist_no_difb(struct qla_hw_data *, srb_t *,
+   uint32_t *, uint16_t, struct qla_tgt_cmd *);
+extern int qla24xx_walk_and_build_sglist(struct qla_hw_data *, srb_t *,
+   uint32_t *, uint16_t, struct qla_tgt_cmd *);
+extern int qla24xx_walk_and_build_prot_sglist(struct qla_hw_data *, srb_t *,
+   uint32_t *, uint16_t, struct qla_tgt_cmd *);
+
 
 /*
  * Global Function Prototypes in qla_mbx.c source file.
diff --git a/drivers/scsi/qla2xxx/qla_inline.h 
b/drivers/scsi/qla2xxx/qla_inline.h
index be5b204..b3b1d6f 100644
--- a/drivers/scsi/qla2xxx/qla_inline.h
+++ b/drivers/scsi/qla2xxx/qla_inline.h
@@ -5,6 +5,7 @@
  * See LICENSE.qla2xxx for copyright and licensing details.
  */
 
+#include "qla_target.h"
 /**
  * qla24xx_calc_iocbs() - Determine number of Command Type 3 and
  * Continuation Type 1 IOCBs to allocate.
@@ -128,12 +129,20 @@ qla2x00_clear_loop_id(fc_port_t *fcport) {
 }
 
 static inline void
-qla2x00_clean_dsd_pool(struct qla_hw_data *ha, srb_t *sp)
+qla2x00_clean_dsd_pool(struct qla_hw_data *ha, srb_t *sp,
+   struct qla_tgt_cmd *tc)
 {
struct dsd_dma *dsd_ptr, *tdsd_ptr;
struct crc_context *ctx;
 
-   ctx = (struct crc_context *)GET_CMD_CTX_SP(sp);
+   if (sp)
+   ctx = (struct crc_context *)GET_CMD_CTX_SP(sp);
+   else if (tc)
+   ctx = (struct crc_context *)tc->ctx;
+   else {
+   BUG();
+   return;
+   }
 
/* clean up allocated prev pool */
list_for_each_entry_safe(dsd_ptr, tdsd_ptr,
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index af83132..7609315 100644
--- a/drivers/scsi/qla2xx

[PATCH 00/42] qla2xxx: 8.07.00.08-k: Updates for scsi "misc" branch

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

Hi James,

Please apply the following patches to the scsi tree, misc branch at your
earliest convenience.

Thanks,
~Saurav


Armen Baloyan (3):
  qla2xxx: Change copyright year to 2014 in all the source files.
  qla2xxx: Decrease pci access for response queue processing for
ISPFX00.
  qla2xxx: Adjust adapter reset routine to the changes in firmware
specification for ISPFx00.

Atul Deshmukh (3):
  qla2xxx: Use proper log message for flash lock failed error.
  qla2xxx: Include  file for msleep declartion in qla_nx2.c
file.
  qla2xxx: IOCB data should be copied to I/O mem using memcpy_toio.

Chad Dupuis (7):
  qla2xxx: Do not schedule reset when one is already active when
receiving an invalid status handle.
  qla2xxx: Remove unnecessary printk_ratelimited from qla_nx2.c
  qla2xxx: Avoid escalating the SCSI error handler if the command is
not found in firmware.
  qla2xxx: Clear loop_id for ports that are marked lost during fabric
scanning.
  qla2xxx: Reduce the time we wait for a command to complete during
SCSI error handling.
  qla2xxx: Do logins from a chip reset in DPC thread instead of the
error handler thread.
  qla2xxx: Remove wait for online from host reset handler.

Giridhar Malavali (3):
  qla2xxx: Log when device state is moved to failed state.
  qla2xxx: Issue abort command for outstanding commands during cleanup
when only firmware is alive.
  qla2xxx: Check for peg alive counter and clear any outstanding
mailbox command.

Himanshu Madani (1):
  qla2xxx: Fix beacon blink logic for ISP26xx/83xx.

Himanshu Madhani (1):
  qla2xxx: Remove mapped vp index iterator macro dead code.

Hiral Patel (5):
  qla2xxx: Track the process when the ROM_LOCK failure happens
  qla2xxx: Remove unnecessary delays from fw dump code path.
  qla2xxx: Introduce fw_dump_flag to track fw dump progress.
  qla2xxx: Enable fw_dump_size for ISP8044.
  qla2xxx: Check the QLA8044_CRB_DRV_ACTIVE_INDEX register when we are
not the owner of the reset.

Joe Carnuccio (11):
  qla2xxx: Correct operations for ISP27xx template types 270 and 271.
  qla2xxx: Allow ISP83XX and ISP27XX both to write req_q_out register.
  qla2xxx: Correct ISP83xx/ISP27xx mislogic in setting out_mb in
qla25xx_init_req_que().
  qla2xxx: Add pci device id 0x2271.
  qla2xxx: Add ISP8044 serdes bsg interface.
  qla2xxx: Correction to ISP27xx template entry types 256 and 258.
  qla2xxx: Update entry type 270 to match spec update.
  qla2xxx: ISP8044 poll ipmdio bus timeout improvement.
  qla2xxx: ISP27xx firmware dump template spec updates (including
T274).
  qla2xxx: ISP27xx queue index shadow registers.
  qla2xxx: Add MBC option for fast SFP data access.

Pratik Mohanty (1):
  qla2xxx: Support of new firmware dump opcodes QLA8044_RDDFE(38),
QLA8044_RDMDIO(39),QLA8044_POLLWR(40).

Quinn Tran (2):
  qla2xxx: T10-Dif: add T10-PI support
  qla2xxx: ABTS cause double free of qla_tgt_cmd +.

Saurav Kashyap (3):
  qla2xxx: Wait for reset completion without lock for ISPFX00.
  qla2xxx: Allow the next firmware dump if the previous dump capture
fails for ISP8044.
  qla2xxx: Update the driver version to 8.07.00.08-k.

Sawan Chandak (1):
  qla2xxx: Delay driver unload if there is any pending activity going
on.

Tej Prakash (1):
  qla2xxx: Don't check for firmware hung during the reset context for
ISP82XX.

 Documentation/scsi/LICENSE.qla2xxx  |2 +-
 drivers/scsi/qla2xxx/qla_attr.c |6 +-
 drivers/scsi/qla2xxx/qla_bsg.c  |   49 +++-
 drivers/scsi/qla2xxx/qla_bsg.h  |9 +-
 drivers/scsi/qla2xxx/qla_dbg.c  |  127 ---
 drivers/scsi/qla2xxx/qla_dbg.h  |5 +-
 drivers/scsi/qla2xxx/qla_def.h  |   44 ++-
 drivers/scsi/qla2xxx/qla_dfs.c  |2 +-
 drivers/scsi/qla2xxx/qla_fw.h   |   14 +-
 drivers/scsi/qla2xxx/qla_gbl.h  |   14 +-
 drivers/scsi/qla2xxx/qla_gs.c   |2 +-
 drivers/scsi/qla2xxx/qla_init.c |   53 +--
 drivers/scsi/qla2xxx/qla_inline.h   |   15 +-
 drivers/scsi/qla2xxx/qla_iocb.c |  146 ++---
 drivers/scsi/qla2xxx/qla_isr.c  |   23 +-
 drivers/scsi/qla2xxx/qla_mbx.c  |   93 +-
 drivers/scsi/qla2xxx/qla_mid.c  |2 +-
 drivers/scsi/qla2xxx/qla_mr.c   |   64 +++-
 drivers/scsi/qla2xxx/qla_mr.h   |3 +-
 drivers/scsi/qla2xxx/qla_nx.c   |   87 +++---
 drivers/scsi/qla2xxx/qla_nx.h   |6 +-
 drivers/scsi/qla2xxx/qla_nx2.c  |  510 +++-
 drivers/scsi/qla2xxx/qla_nx2.h  |   50 +++-
 drivers/scsi/qla2xxx/qla_os.c   |  102 +++---
 drivers/scsi/qla2xxx/qla_settings.h |2 +-
 drivers/scsi/qla2xxx/qla_sup.c  |9 +-
 drivers/scsi/qla2xxx/qla_target.c   |  650 +--
 drivers/scsi/qla2xxx/qla_target.h   |   84 +-
 drivers/scsi/qla2xxx/qla_tmpl.c |   91 --
 drivers/scsi/qla2xxx/qla_tmpl.h |   17 +-
 drivers/scsi/qla2xxx/qla_version.h  |4 +-
 drivers/scsi/qla2xxx/tcm_qla2xxx.c  |   41 ++-
 32 files cha

[PATCH 20/42] qla2xxx: Decrease pci access for response queue processing for ISPFX00.

2014-04-11 Thread Saurav Kashyap
From: Armen Baloyan 

Signed-off-by: Armen Baloyan 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_mr.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index 1801e5f..eb9be2e 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -2676,7 +2676,7 @@ qlafx00_process_response_queue(struct scsi_qla_host *vha,
uint16_t lreq_q_out = 0;
 
lreq_q_in = RD_REG_DWORD(rsp->rsp_q_in);
-   lreq_q_out = RD_REG_DWORD(rsp->rsp_q_out);
+   lreq_q_out = rsp->ring_index;
 
while (lreq_q_in != lreq_q_out) {
lptr = rsp->ring_ptr;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/42] qla2xxx: Wait for reset completion without lock for ISPFX00.

2014-04-11 Thread Saurav Kashyap
Signed-off-by: Giridhar Malavali 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_mr.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index 0aaf6a9..c1df39a 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -572,12 +572,13 @@ qlafx00_soc_cpu_reset(scsi_qla_host_t *vha)
/* Kick in Core0 to start boot process */
QLAFX00_SET_HBA_SOC_REG(ha, SOC_SW_RST_CONTROL_REG_CORE0, (0xF00));
 
+   spin_unlock_irqrestore(&ha->hardware_lock, flags);
+
/* Wait 10secs for soft-reset to complete. */
for (cnt = 10; cnt; cnt--) {
msleep(1000);
barrier();
}
-   spin_unlock_irqrestore(&ha->hardware_lock, flags);
 }
 
 /**
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 16/42] qla2xxx: Introduce fw_dump_flag to track fw dump progress.

2014-04-11 Thread Saurav Kashyap
From: Hiral Patel 

Signed-off-by: Hiral Patel 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |   42 +-
 drivers/scsi/qla2xxx/qla_dbg.h  |3 +-
 drivers/scsi/qla2xxx/qla_def.h  |7 ++
 drivers/scsi/qla2xxx/qla_init.c |1 +
 drivers/scsi/qla2xxx/qla_os.c   |1 +
 drivers/scsi/qla2xxx/qla_tmpl.c |2 +-
 6 files changed, 44 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 16939a9..b063c39 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -277,9 +277,15 @@ qla24xx_dump_memory(struct qla_hw_data *ha, uint32_t 
*code_ram,
if (rval != QLA_SUCCESS)
return rval;
 
+   set_bit(RISC_SRAM_DUMP_CMPL, &ha->fw_dump_cap_flags);
+
/* External Memory. */
-   return qla24xx_dump_ram(ha, 0x10, *nxt,
+   rval = qla24xx_dump_ram(ha, 0x10, *nxt,
ha->fw_memory_size - 0x10 + 1, nxt);
+   if (rval == QLA_SUCCESS)
+   set_bit(RISC_EXT_MEM_DUMP_CMPL, &ha->fw_dump_cap_flags);
+
+   return rval;
 }
 
 static uint32_t *
@@ -297,12 +303,14 @@ qla24xx_read_window(struct device_reg_24xx __iomem *reg, 
uint32_t iobase,
 }
 
 void
-qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
+qla24xx_pause_risc(struct device_reg_24xx __iomem *reg, struct qla_hw_data *ha)
 {
WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE);
 
/* 100 usec delay is sufficient enough for hardware to pause RISC */
udelay(100);
+   if (RD_REG_DWORD(®->host_status) & HSRX_RISC_PAUSED)
+   set_bit(RISC_PAUSE_CMPL, &ha->fw_dump_cap_flags);
 }
 
 int
@@ -325,6 +333,8 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
 
udelay(10);
}
+   if (!(RD_REG_DWORD(®->ctrl_status) & CSRX_DMA_ACTIVE))
+   set_bit(DMA_SHUTDOWN_CMPL, &ha->fw_dump_cap_flags);
 
WRT_REG_DWORD(®->ctrl_status,
CSRX_ISP_SOFT_RESET|CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
@@ -340,6 +350,9 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
 
udelay(10);
}
+   if (!(RD_REG_DWORD(®->ctrl_status) & CSRX_ISP_SOFT_RESET))
+   set_bit(ISP_RESET_CMPL, &ha->fw_dump_cap_flags);
+
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_RESET);
RD_REG_DWORD(®->hccr); /* PCI Posting. */
 
@@ -350,6 +363,8 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
else
rval = QLA_FUNCTION_TIMEOUT;
}
+   if (rval == QLA_SUCCESS)
+   set_bit(RISC_RDY_AFT_RESET, &ha->fw_dump_cap_flags);
 
return rval;
 }
@@ -646,12 +661,13 @@ qla2xxx_dump_post_process(scsi_qla_host_t *vha, int rval)
 
if (rval != QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0xd000,
-   "Failed to dump firmware (%x).\n", rval);
+   "Failed to dump firmware (%x), dump status flags 
(0x%lx).\n",
+   rval, ha->fw_dump_cap_flags);
ha->fw_dumped = 0;
} else {
ql_log(ql_log_info, vha, 0xd001,
-   "Firmware dump saved to temp buffer (%ld/%p).\n",
-   vha->host_no, ha->fw_dump);
+   "Firmware dump saved to temp buffer (%ld/%p), dump status 
flags (0x%lx).\n",
+   vha->host_no, ha->fw_dump, ha->fw_dump_cap_flags);
ha->fw_dumped = 1;
qla2x00_post_uevent_work(vha, QLA_UEVENT_CODE_FW_DUMP);
}
@@ -1040,6 +1056,7 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
risc_address = ext_mem_cnt = 0;
flags = 0;
+   ha->fw_dump_cap_flags = 0;
 
if (!hardware_locked)
spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -1066,7 +1083,7 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 * Pause RISC. No need to track timeout, as resetting the chip
 * is the right approach incase of pause timeout
 */
-   qla24xx_pause_risc(reg);
+   qla24xx_pause_risc(reg, ha);
 
/* Host interface registers. */
dmp_reg = ®->flash_addr;
@@ -1290,6 +1307,7 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
risc_address = ext_mem_cnt = 0;
flags = 0;
+   ha->fw_dump_cap_flags = 0;
 
if (!hardware_locked)
spin_lock_irqsave(&ha->hardware_lock, flags);
@@ -1317,7 +1335,7 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 * Pause RISC. No need to track timeout, as resetting the chip
 * is the right approach incase of pause timeout
 */
-   qla24xx_pause_risc(reg);
+   qla24xx_pause_risc(reg, ha);
 
/* Host/Risc registers. */
iter_reg = fw->host_risc_reg;
@@ -1608,6 +1626,7 @@ qla81xx_fw_dump(scsi_qla_host_t *vha, int hardware_locked)
 
risc_address = ext_mem_cnt = 0;
flags = 0;
+   ha->fw_dump_cap_flags = 0;
 
 

[PATCH 40/42] qla2xxx: Do logins from a chip reset in DPC thread instead of the error handler thread.

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

Attempting to do any logins from the SCSI reset handler can lead to a deadlock
scenario if a rport times out and the FC transport layer.  Move doing any port
logins to the DPC thread so as not to impede the progress of the SCSI error
handler thread and avoid deadlock situations.

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |6 +++-
 drivers/scsi/qla2xxx/qla_init.c |   40 ++
 2 files changed, 7 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 781ca5b..96f7d71 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -45,8 +45,10 @@
  * |  || 0x70ad-0x70ae  |
  * |  || 0x70d7-0x70db  |
  * |  || 0x70de-0x70df  |
- * | Task Management  |   0x803d   | 0x8025-0x8026  |
- * |  || 0x800b,0x8039  |
+ * | Task Management  |   0x803d   | 0x8000,0x800b  |
+ * |  || 0x8025,0x8026  |
+ * |  || 0x8031,0x8032  |
+ * |  || 0x8039,0x803c  |
  * | AER/EEH  |   0x9011   |   |
  * | Virtual Port |   0xa007   |   |
  * | ISP82XX Specific |   0xb157   | 0xb002,0xb024  |
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 20b569e..e218441 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4736,7 +4736,6 @@ static int
 qla2x00_restart_isp(scsi_qla_host_t *vha)
 {
int status = 0;
-   uint32_t wait_time;
struct qla_hw_data *ha = vha->hw;
struct req_que *req = ha->req_q_map[0];
struct rsp_que *rsp = ha->rsp_q_map[0];
@@ -4753,14 +4752,12 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
if (!status && !(status = qla2x00_init_rings(vha))) {
clear_bit(RESET_MARKER_NEEDED, &vha->dpc_flags);
ha->flags.chip_reset_done = 1;
+
/* Initialize the queues in use */
qla25xx_init_queues(ha);
 
status = qla2x00_fw_ready(vha);
if (!status) {
-   ql_dbg(ql_dbg_taskm, vha, 0x8031,
-   "Start configure loop status = %d.\n", status);
-
/* Issue a marker after FW becomes ready. */
qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL);
 
@@ -4775,24 +4772,12 @@ qla2x00_restart_isp(scsi_qla_host_t *vha)
qlt_24xx_process_atio_queue(vha);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
-   /* Wait at most MAX_TARGET RSCNs for a stable link. */
-   wait_time = 256;
-   do {
-   clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
-   qla2x00_configure_loop(vha);
-   wait_time--;
-   } while (!atomic_read(&vha->loop_down_timer) &&
-   !(test_bit(ISP_ABORT_NEEDED, &vha->dpc_flags))
-   && wait_time && (test_bit(LOOP_RESYNC_NEEDED,
-   &vha->dpc_flags)));
+   set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
}
 
/* if no cable then assume it's good */
if ((vha->device_flags & DFLG_NO_CABLE))
status = 0;
-
-   ql_dbg(ql_dbg_taskm, vha, 0x8032,
-   "Configure loop done, status = 0x%x.\n", status);
}
return (status);
 }
@@ -6139,7 +6124,6 @@ int
 qla82xx_restart_isp(scsi_qla_host_t *vha)
 {
int status, rval;
-   uint32_t wait_time;
struct qla_hw_data *ha = vha->hw;
struct req_que *req = ha->req_q_map[0];
struct rsp_que *rsp = ha->rsp_q_map[0];
@@ -6153,31 +6137,15 @@ qla82xx_restart_isp(scsi_qla_host_t *vha)
 
status = qla2x00_fw_ready(vha);
if (!status) {
-   ql_log(ql_log_info, vha, 0x803c,
-   "Start configure loop, status =%d.\n", status);
-
/* Issue a marker after FW becomes ready. */
qla2x00_marker(vha, req, rsp, 0, 0, MK_SYNC_ALL);
-
vha->flags.online = 1;
-   /* Wait at most MAX_TARGET RSCNs for a stable link. */
-   wait_time = 256;
-   do {
-   clear_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags);
-   

[PATCH 34/42] qla2xxx: Don't check for firmware hung during the reset context for ISP82XX.

2014-04-11 Thread Saurav Kashyap
From: Tej Prakash 

Signed-off-by: Tej Prakash 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_nx.c |   43 
 1 files changed, 13 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index 190283e..58f3c91 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -2852,47 +2852,30 @@ static int
 qla82xx_device_bootstrap(scsi_qla_host_t *vha)
 {
int rval = QLA_SUCCESS;
-   int i, timeout;
+   int i;
uint32_t old_count, count;
struct qla_hw_data *ha = vha->hw;
-   int need_reset = 0, peg_stuck = 1;
+   int need_reset = 0;
 
need_reset = qla82xx_need_reset(ha);
 
-   old_count = qla82xx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
-
-   for (i = 0; i < 10; i++) {
-   timeout = msleep_interruptible(200);
-   if (timeout) {
-   qla82xx_wr_32(ha, QLA82XX_CRB_DEV_STATE,
-   QLA8XXX_DEV_FAILED);
-   return QLA_FUNCTION_FAILED;
-   }
-
-   count = qla82xx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
-   if (count != old_count)
-   peg_stuck = 0;
-   }
-
if (need_reset) {
/* We are trying to perform a recovery here. */
-   if (peg_stuck)
+   if (ha->flags.isp82xx_fw_hung)
qla82xx_rom_lock_recovery(ha);
-   goto dev_initialize;
} else  {
-   /* Start of day for this ha context. */
-   if (peg_stuck) {
-   /* Either we are the first or recovery in progress. */
-   qla82xx_rom_lock_recovery(ha);
-   goto dev_initialize;
-   } else
-   /* Firmware already running. */
-   goto dev_ready;
+   old_count = qla82xx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
+   for (i = 0; i < 10; i++) {
+   msleep(200);
+   count = qla82xx_rd_32(ha, QLA82XX_PEG_ALIVE_COUNTER);
+   if (count != old_count) {
+   rval = QLA_SUCCESS;
+   goto dev_ready;
+   }
+   }
+   qla82xx_rom_lock_recovery(ha);
}
 
-   return rval;
-
-dev_initialize:
/* set to DEV_INITIALIZING */
ql_log(ql_log_info, vha, 0x009e,
"HW State: INITIALIZING.\n");
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 15/42] qla2xxx: Remove unnecessary delays from fw dump code path.

2014-04-11 Thread Saurav Kashyap
From: Hiral Patel 

Signed-off-by: Hiral Patel 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c |   71 +--
 drivers/scsi/qla2xxx/qla_dbg.h |2 +-
 2 files changed, 32 insertions(+), 41 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index ba72e16..16939a9 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -296,23 +296,13 @@ qla24xx_read_window(struct device_reg_24xx __iomem *reg, 
uint32_t iobase,
return buf;
 }
 
-int
+void
 qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
 {
-   int rval = QLA_SUCCESS;
-   uint32_t cnt;
-
WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE);
-   for (cnt = 3;
-   ((RD_REG_DWORD(®->host_status) & HSRX_RISC_PAUSED) == 0) &&
-   rval == QLA_SUCCESS; cnt--) {
-   if (cnt)
-   udelay(100);
-   else
-   rval = QLA_FUNCTION_TIMEOUT;
-   }
 
-   return rval;
+   /* 100 usec delay is sufficient enough for hardware to pause RISC */
+   udelay(100);
 }
 
 int
@@ -320,10 +310,14 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
 {
int rval = QLA_SUCCESS;
uint32_t cnt;
-   uint16_t mb0, wd;
+   uint16_t wd;
struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
 
-   /* Reset RISC. */
+   /*
+* Reset RISC. The delay is dependent on system architecture.
+* Driver can proceed with the reset sequence after waiting
+* for a timeout period.
+*/
WRT_REG_DWORD(®->ctrl_status, CSRX_DMA_SHUTDOWN|MWB_4096_BYTES);
for (cnt = 0; cnt < 3; cnt++) {
if ((RD_REG_DWORD(®->ctrl_status) & CSRX_DMA_ACTIVE) == 0)
@@ -337,13 +331,6 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
pci_read_config_word(ha->pdev, PCI_COMMAND, &wd);
 
udelay(100);
-   /* Wait for firmware to complete NVRAM accesses. */
-   mb0 = (uint32_t) RD_REG_WORD(®->mailbox0);
-   for (cnt = 1 ; cnt && mb0; cnt--) {
-   udelay(5);
-   mb0 = (uint32_t) RD_REG_WORD(®->mailbox0);
-   barrier();
-   }
 
/* Wait for soft-reset to complete. */
for (cnt = 0; cnt < 3; cnt++) {
@@ -356,10 +343,10 @@ qla24xx_soft_reset(struct qla_hw_data *ha)
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_RESET);
RD_REG_DWORD(®->hccr); /* PCI Posting. */
 
-   for (cnt = 3; RD_REG_WORD(®->mailbox0) != 0 &&
+   for (cnt = 1; RD_REG_WORD(®->mailbox0) != 0 &&
rval == QLA_SUCCESS; cnt--) {
if (cnt)
-   udelay(100);
+   udelay(10);
else
rval = QLA_FUNCTION_TIMEOUT;
}
@@ -1075,10 +1062,11 @@ qla24xx_fw_dump(scsi_qla_host_t *vha, int 
hardware_locked)
 
fw->host_status = htonl(RD_REG_DWORD(®->host_status));
 
-   /* Pause RISC. */
-   rval = qla24xx_pause_risc(reg);
-   if (rval != QLA_SUCCESS)
-   goto qla24xx_fw_dump_failed_0;
+   /*
+* Pause RISC. No need to track timeout, as resetting the chip
+* is the right approach incase of pause timeout
+*/
+   qla24xx_pause_risc(reg);
 
/* Host interface registers. */
dmp_reg = ®->flash_addr;
@@ -1325,10 +1313,11 @@ qla25xx_fw_dump(scsi_qla_host_t *vha, int 
hardware_locked)
 
fw->host_status = htonl(RD_REG_DWORD(®->host_status));
 
-   /* Pause RISC. */
-   rval = qla24xx_pause_risc(reg);
-   if (rval != QLA_SUCCESS)
-   goto qla25xx_fw_dump_failed_0;
+   /*
+* Pause RISC. No need to track timeout, as resetting the chip
+* is the right approach incase of pause timeout
+*/
+   qla24xx_pause_risc(reg);
 
/* Host/Risc registers. */
iter_reg = fw->host_risc_reg;
@@ -1641,10 +1630,11 @@ qla81xx_fw_dump(scsi_qla_host_t *vha, int 
hardware_locked)
 
fw->host_status = htonl(RD_REG_DWORD(®->host_status));
 
-   /* Pause RISC. */
-   rval = qla24xx_pause_risc(reg);
-   if (rval != QLA_SUCCESS)
-   goto qla81xx_fw_dump_failed_0;
+   /*
+* Pause RISC. No need to track timeout, as resetting the chip
+* is the right approach incase of pause timeout
+*/
+   qla24xx_pause_risc(reg);
 
/* Host/Risc registers. */
iter_reg = fw->host_risc_reg;
@@ -1959,10 +1949,11 @@ qla83xx_fw_dump(scsi_qla_host_t *vha, int 
hardware_locked)
 
fw->host_status = htonl(RD_REG_DWORD(®->host_status));
 
-   /* Pause RISC. */
-   rval = qla24xx_pause_risc(reg);
-   if (rval != QLA_SUCCESS)
-   goto qla83xx_fw_dump_failed_0;
+   /*
+* Pause RISC. No need to track timeout, as resetting the chip
+* is the right approach incase of pause timeout
+*/
+   qla24xx_pause_risc(reg)

[PATCH 28/42] qla2xxx: Clear loop_id for ports that are marked lost during fabric scanning.

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_init.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 3260ec5..2d97d7c 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -3407,7 +3407,7 @@ qla2x00_configure_fabric(scsi_qla_host_t *vha)
fcport->d_id.b.domain,
fcport->d_id.b.area,
fcport->d_id.b.al_pa);
-   fcport->loop_id = FC_NO_LOOP_ID;
+   qla2x00_clear_loop_id(fcport);
}
}
}
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 35/42] qla2xxx: Fix beacon blink logic for ISP26xx/83xx.

2014-04-11 Thread Saurav Kashyap
From: Himanshu Madani 

Signed-off-by: Himanshu Madani 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_os.c  |6 --
 drivers/scsi/qla2xxx/qla_sup.c |7 ++-
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 575404f..ef6332b 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -5127,8 +5127,10 @@ intr_on_check:
ha->isp_ops->enable_intrs(ha);
 
if (test_and_clear_bit(BEACON_BLINK_NEEDED,
-   &base_vha->dpc_flags))
-   ha->isp_ops->beacon_blink(base_vha);
+   &base_vha->dpc_flags)) {
+   if (ha->beacon_blink_led == 1)
+   ha->isp_ops->beacon_blink(base_vha);
+   }
 
if (!IS_QLAFX00(ha))
qla2x00_do_dpc_all_vps(base_vha);
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index 5dcaaca..bca173e 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -1727,11 +1727,8 @@ qla83xx_beacon_blink(struct scsi_qla_host *vha)
if (IS_QLA2031(ha)) {
led_select_value = qla83xx_select_led_port(ha);
 
-   qla83xx_wr_reg(vha, led_select_value, 0x40002000);
-   qla83xx_wr_reg(vha, led_select_value + 4, 0x40002000);
-   msleep(1000);
-   qla83xx_wr_reg(vha, led_select_value, 0x40004000);
-   qla83xx_wr_reg(vha, led_select_value + 4, 0x40004000);
+   qla83xx_wr_reg(vha, led_select_value, 0x4230);
+   qla83xx_wr_reg(vha, led_select_value + 4, 0x4230);
} else if (IS_QLA8031(ha)) {
led_select_value = qla83xx_select_led_port(ha);
 
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 17/42] qla2xxx: Enable fw_dump_size for ISP8044.

2014-04-11 Thread Saurav Kashyap
From: Hiral Patel 

Signed-off-by: Hiral Patel 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_attr.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 07befcf..bc0cee3 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1495,7 +1495,7 @@ qla2x00_fw_dump_size_show(struct device *dev, struct 
device_attribute *attr,
 
if (!ha->fw_dumped)
size = 0;
-   else if (IS_QLA82XX(ha))
+   else if (IS_P3P_TYPE(ha))
size = ha->md_template_size + ha->md_dump_size;
else
size = ha->fw_dump_len;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 33/42] qla2xxx: Delay driver unload if there is any pending activity going on.

2014-04-11 Thread Saurav Kashyap
From: Sawan Chandak 

Signed-off-by: Sawan Chandak 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_os.c |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index d1a76a6..575404f 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -844,6 +844,28 @@ qla2x00_wait_for_hba_online(scsi_qla_host_t *vha)
 }
 
 /*
+ * qla2x00_wait_for_hba_ready
+ * Wait till the HBA is ready before doing driver unload
+ *
+ * Input:
+ * ha - pointer to host adapter structure
+ *
+ * Note:
+ *Does context switching-Release SPIN_LOCK
+ *(if any) before calling this routine.
+ *
+ */
+static void
+qla2x00_wait_for_hba_ready(scsi_qla_host_t *vha)
+{
+   struct qla_hw_data *ha = vha->hw;
+
+   while ((!(vha->flags.online) || ha->dpc_active ||
+   ha->flags.mbox_busy))
+   msleep(1000);
+}
+
+/*
  * qla2x00_wait_for_reset_ready
  *Wait till the HBA is online after going through
  *<= MAX_RETRIES_OF_ISP_ABORT  or
@@ -3161,6 +3183,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
base_vha = pci_get_drvdata(pdev);
ha = base_vha->hw;
 
+   qla2x00_wait_for_hba_ready(base_vha);
+
set_bit(UNLOADING, &base_vha->dpc_flags);
 
if (IS_QLAFX00(ha))
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 30/42] qla2xxx: Reduce the time we wait for a command to complete during SCSI error handling.

2014-04-11 Thread Saurav Kashyap
From: Chad Dupuis 

Signed-off-by: Chad Dupuis 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_os.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 8f1a098..d1a76a6 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -781,7 +781,7 @@ static int
 qla2x00_eh_wait_on_command(struct scsi_cmnd *cmd)
 {
 #define ABORT_POLLING_PERIOD   1000
-#define ABORT_WAIT_ITER((10 * 1000) / (ABORT_POLLING_PERIOD))
+#define ABORT_WAIT_ITER((2 * 1000) / (ABORT_POLLING_PERIOD))
unsigned long wait_iter = ABORT_WAIT_ITER;
scsi_qla_host_t *vha = shost_priv(cmd->device->host);
struct qla_hw_data *ha = vha->hw;
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/42] qla2xxx: Support of new firmware dump opcodes QLA8044_RDDFE(38), QLA8044_RDMDIO(39),QLA8044_POLLWR(40).

2014-04-11 Thread Saurav Kashyap
From: Pratik Mohanty 

Signed-off-by: Pratik Mohanty 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c |2 +-
 drivers/scsi/qla2xxx/qla_nx.h  |1 +
 drivers/scsi/qla2xxx/qla_nx2.c |  335 
 drivers/scsi/qla2xxx/qla_nx2.h |   47 ++
 4 files changed, 384 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index c6ecd24..7cf1044 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -49,7 +49,7 @@
  * |  || 0x800b,0x8039  |
  * | AER/EEH  |   0x9011   |   |
  * | Virtual Port |   0xa007   |   |
- * | ISP82XX Specific |   0xb14c   | 0xb002,0xb024  |
+ * | ISP82XX Specific |   0xb155   | 0xb002,0xb024  |
  * |  || 0xb09e,0xb0ae  |
  * |  || 0xb0e0-0xb0ef  |
  * |  || 0xb085,0xb0dc  |
diff --git a/drivers/scsi/qla2xxx/qla_nx.h b/drivers/scsi/qla2xxx/qla_nx.h
index 1bb93db..d57f6fe 100644
--- a/drivers/scsi/qla2xxx/qla_nx.h
+++ b/drivers/scsi/qla2xxx/qla_nx.h
@@ -1186,6 +1186,7 @@ static const int MD_MIU_TEST_AGT_RDDATA[] = { 0x41A8, 
0x41AC,
 #define CRB_NIU_XG_PAUSE_CTL_P10x8
 
 #define qla82xx_get_temp_val(x)  ((x) >> 16)
+#define qla82xx_get_temp_val1(x)  ((x) && 0x)
 #define qla82xx_get_temp_state(x)((x) & 0x)
 #define qla82xx_encode_temp(val, state)  (((val) << 16) | (state))
 
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index d36a623..6d73e2e 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -12,6 +12,8 @@
 
 #include 
 
+#define TIMEOUT_100_MS 100
+
 /* 8044 Flash Read/Write functions */
 uint32_t
 qla8044_rd_reg(struct qla_hw_data *ha, ulong addr)
@@ -117,6 +119,96 @@ qla8044_read_write_crb_reg(struct scsi_qla_host *vha,
qla8044_wr_reg_indirect(vha, waddr, value);
 }
 
+static int
+qla8044_poll_wait_for_ready(struct scsi_qla_host *vha, uint32_t addr1,
+   uint32_t mask)
+{
+   unsigned long timeout;
+   uint32_t temp;
+
+   /* jiffies after 100ms */
+   timeout = jiffies + msecs_to_jiffies(TIMEOUT_100_MS);
+   do {
+   qla8044_rd_reg_indirect(vha, addr1, &temp);
+   if ((temp & mask) != 0)
+   break;
+   if (time_after_eq(jiffies, timeout)) {
+   ql_log(ql_log_warn, vha, 0xb151,
+   "Error in processing rdmdio entry\n");
+   return -1;
+   }
+   } while (1);
+
+   return 0;
+}
+
+static uint32_t
+qla8044_ipmdio_rd_reg(struct scsi_qla_host *vha,
+   uint32_t addr1, uint32_t addr3, uint32_t mask, uint32_t addr)
+{
+   uint32_t temp;
+   int ret = 0;
+
+   ret = qla8044_poll_wait_for_ready(vha, addr1, mask);
+   if (ret == -1)
+   return -1;
+
+   temp = (0x4000 | addr);
+   qla8044_wr_reg_indirect(vha, addr1, temp);
+
+   ret = qla8044_poll_wait_for_ready(vha, addr1, mask);
+   if (ret == -1)
+   return 0;
+
+   qla8044_rd_reg_indirect(vha, addr3, &ret);
+
+   return ret;
+}
+
+
+static int
+qla8044_poll_wait_ipmdio_bus_idle(struct scsi_qla_host *vha,
+   uint32_t addr1, uint32_t addr2, uint32_t addr3, uint32_t mask)
+{
+   unsigned long timeout;
+   uint32_t temp;
+
+   /* jiffies after 100 msecs */
+   timeout = jiffies + (HZ / 1000) * TIMEOUT_100_MS;
+   do {
+   temp = qla8044_ipmdio_rd_reg(vha, addr1, addr3, mask, addr2);
+   if ((temp & 0x1) != 1)
+   break;
+   } while (!time_after_eq(jiffies, timeout));
+
+   if (time_after_eq(jiffies, timeout)) {
+   ql_log(ql_log_warn, vha, 0xb152,
+   "Error in processing mdiobus idle\n");
+   return -1;
+   }
+
+   return 0;
+}
+
+static int
+qla8044_ipmdio_wr_reg(struct scsi_qla_host *vha, uint32_t addr1,
+   uint32_t addr3, uint32_t mask, uint32_t addr, uint32_t value)
+{
+   int ret = 0;
+
+   ret = qla8044_poll_wait_for_ready(vha, addr1, mask);
+   if (ret == -1)
+   return -1;
+
+   qla8044_wr_reg_indirect(vha, addr3, value);
+   qla8044_wr_reg_indirect(vha, addr1, addr);
+
+   ret = qla8044_poll_wait_for_ready(vha, addr1, mask);
+   if (ret == -1)
+   return -1;
+
+   return 0;
+}
 /*
  * qla8044_rmw_crb_reg - Read value from raddr, AND with test_mask,
  * Shift Left,Right/OR/XOR with values RMW header and write value to waddr.
@@ -2897,6 +2989,231 @@ error_exit:
return rval;
 }
 
+static uint32_t
+qla8044_minidump_process_rddfe(struct scsi_qla_host *vha,

[PATCH 27/42] qla2xxx: Adjust adapter reset routine to the changes in firmware specification for ISPFx00.

2014-04-11 Thread Saurav Kashyap
From: Armen Baloyan 

Signed-off-by: Armen Baloyan 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_mr.c |   55 +++--
 drivers/scsi/qla2xxx/qla_mr.h |1 +
 2 files changed, 48 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mr.c b/drivers/scsi/qla2xxx/qla_mr.c
index 3fdf844..abeb390 100644
--- a/drivers/scsi/qla2xxx/qla_mr.c
+++ b/drivers/scsi/qla2xxx/qla_mr.c
@@ -527,21 +527,63 @@ qlafx00_soc_cpu_reset(scsi_qla_host_t *vha)
struct qla_hw_data *ha = vha->hw;
int i, core;
uint32_t cnt;
+   uint32_t reg_val;
+
+   spin_lock_irqsave(&ha->hardware_lock, flags);
+
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x80004, 0);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x82004, 0);
+
+   /* stop the XOR DMA engines */
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x60920, 0x02);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x60924, 0x02);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0xf0920, 0x02);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0xf0924, 0x02);
+
+   /* stop the IDMA engines */
+   reg_val = QLAFX00_GET_HBA_SOC_REG(ha, 0x60840);
+   reg_val &= ~(1<<12);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x60840, reg_val);
+
+   reg_val = QLAFX00_GET_HBA_SOC_REG(ha, 0x60844);
+   reg_val &= ~(1<<12);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x60844, reg_val);
+
+   reg_val = QLAFX00_GET_HBA_SOC_REG(ha, 0x60848);
+   reg_val &= ~(1<<12);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x60848, reg_val);
+
+   reg_val = QLAFX00_GET_HBA_SOC_REG(ha, 0x6084C);
+   reg_val &= ~(1<<12);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x6084C, reg_val);
+
+   for (i = 0; i < 10; i++) {
+   if ((QLAFX00_GET_HBA_SOC_REG(ha, 0xd) & 0x1000) == 0 &&
+   (QLAFX00_GET_HBA_SOC_REG(ha, 0x10600) & 0x1) == 0)
+   break;
+   udelay(100);
+   }
 
/* Set all 4 cores in reset */
for (i = 0; i < 4; i++) {
QLAFX00_SET_HBA_SOC_REG(ha,
(SOC_SW_RST_CONTROL_REG_CORE0 + 8*i), (0xF01));
-   }
-
-   /* Set all 4 core Clock gating control */
-   for (i = 0; i < 4; i++) {
QLAFX00_SET_HBA_SOC_REG(ha,
(SOC_SW_RST_CONTROL_REG_CORE0 + 4 + 8*i), (0x01010101));
}
 
/* Reset all units in Fabric */
-   QLAFX00_SET_HBA_SOC_REG(ha, SOC_FABRIC_RST_CONTROL_REG, (0x11F0101));
+   QLAFX00_SET_HBA_SOC_REG(ha, SOC_FABRIC_RST_CONTROL_REG, (0x011f0101));
+
+   /* */
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x10610, 1);
+   QLAFX00_SET_HBA_SOC_REG(ha, 0x10600, 0);
+
+   /* Set all 4 core Memory Power Down Registers */
+   for (i = 0; i < 5; i++) {
+   QLAFX00_SET_HBA_SOC_REG(ha,
+   (SOC_PWR_MANAGEMENT_PWR_DOWN_REG + 4*i), (0x0));
+   }
 
/* Reset all interrupt control registers */
for (i = 0; i < 115; i++) {
@@ -564,8 +606,6 @@ qlafx00_soc_cpu_reset(scsi_qla_host_t *vha)
QLAFX00_SET_HBA_SOC_REG(ha, SOC_FABRIC_CONTROL_REG, (0x2));
QLAFX00_SET_HBA_SOC_REG(ha, SOC_FABRIC_CONFIG_REG, (0x3));
 
-   spin_lock_irqsave(&ha->hardware_lock, flags);
-
/* Kick in Fabric units */
QLAFX00_SET_HBA_SOC_REG(ha, SOC_FABRIC_RST_CONTROL_REG, (0x0));
 
@@ -598,7 +638,6 @@ qlafx00_soft_reset(scsi_qla_host_t *vha)
 
ha->isp_ops->disable_intrs(ha);
qlafx00_soc_cpu_reset(vha);
-   ha->isp_ops->enable_intrs(ha);
 }
 
 /**
diff --git a/drivers/scsi/qla2xxx/qla_mr.h b/drivers/scsi/qla2xxx/qla_mr.h
index 1e6941e..aeaa1b4 100644
--- a/drivers/scsi/qla2xxx/qla_mr.h
+++ b/drivers/scsi/qla2xxx/qla_mr.h
@@ -351,6 +351,7 @@ struct config_info_data {
 #define SOC_FABRIC_RST_CONTROL_REG   0x0020840
 #define SOC_FABRIC_CONTROL_REG   0x0020200
 #define SOC_FABRIC_CONFIG_REG0x0020204
+#define SOC_PWR_MANAGEMENT_PWR_DOWN_REG  0x001820C
 
 #define SOC_INTERRUPT_SOURCE_I_CONTROL_REG 0x0020B00
 #define SOC_CORE_TIMER_REG 0x0021850
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 32/42] qla2xxx: ISP27xx queue index shadow registers.

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

For ISP27xx use the request/response queue index shadow registers
to avoid directly access them on the PCI bus.

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_def.h  |3 +++
 drivers/scsi/qla2xxx/qla_fw.h   |5 -
 drivers/scsi/qla2xxx/qla_init.c |8 
 drivers/scsi/qla2xxx/qla_iocb.c |   12 ++--
 drivers/scsi/qla2xxx/qla_mbx.c  |   10 --
 drivers/scsi/qla2xxx/qla_tmpl.c |6 --
 6 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 6c9724c..5c590d4 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2685,6 +2685,7 @@ struct rsp_que {
uint32_t __iomem *rsp_q_out;
uint16_t  ring_index;
uint16_t  out_ptr;
+   uint16_t  *in_ptr;  /* queue shadow in index */
uint16_t  length;
uint16_t  options;
uint16_t  rid;
@@ -2711,6 +2712,7 @@ struct req_que {
uint32_t __iomem *req_q_out;
uint16_t  ring_index;
uint16_t  in_ptr;
+   uint16_t  *out_ptr; /* queue shadow out index */
uint16_t  cnt;
uint16_t  length;
uint16_t  options;
@@ -3019,6 +3021,7 @@ struct qla_hw_data {
 (((ha)->fw_attributes_h << 16 | (ha)->fw_attributes) & BIT_22))
 #define IS_ATIO_MSIX_CAPABLE(ha) (IS_QLA83XX(ha))
 #define IS_TGT_MODE_CAPABLE(ha)(ha->tgt.atio_q_length)
+#define IS_SHADOW_REG_CAPABLE(ha)  (IS_QLA27XX(ha))
 
/* HBA serial number */
uint8_t serial0;
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index a9f86e7..2cdedd9 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -371,7 +371,10 @@ struct init_cb_24xx {
 * BIT 14 = Data Rate bit 1
 * BIT 15 = Data Rate bit 2
 * BIT 16 = Enable 75 ohm Termination Select
-* BIT 17-31 = Reserved
+* BIT 17-28 = Reserved
+* BIT 29 = Enable response queue 0 in index shadowing
+* BIT 30 = Enable request queue 0 out index shadowing
+* BIT 31 = Reserved
 */
uint32_t firmware_options_3;
uint16_t qos;
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 2d97d7c..20b569e 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2062,6 +2062,10 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
icb->atio_q_address[0] = cpu_to_le32(LSD(ha->tgt.atio_dma));
icb->atio_q_address[1] = cpu_to_le32(MSD(ha->tgt.atio_dma));
 
+   if (IS_SHADOW_REG_CAPABLE(ha))
+   icb->firmware_options_2 |=
+   __constant_cpu_to_le32(BIT_30|BIT_29);
+
if (ha->mqenable || IS_QLA83XX(ha) || IS_QLA27XX(ha)) {
icb->qos = __constant_cpu_to_le16(QLA_DEFAULT_QUE_QOS);
icb->rid = __constant_cpu_to_le16(rid);
@@ -2139,6 +2143,8 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
req = ha->req_q_map[que];
if (!req)
continue;
+   req->out_ptr = (void *)(req->ring + req->length);
+   *req->out_ptr = 0;
for (cnt = 1; cnt < req->num_outstanding_cmds; cnt++)
req->outstanding_cmds[cnt] = NULL;
 
@@ -2154,6 +2160,8 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
rsp = ha->rsp_q_map[que];
if (!rsp)
continue;
+   rsp->in_ptr = (void *)(rsp->ring + rsp->length);
+   *rsp->in_ptr = 0;
/* Initialize response queue entries */
if (IS_QLAFX00(ha))
qlafx00_init_response_q_entries(rsp);
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 8707a64..af83132 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -1478,8 +1478,8 @@ qla24xx_start_scsi(srb_t *sp)
tot_dsds = nseg;
req_cnt = qla24xx_calc_iocbs(vha, tot_dsds);
if (req->cnt < (req_cnt + 2)) {
-   cnt = RD_REG_DWORD_RELAXED(req->req_q_out);
-
+   cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr :
+   RD_REG_DWORD_RELAXED(req->req_q_out);
if (req->ring_index < cnt)
req->cnt = cnt - req->ring_index;
else
@@ -1697,8 +1697,8 @@ qla24xx_dif_start_scsi(srb_t *sp)
tot_prot_dsds = nseg;
tot_dsds += nseg;
if (req->cnt < (req_cnt + 2)) {
-   cnt = RD_REG_DWORD_RELAXED(req->req_q_out);
-
+   cnt = IS_SHADOW_REG_CAPABLE(ha) ? *req->out_ptr :
+   RD_REG_DWORD_RELAXED(req->req_q_out);
if (req->ring_index < cnt)
req->cnt = cnt - req->ring_index;
else
@@ -2825,8 +2825,8 @@ qla2x00_start_bidir(srb_t *sp, struct scsi_qla_h

[PATCH 31/42] qla2xxx: ISP27xx firmware dump template spec updates (including T274).

2014-04-11 Thread Saurav Kashyap
From: Joe Carnuccio 

Signed-off-by: Joe Carnuccio 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c  |6 +-
 drivers/scsi/qla2xxx/qla_tmpl.c |   90 +++
 drivers/scsi/qla2xxx/qla_tmpl.h |   15 ++-
 3 files changed, 78 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 8564682..cdff3aa 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -61,11 +61,11 @@
  * |  || 0xb13c-0xb140  |
  * |  || 0xb149
|
  * | MultiQ   |   0xc00c   |   |
- * | Misc |   0xd300   | 0xd017-0xd019 |
+ * | Misc |   0xd212   | 0xd017-0xd019 |
  * |  || 0xd020
|
- * |  || 0xd02e-0xd0ff |
+ * |  || 0xd030-0xd0ff |
  * |  || 0xd101-0xd1fe |
- * |  || 0xd212-0xd2fe |
+ * |  || 0xd213-0xd2fe |
  * | Target Mode |   0xe070   | 0xe021 |
  * | Target Mode Management  |   0xf072   | 0xf002-0xf003  |
  * |  || 0xf046-0xf049  |
diff --git a/drivers/scsi/qla2xxx/qla_tmpl.c b/drivers/scsi/qla2xxx/qla_tmpl.c
index 872ec7e..a9fa9b7 100644
--- a/drivers/scsi/qla2xxx/qla_tmpl.c
+++ b/drivers/scsi/qla2xxx/qla_tmpl.c
@@ -192,19 +192,6 @@ static inline void (*qla27xx_read_vector(uint width))(void 
*, void *, ulong *)
 }
 
 static inline void
-qla27xx_read_off(__iomem struct device_reg_24xx *reg,
-   uint offset, void *buf, ulong *len)
-{
-   void *window = (void *)reg + offset;
-
-   if (buf) {
-   ql_dbg(ql_dbg_misc, NULL, 0xd300,
-   "%s: @%x\n", __func__, offset);
-   }
-   qla27xx_read32(window, buf, len);
-}
-
-static inline void
 qla27xx_read_reg(__iomem struct device_reg_24xx *reg,
uint offset, void *buf, ulong *len)
 {
@@ -214,7 +201,6 @@ qla27xx_read_reg(__iomem struct device_reg_24xx *reg,
ql_dbg(ql_dbg_misc, NULL, 0xd014,
"%s: @%x\n", __func__, offset);
}
-   qla27xx_insert32(offset, buf, len);
qla27xx_read32(window, buf, len);
 }
 
@@ -233,7 +219,7 @@ qla27xx_write_reg(__iomem struct device_reg_24xx *reg,
 
 static inline void
 qla27xx_read_window(__iomem struct device_reg_24xx *reg,
-   uint32_t base, uint offset, uint count, uint width, void *buf,
+   uint32_t addr, uint offset, uint count, uint width, void *buf,
ulong *len)
 {
void *window = (void *)reg + offset;
@@ -242,14 +228,14 @@ qla27xx_read_window(__iomem struct device_reg_24xx *reg,
if (buf) {
ql_dbg(ql_dbg_misc, NULL, 0xd016,
"%s: base=%x offset=%x count=%x width=%x\n",
-   __func__, base, offset, count, width);
+   __func__, addr, offset, count, width);
}
-   qla27xx_write_reg(reg, IOBASE_ADDR, base, buf);
+   qla27xx_write_reg(reg, IOBASE_ADDR, addr, buf);
while (count--) {
-   qla27xx_insert32(base, buf, len);
+   qla27xx_insert32(addr, buf, len);
readn(window, buf, len);
window += width;
-   base++;
+   addr++;
}
 }
 
@@ -349,7 +335,8 @@ qla27xx_fwdt_entry_t260(struct scsi_qla_host *vha,
 
ql_dbg(ql_dbg_misc, vha, 0xd204,
"%s: rdpci [%lx]\n", __func__, *len);
-   qla27xx_read_reg(reg, ent->t260.pci_addr, buf, len);
+   qla27xx_insert32(ent->t260.pci_offset, buf, len);
+   qla27xx_read_reg(reg, ent->t260.pci_offset, buf, len);
 
return false;
 }
@@ -362,7 +349,7 @@ qla27xx_fwdt_entry_t261(struct scsi_qla_host *vha,
 
ql_dbg(ql_dbg_misc, vha, 0xd205,
"%s: wrpci [%lx]\n", __func__, *len);
-   qla27xx_write_reg(reg, ent->t261.pci_addr, ent->t261.write_data, buf);
+   qla27xx_write_reg(reg, ent->t261.pci_offset, ent->t261.write_data, buf);
 
return false;
 }
@@ -405,9 +392,9 @@ qla27xx_fwdt_entry_t262(struct scsi_qla_host *vha,
goto done;
}
 
-   if (end < start) {
+   if (end < start || end == 0) {
ql_dbg(ql_dbg_misc, vha, 0xd023,
-   "%s: bad range (start=%x end=%x)\n", __func__,
+   "%s: unusable range (start=%x end=%x)\n", __func__,
ent->t262.end_addr, ent->t262.start_addr);
qla27xx_skip_entry(ent, buf);
goto done;
@@ -465,17 +452,15 @@ qla27xx_fwdt_entry_t263(struct scsi_qla_host *vha,

[PATCH 29/42] qla2xxx: Check the QLA8044_CRB_DRV_ACTIVE_INDEX register when we are not the owner of the reset.

2014-04-11 Thread Saurav Kashyap
From: Hiral Patel 

Signed-off-by: Hiral Patel 
Signed-off-by: Saurav Kashyap 
---
 drivers/scsi/qla2xxx/qla_dbg.c |1 +
 drivers/scsi/qla2xxx/qla_nx2.c |  120 +++-
 drivers/scsi/qla2xxx/qla_nx2.h |1 +
 3 files changed, 59 insertions(+), 63 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index e48084f..8564682 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -51,6 +51,7 @@
  * | Virtual Port |   0xa007   |   |
  * | ISP82XX Specific |   0xb157   | 0xb002,0xb024  |
  * |  || 0xb09e,0xb0ae  |
+ * | || 0xb0c3,0xb0c6  |
  * |  || 0xb0e0-0xb0ef  |
  * |  || 0xb085,0xb0dc  |
  * |  || 0xb107,0xb108  |
diff --git a/drivers/scsi/qla2xxx/qla_nx2.c b/drivers/scsi/qla2xxx/qla_nx2.c
index e5b4a40..da9e390 100644
--- a/drivers/scsi/qla2xxx/qla_nx2.c
+++ b/drivers/scsi/qla2xxx/qla_nx2.c
@@ -1633,7 +1633,7 @@ static void
 qla8044_need_reset_handler(struct scsi_qla_host *vha)
 {
uint32_t dev_state = 0, drv_state, drv_active;
-   unsigned long reset_timeout, dev_init_timeout;
+   unsigned long reset_timeout;
struct qla_hw_data *ha = vha->hw;
 
ql_log(ql_log_fatal, vha, 0xb0c2,
@@ -1647,84 +1647,78 @@ qla8044_need_reset_handler(struct scsi_qla_host *vha)
qla8044_idc_lock(ha);
}
 
+   dev_state = qla8044_rd_direct(vha,
+   QLA8044_CRB_DEV_STATE_INDEX);
drv_state = qla8044_rd_direct(vha,
QLA8044_CRB_DRV_STATE_INDEX);
drv_active = qla8044_rd_direct(vha,
QLA8044_CRB_DRV_ACTIVE_INDEX);
 
ql_log(ql_log_info, vha, 0xb0c5,
-   "%s(%ld): drv_state = 0x%x, drv_active = 0x%x\n",
-   __func__, vha->host_no, drv_state, drv_active);
+   "%s(%ld): drv_state = 0x%x, drv_active = 0x%x dev_state = 0x%x\n",
+   __func__, vha->host_no, drv_state, drv_active, dev_state);
 
-   if (!ha->flags.nic_core_reset_owner) {
-   ql_dbg(ql_dbg_p3p, vha, 0xb0c3,
-   "%s(%ld): reset acknowledged\n",
-   __func__, vha->host_no);
-   qla8044_set_rst_ready(vha);
-
-   /* Non-reset owners ACK Reset and wait for device INIT state
-* as part of Reset Recovery by Reset Owner
-*/
-   dev_init_timeout = jiffies + (ha->fcoe_reset_timeout * HZ);
+   qla8044_set_rst_ready(vha);
 
-   do {
-   if (time_after_eq(jiffies, dev_init_timeout)) {
-   ql_log(ql_log_info, vha, 0xb0c4,
-   "%s: Non Reset owner: Reset Ack Timeout!\n",
-   __func__);
-   break;
-   }
+   /* wait for 10 seconds for reset ack from all functions */
+   reset_timeout = jiffies + (ha->fcoe_reset_timeout * HZ);
 
-   qla8044_idc_unlock(ha);
-   msleep(1000);
-   qla8044_idc_lock(ha);
-
-   dev_state = qla8044_rd_direct(vha,
-   QLA8044_CRB_DEV_STATE_INDEX);
-   } while (((drv_state & drv_active) != drv_active) &&
-   (dev_state == QLA8XXX_DEV_NEED_RESET));
-   } else {
-   qla8044_set_rst_ready(vha);
-
-   /* wait for 10 seconds for reset ack from all functions */
-   reset_timeout = jiffies + (ha->fcoe_reset_timeout * HZ);
-
-   while ((drv_state & drv_active) != drv_active) {
-   if (time_after_eq(jiffies, reset_timeout)) {
-   ql_log(ql_log_info, vha, 0xb0c6,
-   "%s: RESET TIMEOUT!"
-   "drv_state: 0x%08x, drv_active: 0x%08x\n",
-   QLA2XXX_DRIVER_NAME, drv_state, drv_active);
-   break;
-   }
+   do {
+   if (time_after_eq(jiffies, reset_timeout)) {
+   ql_log(ql_log_info, vha, 0xb0c4,
+   "%s: Function %d: Reset Ack Timeout!, drv_state: 
0x%08x, drv_active: 0x%08x\n",
+   __func__, ha->portnum, drv_state, drv_active);
+   break;
+   }
 
-   qla8044_idc_unlock(ha);
-   msleep(1000);
-   qla8044_idc_lock(ha);
+   qla8044_idc_unlock(ha);
+   msleep(1000);
+   qla8044_idc_lock(ha);
 
-   drv_state = qla8044_rd_direct(vha,
-  

Re: [PATCH] virtio-scsi: Skip setting affinity on uninitialized vq

2014-04-11 Thread Paolo Bonzini

Il 11/04/2014 03:23, Fam Zheng ha scritto:

virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
the vqs. The latter calls virtscsi_set_affinity, so let's check the
pointer there before setting affinity on it.

This fixes a panic when setting device's num_queues=2 on RHEL 6.5:

qemu-system-x86_64 ... \
-device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
-drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
-device scsi-hd,drive=drive-scsi-disk,...

[0.354734] scsi0 : Virtio SCSI HBA
[0.379504] BUG: unable to handle kernel NULL pointer dereference at 
0020
[0.380141] IP: [] __virtscsi_set_affinity+0x4f/0x120
[0.380141] PGD 0
[0.380141] Oops:  [#1] SMP
[0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
[0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
[0.380141] task: 88003c9f ti: 88003c9f8000 task.ti: 
88003c9f8000
[0.380141] RIP: 0010:[]  [] 
__virtscsi_set_affinity+0x4f/0x120
[0.380141] RSP: :88003c9f9c08  EFLAGS: 00010256
[0.380141] RAX:  RBX: 88003c3a9d40 RCX: 1070
[0.380141] RDX: 0002 RSI:  RDI: 
[0.380141] RBP: 88003c9f9c28 R08: 000136c0 R09: 88003c801c00
[0.380141] R10: 81475229 R11: 0008 R12: 
[0.380141] R13: 81cc7ca8 R14: 88003cac3d40 R15: 88003cac37a0
[0.380141] FS:  () GS:88003e40() 
knlGS:
[0.380141] CS:  0010 DS:  ES:  CR0: 8005003b
[0.380141] CR2: 0020 CR3: 01c0e000 CR4: 06f0
[0.380141] Stack:
[0.380141]  88003c3a9d40  88003cac3d80 
88003cac3d40
[0.380141]  88003c9f9c48 814742e8 88003c26d000 
88003c26d000
[0.380141]  88003c9f9c68 81474321 88003c26d000 
88003c3a9d40
[0.380141] Call Trace:
[0.380141]  [] virtscsi_set_affinity+0x28/0x40
[0.380141]  [] virtscsi_remove_vqs+0x21/0x50
[0.380141]  [] virtscsi_init+0x91/0x240
[0.380141]  [] ? vp_get+0x50/0x70
[0.380141]  [] virtscsi_probe+0xf4/0x280
[0.380141]  [] virtio_dev_probe+0xe5/0x140
[0.380141]  [] driver_probe_device+0x89/0x230
[0.380141]  [] __driver_attach+0x9b/0xa0
[0.380141]  [] ? driver_probe_device+0x230/0x230
[0.380141]  [] ? driver_probe_device+0x230/0x230
[0.380141]  [] bus_for_each_dev+0x8c/0xb0
[0.380141]  [] driver_attach+0x19/0x20
[0.380141]  [] bus_add_driver+0x198/0x220
[0.380141]  [] driver_register+0x5f/0xf0
[0.380141]  [] ? spi_transport_init+0x79/0x79
[0.380141]  [] register_virtio_driver+0x1b/0x30
[0.380141]  [] init+0x88/0xd6
[0.380141]  [] ? scsi_init_procfs+0x5b/0x5b
[0.380141]  [] do_one_initcall+0x7f/0x10a
[0.380141]  [] kernel_init_freeable+0x14a/0x1de
[0.380141]  [] ? kernel_init_freeable+0x1de/0x1de
[0.380141]  [] ? rest_init+0x80/0x80
[0.380141]  [] kernel_init+0x9/0xf0
[0.380141]  [] ret_from_fork+0x7c/0xb0
[0.380141]  [] ? rest_init+0x80/0x80
[0.380141] RIP  [] __virtscsi_set_affinity+0x4f/0x120
[0.380141]  RSP 
[0.380141] CR2: 0020
[0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
[0.475018] Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0009
[0.475018]
[0.475068] Kernel Offset: 0x0 from 0x8100 (relocation range: 
0x8000-0x9fff)
[0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0009

Signed-off-by: Fam Zheng 
---
 drivers/scsi/virtio_scsi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 16bfd50..3019267 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -750,8 +750,12 @@ static void __virtscsi_set_affinity(struct virtio_scsi 
*vscsi, bool affinity)

vscsi->affinity_hint_set = true;
} else {
-   for (i = 0; i < vscsi->num_queues; i++)
+   for (i = 0; i < vscsi->num_queues; i++) {
+   if (!vscsi->req_vqs[i].vq) {
+   continue;
+   }
virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1);
+   }

vscsi->affinity_hint_set = false;
}



You put the if inside the loop, but it's really all or nothing since the 
failure point is find_vqs.


Not a problem though; the queues are few and this is not a hot path anyway.

Acked-by: Paolo Bonzini 

Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] virtio-scsi: Skip setting affinity on uninitialized vq

2014-04-11 Thread Paolo Bonzini

Il 11/04/2014 03:23, Fam Zheng ha scritto:

virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
the vqs. The latter calls virtscsi_set_affinity, so let's check the
pointer there before setting affinity on it.

This fixes a panic when setting device's num_queues=2 on RHEL 6.5:

qemu-system-x86_64 ... \
-device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
-drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
-device scsi-hd,drive=drive-scsi-disk,...

[0.354734] scsi0 : Virtio SCSI HBA
[0.379504] BUG: unable to handle kernel NULL pointer dereference at 
0020
[0.380141] IP: [] __virtscsi_set_affinity+0x4f/0x120
[0.380141] PGD 0
[0.380141] Oops:  [#1] SMP
[0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
[0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
[0.380141] task: 88003c9f ti: 88003c9f8000 task.ti: 
88003c9f8000
[0.380141] RIP: 0010:[]  [] 
__virtscsi_set_affinity+0x4f/0x120
[0.380141] RSP: :88003c9f9c08  EFLAGS: 00010256
[0.380141] RAX:  RBX: 88003c3a9d40 RCX: 1070
[0.380141] RDX: 0002 RSI:  RDI: 
[0.380141] RBP: 88003c9f9c28 R08: 000136c0 R09: 88003c801c00
[0.380141] R10: 81475229 R11: 0008 R12: 
[0.380141] R13: 81cc7ca8 R14: 88003cac3d40 R15: 88003cac37a0
[0.380141] FS:  () GS:88003e40() 
knlGS:
[0.380141] CS:  0010 DS:  ES:  CR0: 8005003b
[0.380141] CR2: 0020 CR3: 01c0e000 CR4: 06f0
[0.380141] Stack:
[0.380141]  88003c3a9d40  88003cac3d80 
88003cac3d40
[0.380141]  88003c9f9c48 814742e8 88003c26d000 
88003c26d000
[0.380141]  88003c9f9c68 81474321 88003c26d000 
88003c3a9d40
[0.380141] Call Trace:
[0.380141]  [] virtscsi_set_affinity+0x28/0x40
[0.380141]  [] virtscsi_remove_vqs+0x21/0x50
[0.380141]  [] virtscsi_init+0x91/0x240
[0.380141]  [] ? vp_get+0x50/0x70
[0.380141]  [] virtscsi_probe+0xf4/0x280
[0.380141]  [] virtio_dev_probe+0xe5/0x140
[0.380141]  [] driver_probe_device+0x89/0x230
[0.380141]  [] __driver_attach+0x9b/0xa0
[0.380141]  [] ? driver_probe_device+0x230/0x230
[0.380141]  [] ? driver_probe_device+0x230/0x230
[0.380141]  [] bus_for_each_dev+0x8c/0xb0
[0.380141]  [] driver_attach+0x19/0x20
[0.380141]  [] bus_add_driver+0x198/0x220
[0.380141]  [] driver_register+0x5f/0xf0
[0.380141]  [] ? spi_transport_init+0x79/0x79
[0.380141]  [] register_virtio_driver+0x1b/0x30
[0.380141]  [] init+0x88/0xd6
[0.380141]  [] ? scsi_init_procfs+0x5b/0x5b
[0.380141]  [] do_one_initcall+0x7f/0x10a
[0.380141]  [] kernel_init_freeable+0x14a/0x1de
[0.380141]  [] ? kernel_init_freeable+0x1de/0x1de
[0.380141]  [] ? rest_init+0x80/0x80
[0.380141]  [] kernel_init+0x9/0xf0
[0.380141]  [] ret_from_fork+0x7c/0xb0
[0.380141]  [] ? rest_init+0x80/0x80
[0.380141] RIP  [] __virtscsi_set_affinity+0x4f/0x120
[0.380141]  RSP 
[0.380141] CR2: 0020
[0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
[0.475018] Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0009
[0.475018]
[0.475068] Kernel Offset: 0x0 from 0x8100 (relocation range: 
0x8000-0x9fff)
[0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! 
exitcode=0x0009

Signed-off-by: Fam Zheng 
---
 drivers/scsi/virtio_scsi.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index 16bfd50..3019267 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -750,8 +750,12 @@ static void __virtscsi_set_affinity(struct virtio_scsi 
*vscsi, bool affinity)

vscsi->affinity_hint_set = true;
} else {
-   for (i = 0; i < vscsi->num_queues; i++)
+   for (i = 0; i < vscsi->num_queues; i++) {
+   if (!vscsi->req_vqs[i].vq) {
+   continue;
+   }
virtqueue_set_affinity(vscsi->req_vqs[i].vq, -1);
+   }

vscsi->affinity_hint_set = false;
}



Fam, please send v2 with "Cc: sta...@vger.kernel.org" in the commit 
message and my Acked-by.


Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL] async scsi resume for 3.15

2014-04-11 Thread Linus Torvalds
On Fri, Apr 11, 2014 at 11:20 AM, James Bottomley
 wrote:
>
> I also don't see this in linux-next, unless I'm not looking in the right
> place, so it would be a bit of a risk adding it just before -rc1.

.. but it sounds like you're not against it? I'll pull it - in the
chaos that is 3.15-rc1, this is the least of my worries. This has been
the biggest (by far) merge window so far, afaik. Might as well take
this too.

  Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL] async scsi resume for 3.15

2014-04-11 Thread Linus Torvalds
On Fri, Apr 11, 2014 at 5:23 PM, Linus Torvalds
 wrote:
>
> This has been the biggest (by far) merge window so far, afaik.
> Might as well take this too.

Actually, I take that "by far" back. In fact it's not even the biggest
one (yet). It looks like 3.10-rc1 was worse in number of commits, and
v3.7-rc1 was bigger in number of lines and files.

That may still change by the time I tag rc1, but it looks like while
the current merge window is big, it's not actually going to break any
records.

Regardless, I pulled the async scsi resume patch.

  Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html