[PATCH 1/1] scsi: sd: improved drive sanitize error handling

2018-04-17 Thread Mahesh Rajashekhara
During the drive sanitization, when the sd driver issues TEST UNIT READY (TUR),
drive reports Sense Key: NOT_READY, ASC: 0x4 and ASCQ: 0x1b.

Sd driver issuing START_STOP command to spin up the drive.
This causes a hung and call trace occurred.

sd driver should take note of Sense Key: NOT_READY, ASC: 0x4 and ASCQ: 0x1b and
should not send START_STOP command until that condition clears.

Excerpt of dmesg:
[  206.998697] sd 6:0:0:0: [sda] tag#1 FAILED Result: hostbyte=DID_OK 
driverbyte=DRIVER_SENSE
[  206.998714] sd 6:0:0:0: [sda] tag#1 Sense Key : Not Ready [current]
[  206.998720] sd 6:0:0:0: [sda] tag#1 Add. Sense: Logical unit not ready, 
sanitize in progress
[  206.998727] sd 6:0:0:0: [sda] tag#1 CDB: Read(10) 28 00 00 00 00 04 00 00 04 
00
[  206.998732] print_req_error: I/O error, dev sda, sector 4
[  206.998787] Buffer I/O error on dev sda, logical block 1, async page read
[  206.999786] sd 6:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_OK 
driverbyte=DRIVER_SENSE
[  206.999799] sd 6:0:0:0: [sda] tag#0 Sense Key : Not Ready [current]
[  206.999806] sd 6:0:0:0: [sda] tag#0 Add. Sense: Logical unit not ready, 
sanitize in progress
[  206.999812] sd 6:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 00 04 
00
[  206.999816] print_req_error: I/O error, dev sda, sector 0
[  207.000127] Buffer I/O error on dev sda, logical block 0, async page read
[  207.000761] sd 6:0:0:0: [sda] tag#1 FAILED Result: hostbyte=DID_OK 
driverbyte=DRIVER_SENSE
[  207.000775] sd 6:0:0:0: [sda] tag#1 Sense Key : Not Ready [current]
[  207.000780] sd 6:0:0:0: [sda] tag#1 Add. Sense: Logical unit not ready, 
sanitize in progress
[  207.000786] sd 6:0:0:0: [sda] tag#1 CDB: Read(10) 28 00 00 00 00 04 00 00 04 
00
[  207.000789] print_req_error: I/O error, dev sda, sector 4
[  207.000835] Buffer I/O error on dev sda, logical block 1, async page read
[  207.013461] Dev sda: unable to read RDB block 0
[  207.041607]  sda: unable to read partition table
[  207.051796] sd 6:0:0:0: [sda] Spinning up disk...
[  208.091576] ..
[  242.874325] INFO: task systemd-udevd:613 blocked for more than 120 seconds.
[  242.874391]   Tainted: G   OE4.16.0-rc1+ #1
[  242.874445] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this 
message.
[  242.874507] systemd-udevd   D0   613478 0x8104
[  242.874512] Call Trace:
[  242.874524]  ? __schedule+0x297/0x870
[  242.874532]  ? _cond_resched+0x15/0x40
[  242.874537]  schedule+0x28/0x80
[  242.874542]  async_synchronize_cookie_domain+0x96/0x140
[  242.874547]  ? wait_woken+0x80/0x80
[  242.874553]  do_init_module+0xbc/0x201
[  242.874557]  load_module+0x1989/0x1f10
[  242.874565]  ? SYSC_finit_module+0xe9/0x110
[  242.874569]  SYSC_finit_module+0xe9/0x110
[  242.874577]  do_syscall_64+0x71/0x130
[  242.874584]  entry_SYSCALL_64_after_hwframe+0x21/0x86
[  242.874588] RIP: 0033:0x7fed93532a49
[  242.874591] RSP: 002b:7fff9467b108 EFLAGS: 0246 ORIG_RAX: 
0139
[  242.874595] RAX: ffda RBX: 55a3462a9380 RCX: 7fed93532a49
[  242.874597] RDX:  RSI: 7fed9321e1c5 RDI: 000f
[  242.874600] RBP: 7fed9321e1c5 R08:  R09: 
[  242.874602] R10: 000f R11: 0246 R12: 
[  242.874604] R13: 55a3462a7510 R14: 0002 R15: 55a3462a9380
[  243.290259] 
...not responding...
[  307.290719] sd 6:0:0:0: [sda] Attached SCSI disk

Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekh...@microsemi.com>
---
 drivers/scsi/sd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index a6201e6..9421d98 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2121,6 +2121,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
break;  /* standby */
if (sshdr.asc == 4 && sshdr.ascq == 0xc)
break;  /* unavailable */
+   if (sshdr.asc == 4 && sshdr.ascq == 0x1b)
+   break;  /* sanitize in progress */
/*
 * Issue command to spin up drive when not ready
 */
-- 
2.7.4



RE: Regarding SCSI SANITIZE command support

2018-04-10 Thread Mahesh Rajashekhara
 10:0:10:0: [sdb] FAILED Result: hostbyte=DID_OK 
driverbyte=DRIVER_SENSE
[ 7726.531075] sd 10:0:10:0: [sdb] Sense Key : Not Ready [current]
[ 7726.531079] sd 10:0:10:0: [sdb] Add. Sense: Logical unit not ready, sanitize 
in progress
[ 7726.531082] sd 10:0:10:0: [sdb] CDB: Read(10) 28 00 00 00 00 04 00 00 04 00
[ 7726.531084] blk_update_request: I/O error, dev sdb, sector 4
[ 7726.531087] Buffer I/O error on dev sdb, logical block 1, async page read
[ 7726.535232] Dev sdb: unable to read RDB block 0
[ 7726.539416]  sdb: unable to read partition table

Thanks,
Mahesh


-Original Message-
From: Douglas Gilbert [mailto:dgilb...@interlog.com] 
Sent: Tuesday, April 3, 2018 9:53 PM
To: Mahesh Rajashekhara <mahesh.rajashekh...@microsemi.com>; 
linux-scsi@vger.kernel.org
Cc: Vasanthalakshmi Tharmarajan <vasanthalakshmi.t...@microsemi.com>; Ajish 
Koshy <ajish.ko...@microsemi.com>
Subject: Re: Regarding SCSI SANITIZE command support

EXTERNAL EMAIL


On 2018-04-02 07:10 AM, Mahesh Rajashekhara wrote:
> Hello,
>
> I am RAID HBA driver engineer here at Microsemi. We are working on linux 
> driver development for Microsemi SAS/SATA RAID HBA controllers.
>
> As per our understanding, while a drive is processing the SANITIZE command:
> - The drive should still be exposed to the OS.
> - The drive will fail all commands other than REQUEST SENSE

Not sure that the drive should ever knowingly fail INQUIRY and REPORT LUNS. 
That is to allow a discovery process to occur. In the INQUIRY response the 
peripheral qualifier should be 000b by my reading.

Go look at sbc4r15.pdf, specifically clause 4.11.2 to see all the commands that 
should be responded to during a SANITIZE (there are
9 of them).

> When we initiate SCSI SANITIZE operation on disk drive,  from the OS 
> dmesg, we could see that continuous SCSI READ (10) commands have been sent by 
> the OS upper layer drivers and drive reports ASC: 04 ASCQ: 1B "LOGICAL UNIT 
> NOT READY, SANITIZE IN PROGRESS". Since the sanitize operation is in 
> progress, the drive will fail the commands.
> Although, OS could see drive is sanitizing, we are not sure why does OS upper 
> layer driver is sending SCSI READ (10).
>
> During the OS boot, if the drive is sanitizing, OS boot is taking very long 
> time and call trace issue has been occurred.
>
> It would be of great help if you could shed some light on this issue.
>
> Snippet of dmesg:
>
>   [ 202.659196] sd 0:0:11:0: [sdm] CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
>   [ 202.659198] blk_update_request: I/O error, dev sdm, sector 0
>   [ 202.659201] Buffer I/O error on dev sdm, logical block 0, async page read
>   [ 202.659294] sd 0:0:11:0: [sdm] FAILED Result: hostbyte=DID_OK 
> driverbyte=DRIVER_SENSE
>   [ 202.659299] sd 0:0:11:0: [sdm] Sense Key : Not Ready [current]
>   [ 202.659303] sd 0:0:11:0: [sdm] Add. Sense: Logical unit not ready, 
> sanitize in progress
>   [ 202.659308] sd 0:0:11:0: [sdm] CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
>   [ 202.659311] blk_update_request: I/O error, dev sdm, sector 0
>   [ 202.659314] Buffer I/O error on dev sdm, logical block 0, async page read
>   [ 202.659322] sdm: unable to read partition table
>   [ 202.659633] sd 0:0:11:0: [sdm] FAILED Result: hostbyte=DID_OK 
> driverbyte=DRIVER_SENSE
>   [ 202.659638] sd 0:0:11:0: [sdm] Sense Key : Not Ready [current]
>   [ 202.659641] sd 0:0:11:0: [sdm] Add. Sense: Logical unit not ready, 
> sanitize in progress
>   [ 202.659645] sd 0:0:11:0: [sdm] CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
>   [ 202.659648] blk_update_request: I/O error, dev sdm, sector 0
>   [ 202.660621] sd 0:0:11:0: [sdm] Spinning up disk...
>   [ 204.067155] Buffer I/O error on dev sdm, logical block 488378624, async 
> page read
>   [ 204.122152] SGI XFS with ACLs, security attributes, no debug enabled
>   [ 204.123494] XFS (dm-0): Mounting V5 Filesystem
>   [ 204.289817] XFS (dm-0): Ending clean mount
>   [ 240.069283] INFO: task systemd-udevd:251 blocked for more than 120 
> seconds.
>   [ 240.069289] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables 
> this message
>   [  203.661324] .
>   [ 240.069293] systemd-udevd D
>   [ 240.069296] c00c3580 0 251 1 0x0004
>   [ 240.069301] 88007e0e7d18 0082 88007e0ceeb0 
> 88007e0e7fd8
>   [ 240.069306] 88007e0e7fd8 88007e0e7fd8 88007e0ceeb0 
> 
>   [ 240.069311]  c00c35d0 0001 
> c00c3580
>   [ 240.069316] Call Trace:
>   [ 240.069328] [] schedule+0x29/0x70
>   [ 240.069334] [] 
> async_synchronize_cookie_domain+0x85/0x150
>   [ 240.069340] [] ? wake_up_atomic_t+0x30/0x30
>   [ 240.069346] [] async_synchronize_full+0x17/0x20
>   [ 240.

Regarding SCSI SANITIZE command support

2018-04-02 Thread Mahesh Rajashekhara
Hello,

I am RAID HBA driver engineer here at Microsemi. We are working on linux driver 
development for Microsemi SAS/SATA RAID HBA controllers.

As per our understanding, while a drive is processing the SANITIZE command:
- The drive should still be exposed to the OS.
- The drive will fail all commands other than REQUEST SENSE

When we initiate SCSI SANITIZE operation on disk drive,  from the OS dmesg, we 
could see that continuous SCSI READ (10) commands have been sent by the OS 
upper layer drivers 
and drive reports ASC: 04 ASCQ: 1B "LOGICAL UNIT NOT READY, SANITIZE IN 
PROGRESS". Since the sanitize operation is in progress, the drive will fail the 
commands. 
Although, OS could see drive is sanitizing, we are not sure why does OS upper 
layer driver is sending SCSI READ (10).

During the OS boot, if the drive is sanitizing, OS boot is taking very long 
time and call trace issue has been occurred. 

It would be of great help if you could shed some light on this issue.

Snippet of dmesg:

 [ 202.659196] sd 0:0:11:0: [sdm] CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 [ 202.659198] blk_update_request: I/O error, dev sdm, sector 0
 [ 202.659201] Buffer I/O error on dev sdm, logical block 0, async page read
 [ 202.659294] sd 0:0:11:0: [sdm] FAILED Result: hostbyte=DID_OK 
driverbyte=DRIVER_SENSE
 [ 202.659299] sd 0:0:11:0: [sdm] Sense Key : Not Ready [current]
 [ 202.659303] sd 0:0:11:0: [sdm] Add. Sense: Logical unit not ready, sanitize 
in progress
 [ 202.659308] sd 0:0:11:0: [sdm] CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 [ 202.659311] blk_update_request: I/O error, dev sdm, sector 0
 [ 202.659314] Buffer I/O error on dev sdm, logical block 0, async page read
 [ 202.659322] sdm: unable to read partition table
 [ 202.659633] sd 0:0:11:0: [sdm] FAILED Result: hostbyte=DID_OK 
driverbyte=DRIVER_SENSE
 [ 202.659638] sd 0:0:11:0: [sdm] Sense Key : Not Ready [current]
 [ 202.659641] sd 0:0:11:0: [sdm] Add. Sense: Logical unit not ready, sanitize 
in progress
 [ 202.659645] sd 0:0:11:0: [sdm] CDB: Read(10) 28 00 00 00 00 00 00 00 01 00
 [ 202.659648] blk_update_request: I/O error, dev sdm, sector 0
 [ 202.660621] sd 0:0:11:0: [sdm] Spinning up disk...
 [ 204.067155] Buffer I/O error on dev sdm, logical block 488378624, async page 
read
 [ 204.122152] SGI XFS with ACLs, security attributes, no debug enabled
 [ 204.123494] XFS (dm-0): Mounting V5 Filesystem
 [ 204.289817] XFS (dm-0): Ending clean mount
 [ 240.069283] INFO: task systemd-udevd:251 blocked for more than 120 seconds.
 [ 240.069289] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this 
message
 [  203.661324] .
 [ 240.069293] systemd-udevd D
 [ 240.069296] c00c3580 0 251 1 0x0004
 [ 240.069301] 88007e0e7d18 0082 88007e0ceeb0 
88007e0e7fd8
 [ 240.069306] 88007e0e7fd8 88007e0e7fd8 88007e0ceeb0 

 [ 240.069311]  c00c35d0 0001 
c00c3580
 [ 240.069316] Call Trace:
 [ 240.069328] [] schedule+0x29/0x70
 [ 240.069334] [] async_synchronize_cookie_domain+0x85/0x150
 [ 240.069340] [] ? wake_up_atomic_t+0x30/0x30
 [ 240.069346] [] async_synchronize_full+0x17/0x20
 [ 240.069351] [] load_module+0x1fc0/0x29e0
 [ 240.069358] [] ? ddebug_proc_write+0xf0/0xf0
 [ 240.069365] [] SyS_init_module+0xc5/0x110
 [ 240.069371] [] system_call_fastpath+0x16/0x1b  

Thanks,
Mahesh




[PATCH v2 1/1] aacraid: pci_alloc_consistent() failures on ARM64

2017-04-05 Thread Mahesh Rajashekhara
There were pci_alloc_consistent() failures on ARM64 platform.
Use dma_alloc_coherent() with GFP_KERNEL flag DMA memory allocations.

Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekh...@microsemi.com>
---
v2:
 - Removed platform specific MACRO and call dma_*_coherent routines directly.
 - Removed all the casts to and from void * in the arguments and return values 

 drivers/scsi/aacraid/aachba.c   | 23 ++-
 drivers/scsi/aacraid/commctrl.c | 11 +--
 drivers/scsi/aacraid/comminit.c |  6 +-
 drivers/scsi/aacraid/commsup.c  | 30 +-
 drivers/scsi/aacraid/linit.c| 12 
 drivers/scsi/aacraid/rx.c   | 28 +---
 6 files changed, 82 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index e3e93de..e89fe09 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1678,11 +1678,15 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 
bus, u32 target)
sizeof(struct sgentry) + sizeof(struct sgentry64);
datasize = sizeof(struct aac_ciss_identify_pd);
 
-   identify_resp =  pci_alloc_consistent(dev->pdev, datasize, );
+   identify_resp = dma_alloc_coherent(>pdev->dev,
+  datasize,
+  ,
+  GFP_KERNEL);
 
if (!identify_resp)
goto fib_free_ptr;
 
+   memset(identify_resp, 0, datasize);
vbus = (u32)le16_to_cpu(dev->supplement_adapter_info.virt_device_bus);
vid = (u32)le16_to_cpu(dev->supplement_adapter_info.virt_device_target);
 
@@ -1720,7 +1724,10 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 
bus, u32 target)
dev->hba_map[bus][target].qd_limit =
identify_resp->current_queue_depth_limit;
 
-   pci_free_consistent(dev->pdev, datasize, (void *)identify_resp, addr);
+   dma_free_coherent(>pdev->dev,
+ datasize,
+ identify_resp,
+ addr);
 
aac_fib_complete(fibptr);
 
@@ -1814,14 +1821,17 @@ int aac_report_phys_luns(struct aac_dev *dev, struct 
fib *fibptr, int rescan)
datasize = sizeof(struct aac_ciss_phys_luns_resp)
+ (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun);
 
-   phys_luns = (struct aac_ciss_phys_luns_resp *) pci_alloc_consistent(
-   dev->pdev, datasize, );
+   phys_luns = dma_alloc_coherent(>pdev->dev,
+  datasize,
+  ,
+  GFP_KERNEL);
 
if (phys_luns == NULL) {
rcode = -ENOMEM;
goto err_out;
}
 
+   memset(phys_luns, 0, datasize);
vbus = (u32) le16_to_cpu(
dev->supplement_adapter_info.virt_device_bus);
vid = (u32) le16_to_cpu(
@@ -1861,7 +1871,10 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib 
*fibptr, int rescan)
aac_update_hba_map(dev, phys_luns, rescan);
}
 
-   pci_free_consistent(dev->pdev, datasize, (void *) phys_luns, addr);
+   dma_free_coherent(>pdev->dev,
+ datasize,
+ phys_luns,
+ addr);
 err_out:
return rcode;
 }
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index f6afd50..93df1d1 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -100,12 +100,16 @@ static int ioctl_send_fib(struct aac_dev * dev, void 
__user *arg)
goto cleanup;
}
 
-   kfib = pci_alloc_consistent(dev->pdev, size, );
+   kfib = dma_alloc_coherent(>pdev->dev,
+ size,
+ ,
+ GFP_KERNEL);
if (!kfib) {
retval = -ENOMEM;
goto cleanup;
}
 
+   memset(kfib, 0, size);
/* Highjack the hw_fib */
hw_fib = fibptr->hw_fib_va;
hw_fib_pa = fibptr->hw_fib_pa;
@@ -160,7 +164,10 @@ static int ioctl_send_fib(struct aac_dev * dev, void 
__user *arg)
retval = -EFAULT;
 cleanup:
if (hw_fib) {
-   pci_free_consistent(dev->pdev, size, kfib, fibptr->hw_fib_pa);
+   dma_free_coherent(>pdev->dev,
+ size,
+ kfib,
+ fibptr->hw_fib_pa);
fibptr->hw_fib_pa = hw_fib_pa;
fibptr->hw_fib_va = hw_fib;
}
diff --g

[PATCH 1/1] aacraid: pci_alloc_consistent() failures on ARM64

2017-04-04 Thread Mahesh Rajashekhara
There were pci_alloc_consistent() failures on ARM64 platform.
Use dma_alloc_coherent() with GFP_KERNEL flag DMA memory allocations.

Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekh...@microsemi.com>
---
 drivers/scsi/aacraid/aachba.c   | 13 +
 drivers/scsi/aacraid/aacraid.h  | 22 ++
 drivers/scsi/aacraid/commctrl.c |  7 +--
 drivers/scsi/aacraid/comminit.c |  4 ++--
 drivers/scsi/aacraid/commsup.c  | 16 ++--
 drivers/scsi/aacraid/linit.c|  8 +---
 drivers/scsi/aacraid/rx.c   | 11 ++-
 7 files changed, 59 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index e3e93de..d07da1a 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -1678,11 +1678,12 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 
bus, u32 target)
sizeof(struct sgentry) + sizeof(struct sgentry64);
datasize = sizeof(struct aac_ciss_identify_pd);
 
-   identify_resp =  pci_alloc_consistent(dev->pdev, datasize, );
+   identify_resp =  aac_pci_alloc_consistent(dev->pdev, datasize, );
 
if (!identify_resp)
goto fib_free_ptr;
 
+   memset(identify_resp, 0, datasize);
vbus = (u32)le16_to_cpu(dev->supplement_adapter_info.virt_device_bus);
vid = (u32)le16_to_cpu(dev->supplement_adapter_info.virt_device_target);
 
@@ -1720,7 +1721,10 @@ int aac_issue_bmic_identify(struct aac_dev *dev, u32 
bus, u32 target)
dev->hba_map[bus][target].qd_limit =
identify_resp->current_queue_depth_limit;
 
-   pci_free_consistent(dev->pdev, datasize, (void *)identify_resp, addr);
+   aac_pci_free_consistent(dev->pdev,
+   datasize,
+   (void *)identify_resp,
+   addr);
 
aac_fib_complete(fibptr);
 
@@ -1814,7 +1818,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib 
*fibptr, int rescan)
datasize = sizeof(struct aac_ciss_phys_luns_resp)
+ (AAC_MAX_TARGETS - 1) * sizeof(struct _ciss_lun);
 
-   phys_luns = (struct aac_ciss_phys_luns_resp *) pci_alloc_consistent(
+   phys_luns = (struct aac_ciss_phys_luns_resp *) aac_pci_alloc_consistent(
dev->pdev, datasize, );
 
if (phys_luns == NULL) {
@@ -1822,6 +1826,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib 
*fibptr, int rescan)
goto err_out;
}
 
+   memset(phys_luns, 0, datasize);
vbus = (u32) le16_to_cpu(
dev->supplement_adapter_info.virt_device_bus);
vid = (u32) le16_to_cpu(
@@ -1861,7 +1866,7 @@ int aac_report_phys_luns(struct aac_dev *dev, struct fib 
*fibptr, int rescan)
aac_update_hba_map(dev, phys_luns, rescan);
}
 
-   pci_free_consistent(dev->pdev, datasize, (void *) phys_luns, addr);
+   aac_pci_free_consistent(dev->pdev, datasize, (void *) phys_luns, addr);
 err_out:
return rcode;
 }
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index d036a80..12121d6 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2692,4 +2692,26 @@ extern int update_interval;
 extern int check_interval;
 extern int aac_check_reset;
 extern int aac_fib_dump;
+#if defined(CONFIG_ARM64)
+static inline void *
+aac_pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
+dma_addr_t *dma_handle) {
+   return dma_alloc_coherent(hwdev == NULL ? NULL : >dev,
+ size,
+ dma_handle,
+ GFP_KERNEL);
+}
+#else
+static inline void *
+aac_pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
+dma_addr_t *dma_handle) {
+   return pci_alloc_consistent(hwdev, size, dma_handle);
+}
+#endif
+static inline void
+aac_pci_free_consistent(struct pci_dev *hwdev, size_t size,
+   void *vaddr, dma_addr_t dma_handle)
+{
+   pci_free_consistent(hwdev, size, vaddr, dma_handle);
+}
 #endif
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index f6afd50..7d1757a 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -100,12 +100,13 @@ static int ioctl_send_fib(struct aac_dev * dev, void 
__user *arg)
goto cleanup;
}
 
-   kfib = pci_alloc_consistent(dev->pdev, size, );
+   kfib = aac_pci_alloc_consistent(dev->pdev, size, );
if (!kfib) {
retval = -ENOMEM;
goto cleanup;
}
 
+   memset(kfib, 0, size);
/* Highjack the hw_fib */
hw_fib = fibptr->hw_fib_va;
 

RE: [RFC PATCH scsi] aacraid: aac_release_resources() can be static

2015-11-24 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara <mahesh.rajashekh...@pmcs.com>

-Original Message-
From: kbuild test robot [mailto:fengguang...@intel.com] 
Sent: Tuesday, November 10, 2015 11:29 AM
To: Mahesh Rajashekhara
Cc: kbuild-...@01.org; linux-scsi@vger.kernel.org; James Bottomley; Tomas 
Henzl; Murthy Bhat; Karthikeya Sunkesula
Subject: [RFC PATCH scsi] aacraid: aac_release_resources() can be static


Signed-off-by: Fengguang Wu <fengguang...@intel.com>
---
 linit.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 
37375cf..7724583f 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1318,7 +1318,7 @@ static int aac_probe_one(struct pci_dev *pdev, const 
struct pci_device_id *id)  }
 
 #if (defined(CONFIG_PM))
-void aac_release_resources(struct aac_dev *aac)
+static void aac_release_resources(struct aac_dev *aac)
 {
int i;
 
--
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 V8 9/9] aacraid: Update driver version

2015-09-29 Thread Mahesh Rajashekhara
Hi James,

Can you please let me know the status of V8 patch set.

Thanks,
Mahesh


-Original Message-
From: Mahesh Rajashekhara 
Sent: Wednesday, September 09, 2015 6:51 PM
To: Mahesh Rajashekhara; jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: the...@redhat.com; Murthy Bhat; Karthikeya Sunkesula; 
aacr...@pmc-sierra.com; Harry Yang; Rich Bono
Subject: RE: [PATCH V8 9/9] aacraid: Update driver version

Hi James,

Please let me know the status of V8 patchset.

Thanks,
Mahesh

-Original Message-
From: Mahesh Rajashekhara [mailto:mahesh.rajashekh...@pmcs.com] 
Sent: Friday, August 28, 2015 4:09 PM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: the...@redhat.com; Murthy Bhat; Karthikeya Sunkesula; 
aacr...@pmc-sierra.com; Harry Yang; Rich Bono
Subject: [PATCH V8 9/9] aacraid: Update driver version

Reviewed-by: Tomas Henzl <the...@redhat.com>
Reviewed-by: Murthy Bhat <murthy.b...@pmcs.com>
Reviewed-by: Karthikeya Sunkesula <karthikeya.sunkes...@pmcs.com>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekh...@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 2de5ebc..074878b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
--
1.9.3

--
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 V8 9/9] aacraid: Update driver version

2015-09-09 Thread Mahesh Rajashekhara
Hi James,

Please let me know the status of V8 patchset.

Thanks,
Mahesh

-Original Message-
From: Mahesh Rajashekhara [mailto:mahesh.rajashekh...@pmcs.com] 
Sent: Friday, August 28, 2015 4:09 PM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: the...@redhat.com; Murthy Bhat; Karthikeya Sunkesula; 
aacr...@pmc-sierra.com; Harry Yang; Rich Bono
Subject: [PATCH V8 9/9] aacraid: Update driver version

Reviewed-by: Tomas Henzl <the...@redhat.com>
Reviewed-by: Murthy Bhat <murthy.b...@pmcs.com>
Reviewed-by: Karthikeya Sunkesula <karthikeya.sunkes...@pmcs.com>
Signed-off-by: Mahesh Rajashekhara <mahesh.rajashekh...@pmcs.com>
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 2de5ebc..074878b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
--
1.9.3

--
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 V8 3/9] aacraid: Change interrupt mode to MSI for Series 6

2015-08-28 Thread Mahesh Rajashekhara
This change always sets MSI interrupt mode for series-6 controller.

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V2:
aac_msi option description and subject change.
 drivers/scsi/aacraid/aachba.c | 2 +-
 drivers/scsi/aacraid/src.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index fe59b00..05f2a02 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -259,7 +259,7 @@ MODULE_PARM_DESC(commit, Control whether a COMMIT_CONFIG 
is issued to the
 0=off, 1=on);
 module_param_named(msi, aac_msi, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(msi, IRQ handling.
-0=PIC(default), 1=MSI, 2=MSI-X(unsupported, uses MSI));
+0=PIC(default), 1=MSI, 2=MSI-X));
 module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(startup_timeout, The duration of time in seconds to wait for
 adapter to have it's kernel up and\n
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index b147341..eb07b3d 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
if (dev-comm_interface != AAC_COMM_MESSAGE_TYPE1)
goto error_iounmap;
 
-   dev-msi = aac_msi  !pci_enable_msi(dev-pdev);
+   dev-msi = !pci_enable_msi(dev-pdev);
 
dev-aac_msix[0].vector_no = 0;
dev-aac_msix[0].dev = dev;
-- 
1.9.3

--
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 V8 9/9] aacraid: Update driver version

2015-08-28 Thread Mahesh Rajashekhara
Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 2de5ebc..074878b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
-- 
1.9.3

--
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 V8 7/9] aacraid: IOCTL fix

2015-08-28 Thread Mahesh Rajashekhara
Driver blocks ioctls once it received shutdown/suspend request during
suspend/hybernation. This patch unblocks ioctls on resume path.

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V2:
None
 drivers/scsi/aacraid/linit.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 37375cf..3b6e5c6 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1448,6 +1448,11 @@ static int aac_resume(struct pci_dev *pdev)
pci_set_master(pdev);
if (aac_acquire_resources(aac))
goto fail_device;
+   /*
+   * reset this flag to unblock ioctl() as it was set at
+   * aac_send_shutdown() to block ioctls from upperlayer
+   */
+   aac-adapter_shutdown = 0;
scsi_unblock_requests(shost);
 
return 0;
-- 
1.9.3

--
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 V8 6/9] aacraid: Reset irq affinity hints

2015-08-28 Thread Mahesh Rajashekhara
Reset irq affinity hints before releasing IRQ.
Removed duplicate code of IRQ acquire/release.

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V2:
None
 drivers/scsi/aacraid/aacraid.h |   2 +
 drivers/scsi/aacraid/commsup.c | 113 ++---
 drivers/scsi/aacraid/src.c |  48 ++---
 3 files changed, 88 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index e54f597..7b95227 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2110,6 +2110,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, 
unsigned divisor)
 #define AAC_OWNER_ERROR_HANDLER0x103
 #define AAC_OWNER_FIRMWARE 0x106
 
+int aac_acquire_irq(struct aac_dev *dev);
+void aac_free_irq(struct aac_dev *dev);
 const char *aac_driverinfo(struct Scsi_Host *);
 struct fib *aac_fib_alloc(struct aac_dev *dev);
 int aac_fib_setup(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 4da5749..a1f90fe 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1270,13 +1270,12 @@ retry_next:
 static int _aac_reset_adapter(struct aac_dev *aac, int forced)
 {
int index, quirks;
-   int retval, i;
+   int retval;
struct Scsi_Host *host;
struct scsi_device *dev;
struct scsi_cmnd *command;
struct scsi_cmnd *command_list;
int jafo = 0;
-   int cpu;
 
/*
 * Assumptions:
@@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int 
forced)
aac-comm_phys = 0;
kfree(aac-queues);
aac-queues = NULL;
-   cpu = cpumask_first(cpu_online_mask);
-   if (aac-pdev-device == PMC_DEVICE_S6 ||
-   aac-pdev-device == PMC_DEVICE_S7 ||
-   aac-pdev-device == PMC_DEVICE_S8 ||
-   aac-pdev-device == PMC_DEVICE_S9) {
-   if (aac-max_msix  1) {
-   for (i = 0; i  aac-max_msix; i++) {
-   if (irq_set_affinity_hint(
-   aac-msixentry[i].vector,
-   NULL)) {
-   printk(KERN_ERR %s%d: Failed to reset 
IRQ affinity for cpu %d\n,
-   aac-name,
-   aac-id,
-   cpu);
-   }
-   cpu = cpumask_next(cpu,
-   cpu_online_mask);
-   free_irq(aac-msixentry[i].vector,
-(aac-aac_msix[i]));
-   }
-   pci_disable_msix(aac-pdev);
-   } else {
-   free_irq(aac-pdev-irq, (aac-aac_msix[0]));
-   }
-   } else {
-   free_irq(aac-pdev-irq, aac);
-   }
-   if (aac-msi)
-   pci_disable_msi(aac-pdev);
+   aac_free_irq(aac);
kfree(aac-fsa_dev);
aac-fsa_dev = NULL;
quirks = aac_get_driver_ident(index)-quirks;
@@ -1978,3 +1949,83 @@ int aac_command_thread(void *data)
dev-aif_thread = 0;
return 0;
 }
+
+int aac_acquire_irq(struct aac_dev *dev)
+{
+   int i;
+   int j;
+   int ret = 0;
+   int cpu;
+
+   cpu = cpumask_first(cpu_online_mask);
+   if (!dev-sync_mode  dev-msi_enabled  dev-max_msix  1) {
+   for (i = 0; i  dev-max_msix; i++) {
+   dev-aac_msix[i].vector_no = i;
+   dev-aac_msix[i].dev = dev;
+   if (request_irq(dev-msixentry[i].vector,
+   dev-a_ops.adapter_intr,
+   0, aacraid, (dev-aac_msix[i]))) {
+   printk(KERN_ERR %s%d: Failed to register IRQ 
for vector %d.\n,
+   dev-name, dev-id, i);
+   for (j = 0 ; j  i ; j++)
+   free_irq(dev-msixentry[j].vector,
+(dev-aac_msix[j]));
+   pci_disable_msix(dev-pdev);
+   ret = -1;
+   }
+   if (irq_set_affinity_hint(dev-msixentry[i].vector,
+   get_cpu_mask(cpu))) {
+   printk(KERN_ERR %s%d: Failed to set IRQ 
affinity for cpu %d\n,
+   dev-name, dev-id, cpu);
+   }
+   cpu = cpumask_next(cpu

[PATCH V8 5/9] aacraid: Tune response path if IsFastPath bit set

2015-08-28 Thread Mahesh Rajashekhara
If 'IsFastPath' bit is set, then response path assumes no error and skips error 
check.

Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V2:
None
 drivers/scsi/aacraid/aachba.c | 259 ++
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 05f2a02..e4c2437 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib 
* fibptr)
return;
 
BUG_ON(fibptr == NULL);
-
dev = fibptr-dev;
 
-   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+   scsi_dma_unmap(scsicmd);
 
+   /* expose physical device if expose_physicald flag is on */
+   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
+  expose_physicals  0)
+   aac_expose_phy_device(scsicmd);
+
+   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
scsicmd-sense_buffer[0] = '\0';  /* Initialize sense valid flag to 
false */
 
if (fibptr-flags  FIB_CONTEXT_FLAG_FASTRESP) {
@@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct 
fib * fibptr)
 */
scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
   - le32_to_cpu(srbreply-data_xfer_length));
-   }
-
-   scsi_dma_unmap(scsicmd);
-
-   /* expose physical device if expose_physicald flag is on */
-   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
-  expose_physicals  0)
-   aac_expose_phy_device(scsicmd);
+   /*
+* First check the fib status
+*/
 
-   /*
-* First check the fib status
-*/
+   if (le32_to_cpu(srbreply-status) != ST_OK) {
+   int len;
 
-   if (le32_to_cpu(srbreply-status) != ST_OK){
-   int len;
-   printk(KERN_WARNING aac_srb_callback: srb failed, status = 
%d\n, le32_to_cpu(srbreply-status));
-   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
-   SCSI_SENSE_BUFFERSIZE);
-   scsicmd-result = DID_ERROR  16 | COMMAND_COMPLETE  8 | 
SAM_STAT_CHECK_CONDITION;
-   memcpy(scsicmd-sense_buffer, srbreply-sense_data, len);
-   }
+   printk(KERN_WARNING aac_srb_callback: srb failed, 
status = %d\n, le32_to_cpu(srbreply-status));
+   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
+   SCSI_SENSE_BUFFERSIZE);
+   scsicmd-result = DID_ERROR  16
+   | COMMAND_COMPLETE  8
+   | SAM_STAT_CHECK_CONDITION;
+   memcpy(scsicmd-sense_buffer,
+   srbreply-sense_data, len);
+   }
 
-   /*
-* Next check the srb status
-*/
-   switch( (le32_to_cpu(srbreply-srb_status))0x3f){
-   case SRB_STATUS_ERROR_RECOVERY:
-   case SRB_STATUS_PENDING:
-   case SRB_STATUS_SUCCESS:
-   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
-   break;
-   case SRB_STATUS_DATA_OVERRUN:
-   switch(scsicmd-cmnd[0]){
-   case  READ_6:
-   case  WRITE_6:
-   case  READ_10:
-   case  WRITE_10:
-   case  READ_12:
-   case  WRITE_12:
-   case  READ_16:
-   case  WRITE_16:
-   if (le32_to_cpu(srbreply-data_xfer_length)  
scsicmd-underflow) {
-   printk(KERN_WARNINGaacraid: SCSI CMD 
underflow\n);
-   } else {
-   printk(KERN_WARNINGaacraid: SCSI CMD Data 
Overrun\n);
+   /*
+* Next check the srb status
+*/
+   switch ((le32_to_cpu(srbreply-srb_status))0x3f) {
+   case SRB_STATUS_ERROR_RECOVERY:
+   case SRB_STATUS_PENDING:
+   case SRB_STATUS_SUCCESS:
+   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
+   break;
+   case SRB_STATUS_DATA_OVERRUN:
+   switch (scsicmd-cmnd[0]) {
+   case  READ_6:
+   case  WRITE_6:
+   case  READ_10:
+   case  WRITE_10:
+   case  READ_12:
+   case  WRITE_12:
+   case  READ_16:
+   case  WRITE_16:
+   if (le32_to_cpu(srbreply-data_xfer_length

[PATCH V8 4/9] aacraid: Enable 64bit write to controller register

2015-08-28 Thread Mahesh Rajashekhara
If writeq() not supported, then do atomic two 32bit write

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V2:
None
 drivers/scsi/aacraid/aacraid.h  |  9 +
 drivers/scsi/aacraid/comminit.c |  1 +
 drivers/scsi/aacraid/src.c  | 12 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 62b0999..e54f597 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -844,6 +844,10 @@ struct src_registers {
((AEP)-regs.src.bar0-CSR))
 #define src_writel(AEP, CSR, value)writel(value, \
((AEP)-regs.src.bar0-CSR))
+#if defined(writeq)
+#definesrc_writeq(AEP, CSR, value) writeq(value, \
+   ((AEP)-regs.src.bar0-CSR))
+#endif
 
 #define SRC_ODR_SHIFT  12
 #define SRC_IDR_SHIFT  9
@@ -1163,6 +1167,11 @@ struct aac_dev
struct fsa_dev_info *fsa_dev;
struct task_struct  *thread;
int cardtype;
+   /*
+*This lock will protect the two 32-bit
+*writes to the Inbound Queue
+*/
+   spinlock_t  iq_lock;
 
/*
 *  The following is the device specific extension.
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45a0a04..b4b6088 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
dev-management_fib_count = 0;
spin_lock_init(dev-manage_lock);
spin_lock_init(dev-sync_lock);
+   spin_lock_init(dev-iq_lock);
dev-max_fib_size = sizeof(struct hw_fib);
dev-sg_tablesize = host-sg_tablesize = (dev-max_fib_size
- sizeof(struct aac_fibhdr)
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index eb07b3d..1409a0b 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
u32 fibsize;
dma_addr_t address;
struct aac_fib_xporthdr *pFibX;
+#if !defined(writeq)
+   unsigned long flags;
+#endif
+
u16 hdr_size = le16_to_cpu(fib-hw_fib_va-header.Size);
 
atomic_inc(q-numpending);
@@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
return -EINVAL;
address |= fibsize;
}
-
+#if defined(writeq)
+   src_writeq(dev, MUnit.IQ_L, (u64)address);
+#else
+   spin_lock_irqsave(fib-dev-iq_lock, flags);
src_writel(dev, MUnit.IQ_H, upper_32_bits(address)  0x);
src_writel(dev, MUnit.IQ_L, address  0x);
-
+   spin_unlock_irqrestore(fib-dev-iq_lock, flags);
+#endif
return 0;
 }
 
-- 
1.9.3

--
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 V8 8/9] aacraid: Use pci_enable_msix_range()

2015-08-28 Thread Mahesh Rajashekhara
As pci_enable_msix() deprecated, replaced with pci_enable_msix_range()

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V5:
Merged 10 and 11 of V5 into this patch.
AAC_MAX_MSIX definition change.
 drivers/scsi/aacraid/aacraid.h  |  2 +-
 drivers/scsi/aacraid/comminit.c | 20 ++--
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 7b95227..2de5ebc 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  *  D E F I N E S
  
**/
 
-#define AAC_MAX_MSIX   8   /* vectors */
+#define AAC_MAX_MSIX   32  /* vectors */
 #define AAC_PCI_MSI_ENABLE 0x8000
 
 enum {
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index b4b6088..0e954e3 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
 
 void aac_define_int_mode(struct aac_dev *dev)
 {
-   int i, msi_count;
+   int i, msi_count, min_msix;
 
msi_count = i = 0;
/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
@@ -366,22 +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
 
if (msi_count  1 
pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
-   i = pci_enable_msix(dev-pdev,
+   min_msix = 2;
+   i = pci_enable_msix_range(dev-pdev,
dev-msixentry,
+   min_msix,
msi_count);
-/* Check how many MSIX vectors are allocated */
-   if (i = 0) {
+   if (i  0) {
dev-msi_enabled = 1;
-   if (i) {
-   msi_count = i;
-   if (pci_enable_msix(dev-pdev,
-   dev-msixentry,
-   msi_count)) {
-   dev-msi_enabled = 0;
-   printk(KERN_ERR %s%d: MSIX not 
supported!! Will try MSI 0x%x.\n,
-   dev-name, dev-id, i);
-   }
-   }
+   msi_count = i;
} else {
dev-msi_enabled = 0;
printk(KERN_ERR %s%d: MSIX not supported!! Will try 
MSI 0x%x.\n,
-- 
1.9.3

--
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 V8 1/9] aacraid: Fix for LD name and UID not exposed to OS

2015-08-28 Thread Mahesh Rajashekhara
Driver sends the right size of the response buffer.

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
Changes from V2:
None
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_name),
+ sizeof(struct aac_get_name_resp),
  FsaNormal,
  0, 1,
  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_serial),
+ sizeof(struct aac_get_serial_resp),
  FsaNormal,
  0, 1,
  (fib_callback) get_container_serial_callback,
-- 
1.9.3

--
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 V7 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

2015-08-28 Thread Mahesh Rajashekhara
Hi James,

I have taken care your review comments in V8 patch series.

Thanks,
Mahesh


-Original Message-
From: James Bottomley [mailto:james.bottom...@hansenpartnership.com] 
Sent: Thursday, August 27, 2015 8:38 PM
To: Mahesh Rajashekhara
Cc: jbottom...@parallels.com; linux-scsi@vger.kernel.org; the...@redhat.com; 
Murthy Bhat; Karthikeya Sunkesula; aacr...@pmc-sierra.com; Harry Yang; Rich Bono
Subject: Re: [PATCH V7 1/9] [SCSI] aacraid: Fix for logical device name and UID 
not exposed to the OS

On Thu, 2015-08-27 at 06:50 -0400, Mahesh Rajashekhara wrote:
 Description:
   Driver sends the right size of the response buffer.
 
 Changes from V2:
 None
 
 Reviewed By: Tomas Henzl the...@redhat.com, Murthy Bhat 
 murthy.b...@pmcs.com, Karthikeya Sunkesula 
 karthikeya.sunkes...@pmcs.com
 
 Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com

You've had hundreds of upstream confirmation emails over the years.
They've all had one line per tag with no spaces.  Next time can we please use 
the right format so I don't have to keep editing your commit messages.  That is:

Subject: One line summary

Detailed Description of the change (without a Description: prefix)

Reviewed-by: Tomas Henzl the...@redhat.com
Reviewed-by: Murthy Bhat murthy.b...@pmcs.com
Reviewed-by: Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com

---

Version notices and other context relevant only to the upstream process come 
here after the three dashes so it doesn't appear in the patch detailed 
description

James
 



[PATCH V8 0/9] aacraid: Patchset for aacraid driver version 41010

2015-08-28 Thread Mahesh Rajashekhara
This patchset includes the following changes (bug fixes and new feature 
support) specific to aacraid driver.

V8:
Right format for commit messages.

V7:
Removed patch 08 of V6.
Keep the review-tags going V6-V7.

V6:
Applied driver update change at the end.
Merged 10 and 11 of V5 into 9 of V6.
AAC_MAX_MSIX definition change.
aac_msi option description and subject change.
Removed 'reviewed-by' tag.

V5:
Splited patch 10 from V4 into 2
Added one more patch to request minimum 2 MSIx.

V4:
Updated code with pci_enable_msix_range instead of exact.

V3:
Increased msleep() time from 1 to 20.
Created new patch for pci_enable_msix() replacement.
Changed subject/description of patch 03.

Mahesh Rajashekhara (9):
  aacraid: Fix for LD name and UID not exposed to OS
  aacraid: Add Power Management support
  aacraid: Change interrupt mode to MSI for Series 6
  aacraid: Enable 64bit write to controller register
  aacraid: Tune response path if IsFastPath bit set
  aacraid: Reset irq affinity hints
  aacraid: IOCTL fix
  aacraid: Use pci_enable_msix_range()
  aacraid: Update driver version

 drivers/scsi/aacraid/aachba.c   | 265 +---
 drivers/scsi/aacraid/aacraid.h  |  20 ++-
 drivers/scsi/aacraid/comminit.c | 147 +++---
 drivers/scsi/aacraid/commsup.c  | 113 -
 drivers/scsi/aacraid/linit.c| 152 +++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |  64 +++---
 8 files changed, 480 insertions(+), 283 deletions(-)

-- 
1.9.3

--
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 V6 08/10] [SCSI] aacraid: Send commit-config to controller firmware

2015-08-27 Thread Mahesh Rajashekhara
Hi Christoph, Hi Tomas,

After discussed internally, this driver patch is required only if auto commit 
support is not available in the controller firmware.  

We have fix in the released controller firmware, so this driver patch is not 
needed. 

I'm removing this patch in V7.

Hi James,

As you suggested, will keep the review-tags going V6-V7 and add reviewers in 
CC list.

Thanks,
Mahesh

-Original Message-
From: Christoph Hellwig [mailto:h...@infradead.org] 
Sent: Tuesday, August 25, 2015 8:41 PM
To: Tomas Henzl
Cc: Mahesh Rajashekhara; jbottom...@parallels.com; linux-scsi@vger.kernel.org; 
aacr...@pmc-sierra.com; Harry Yang; Rich Bono
Subject: Re: [PATCH V6 08/10] [SCSI] aacraid: Send commit-config to controller 
firmware

On Tue, Aug 25, 2015 at 04:57:26PM +0200, Tomas Henzl wrote:
 On 11.8.2015 07:58, Mahesh Rajashekhara wrote:
  +#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
  +   aac_get_config_status(aac, 1);
  +#else
  aac_get_config_status(aac, 0);
  +#endif
 
 If we use instead
 + aac_get_config_status(aac, 1);
 on all archs will it make problems ?

Yes, that should be our first choice.  If that doesn't work it should be a 
#ifndef CONFIG_X86 with a comment explaining 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


[PATCH V7 8/9] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-08-27 Thread Mahesh Rajashekhara
Description:
As pci_enable_msix() deprecated, replaced with pci_enable_msix_range()

Changes from V5:
Merged 10 and 11 of V5 into this patch.
AAC_MAX_MSIX definition change.

Reviewed-by: Tomas Henzl the...@redhat.com, Murthy Bhat 
murthy.b...@pmcs.com, Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |  2 +-
 drivers/scsi/aacraid/comminit.c | 20 ++--
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 7b95227..2de5ebc 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  *  D E F I N E S
  
**/
 
-#define AAC_MAX_MSIX   8   /* vectors */
+#define AAC_MAX_MSIX   32  /* vectors */
 #define AAC_PCI_MSI_ENABLE 0x8000
 
 enum {
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index b4b6088..0e954e3 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
 
 void aac_define_int_mode(struct aac_dev *dev)
 {
-   int i, msi_count;
+   int i, msi_count, min_msix;
 
msi_count = i = 0;
/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
@@ -366,22 +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
 
if (msi_count  1 
pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
-   i = pci_enable_msix(dev-pdev,
+   min_msix = 2;
+   i = pci_enable_msix_range(dev-pdev,
dev-msixentry,
+   min_msix,
msi_count);
-/* Check how many MSIX vectors are allocated */
-   if (i = 0) {
+   if (i  0) {
dev-msi_enabled = 1;
-   if (i) {
-   msi_count = i;
-   if (pci_enable_msix(dev-pdev,
-   dev-msixentry,
-   msi_count)) {
-   dev-msi_enabled = 0;
-   printk(KERN_ERR %s%d: MSIX not 
supported!! Will try MSI 0x%x.\n,
-   dev-name, dev-id, i);
-   }
-   }
+   msi_count = i;
} else {
dev-msi_enabled = 0;
printk(KERN_ERR %s%d: MSIX not supported!! Will try 
MSI 0x%x.\n,
-- 
1.9.3

--
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 V7 9/9] [SCSI] aacraid: Update driver version

2015-08-27 Thread Mahesh Rajashekhara
Reviewed-by: Tomas Henzl the...@redhat.com, Murthy Bhat 
murthy.b...@pmcs.com, Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 2de5ebc..074878b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
-- 
1.9.3

--
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 V7 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set

2015-08-27 Thread Mahesh Rajashekhara
Description:
If 'IsFastPath' bit is set, then response path assumes no error and 
skips error check.

Changes from V2:
None

Reviewed-by: Murthy Bhat murthy.b...@pmcs.com, Karthikeya Sunkesula 
karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 259 ++
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 05f2a02..e4c2437 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib 
* fibptr)
return;
 
BUG_ON(fibptr == NULL);
-
dev = fibptr-dev;
 
-   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+   scsi_dma_unmap(scsicmd);
 
+   /* expose physical device if expose_physicald flag is on */
+   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
+  expose_physicals  0)
+   aac_expose_phy_device(scsicmd);
+
+   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
scsicmd-sense_buffer[0] = '\0';  /* Initialize sense valid flag to 
false */
 
if (fibptr-flags  FIB_CONTEXT_FLAG_FASTRESP) {
@@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct 
fib * fibptr)
 */
scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
   - le32_to_cpu(srbreply-data_xfer_length));
-   }
-
-   scsi_dma_unmap(scsicmd);
-
-   /* expose physical device if expose_physicald flag is on */
-   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
-  expose_physicals  0)
-   aac_expose_phy_device(scsicmd);
+   /*
+* First check the fib status
+*/
 
-   /*
-* First check the fib status
-*/
+   if (le32_to_cpu(srbreply-status) != ST_OK) {
+   int len;
 
-   if (le32_to_cpu(srbreply-status) != ST_OK){
-   int len;
-   printk(KERN_WARNING aac_srb_callback: srb failed, status = 
%d\n, le32_to_cpu(srbreply-status));
-   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
-   SCSI_SENSE_BUFFERSIZE);
-   scsicmd-result = DID_ERROR  16 | COMMAND_COMPLETE  8 | 
SAM_STAT_CHECK_CONDITION;
-   memcpy(scsicmd-sense_buffer, srbreply-sense_data, len);
-   }
+   printk(KERN_WARNING aac_srb_callback: srb failed, 
status = %d\n, le32_to_cpu(srbreply-status));
+   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
+   SCSI_SENSE_BUFFERSIZE);
+   scsicmd-result = DID_ERROR  16
+   | COMMAND_COMPLETE  8
+   | SAM_STAT_CHECK_CONDITION;
+   memcpy(scsicmd-sense_buffer,
+   srbreply-sense_data, len);
+   }
 
-   /*
-* Next check the srb status
-*/
-   switch( (le32_to_cpu(srbreply-srb_status))0x3f){
-   case SRB_STATUS_ERROR_RECOVERY:
-   case SRB_STATUS_PENDING:
-   case SRB_STATUS_SUCCESS:
-   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
-   break;
-   case SRB_STATUS_DATA_OVERRUN:
-   switch(scsicmd-cmnd[0]){
-   case  READ_6:
-   case  WRITE_6:
-   case  READ_10:
-   case  WRITE_10:
-   case  READ_12:
-   case  WRITE_12:
-   case  READ_16:
-   case  WRITE_16:
-   if (le32_to_cpu(srbreply-data_xfer_length)  
scsicmd-underflow) {
-   printk(KERN_WARNINGaacraid: SCSI CMD 
underflow\n);
-   } else {
-   printk(KERN_WARNINGaacraid: SCSI CMD Data 
Overrun\n);
+   /*
+* Next check the srb status
+*/
+   switch ((le32_to_cpu(srbreply-srb_status))0x3f) {
+   case SRB_STATUS_ERROR_RECOVERY:
+   case SRB_STATUS_PENDING:
+   case SRB_STATUS_SUCCESS:
+   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
+   break;
+   case SRB_STATUS_DATA_OVERRUN:
+   switch (scsicmd-cmnd[0]) {
+   case  READ_6:
+   case  WRITE_6:
+   case  READ_10:
+   case  WRITE_10:
+   case  READ_12:
+   case  WRITE_12:
+   case  READ_16:
+   case  WRITE_16:
+   if (le32_to_cpu(srbreply-data_xfer_length

[PATCH V7 0/9] [SCSI] aacraid: Patchset for aacraid driver version 41010

2015-08-27 Thread Mahesh Rajashekhara
This patchset includes the following changes (bug fixes and new feature 
support) specific to aacraid driver.

V7:
Removed patch 08 of V6.
Keep the review-tags going V6-V7.

V6:
Applied driver update change at the end.
Merged 10 and 11 of V5 into 9 of V6.
AAC_MAX_MSIX definition change.
aac_msi option description and subject change.
Removed 'reviewed-by' tag.

V5:
Splited patch 10 from V4 into 2
Added one more patch to request minimum 2 MSIx.

V4:
Updated code with pci_enable_msix_range instead of exact.

V3:
Increased msleep() time from 1 to 20.
Created new patch for pci_enable_msix() replacement.
Changed subject/description of patch 03.

Mahesh Rajashekhara (9):
  [SCSI] aacraid: Fix for logical device name and UID not exposed to the
OS
  [SCSI] aacraid: Add Power Management support
  [SCSI] aacraid: Change interrupt mode to MSI for series-6 controller
  [SCSI] aacraid: Enable 64-bit write to controller register
  [SCSI] aacraid: Tune response path if IsFastPath bit set
  [SCSI] aacraid: Reset irq affinity hints before releasing irq
  [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from
suspend
  [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()
  [SCSI] aacraid: Update driver version

 drivers/scsi/aacraid/aachba.c   | 265 +---
 drivers/scsi/aacraid/aacraid.h  |  20 ++-
 drivers/scsi/aacraid/comminit.c | 147 +++---
 drivers/scsi/aacraid/commsup.c  | 113 -
 drivers/scsi/aacraid/linit.c| 152 +++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |  64 +++---
 8 files changed, 480 insertions(+), 283 deletions(-)

-- 
1.9.3

--
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 V7 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

2015-08-27 Thread Mahesh Rajashekhara
Description:
Driver sends the right size of the response buffer.

Changes from V2:
None

Reviewed By: Tomas Henzl the...@redhat.com, Murthy Bhat 
murthy.b...@pmcs.com, Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_name),
+ sizeof(struct aac_get_name_resp),
  FsaNormal,
  0, 1,
  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_serial),
+ sizeof(struct aac_get_serial_resp),
  FsaNormal,
  0, 1,
  (fib_callback) get_container_serial_callback,
-- 
1.9.3

--
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 V7 3/9] [SCSI] aacraid: Change interrupt mode to MSI for series-6 controller

2015-08-27 Thread Mahesh Rajashekhara
Description:
This change always sets MSI interrupt mode for series-6 controller.

Changes from V2:
aac_msi option description and subject change.

Reviewed-by: Tomas Henzl the...@redhat.com, Murthy Bhat 
murthy.b...@pmcs.com, Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 2 +-
 drivers/scsi/aacraid/src.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index fe59b00..05f2a02 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -259,7 +259,7 @@ MODULE_PARM_DESC(commit, Control whether a COMMIT_CONFIG 
is issued to the
 0=off, 1=on);
 module_param_named(msi, aac_msi, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(msi, IRQ handling.
-0=PIC(default), 1=MSI, 2=MSI-X(unsupported, uses MSI));
+0=PIC(default), 1=MSI, 2=MSI-X));
 module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(startup_timeout, The duration of time in seconds to wait for
 adapter to have it's kernel up and\n
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index b147341..eb07b3d 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
if (dev-comm_interface != AAC_COMM_MESSAGE_TYPE1)
goto error_iounmap;
 
-   dev-msi = aac_msi  !pci_enable_msi(dev-pdev);
+   dev-msi = !pci_enable_msi(dev-pdev);
 
dev-aac_msix[0].vector_no = 0;
dev-aac_msix[0].dev = dev;
-- 
1.9.3

--
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 V7 2/9] [SCSI] aacraid: Add Power Management support

2015-08-27 Thread Mahesh Rajashekhara
Description:
* .suspend() and .resume() routines implemented in the driver
* aac_release_resources() initiates firmware shutdown
* aac_acquire_resources re-initializes the host interface

Changes from V2:
Increased msleep(1) to msleep(20)
Reverted pci_enable_msix_exact() to pci_enable_msix() as this change has moved 
into a separate patch

Reviewed-by: Tomas Henzl the...@redhat.com, Murthy Bhat 
murthy.b...@pmcs.com, Karthikeya Sunkesula karthikeya.sunkes...@pmcs.com
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 
 drivers/scsi/aacraid/linit.c| 147 ++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 
*r4);
int  (*adapter_check_health)(struct aac_dev *dev);
int  (*adapter_restart)(struct aac_dev *dev, int bled);
+   void (*adapter_start)(struct aac_dev *dev);
/* Transport operations */
int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
(dev)-a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+   ((dev)-a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
(dev)-a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);
 int aac_src_init(struct aac_dev *dev);
 int aac_srcv_init(struct aac_dev *dev);
 int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * 
hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);
 unsigned int aac_command_normal(struct aac_queue * q);
 unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index,
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45db84a..45a0a04 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include aacraid.h
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev)
+{
+   int i, msi_count;
+
+   msi_count = i = 0;
+   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+   if (dev-max_msix == 0 ||
+   dev-pdev-device == PMC_DEVICE_S6 ||
+   dev-sync_mode) {
+   dev-max_msix = 1;
+   dev-vector_cap =
+   dev-scsi_host_ptr-can_queue +
+   AAC_NUM_MGT_FIB;
+   return;
+   }
+
+   /* Don't bother allocating more MSI-X vectors than cpus */
+   msi_count = min(dev-max_msix,
+   (unsigned int)num_online_cpus());
+
+   dev-max_msix = msi_count;
+
+   if (msi_count  AAC_MAX_MSIX)
+   msi_count = AAC_MAX_MSIX;
+
+   for (i = 0; i  msi_count; i++)
+   dev-msixentry[i].entry = i;
+
+   if (msi_count  1 
+   pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
+   i = pci_enable_msix(dev-pdev,
+   dev-msixentry,
+   msi_count);
+/* Check how many MSIX vectors are allocated */
+   if (i = 0) {
+   dev-msi_enabled = 1;
+   if (i) {
+   msi_count = i;
+   if (pci_enable_msix(dev-pdev,
+   dev-msixentry,
+   msi_count)) {
+   dev-msi_enabled = 0;
+   printk(KERN_ERR %s%d: MSIX not 
supported!! Will try MSI 0x%x.\n,
+   dev-name, dev-id, i);
+   }
+   }
+   } else {
+   dev-msi_enabled = 0;
+   printk(KERN_ERR %s%d: MSIX not supported!! Will try 
MSI 0x%x.\n,
+   dev-name, dev-id, i);
+   }
+   }
+
+   if (!dev-msi_enabled) {
+   msi_count = 1;
+   i = pci_enable_msi(dev-pdev

RE: [PATCH V5 11/11] [SCSI] aacraid: Requests at least 2 MSIx in pci_enable_msix_range()

2015-08-12 Thread Mahesh Rajashekhara
As Tomas Henzl suggested, I have merged 10 and 11 of V5 into single patch (i.e 
9 of V6)

Changes from V5:
Applied driver update change at the end.
Merged 10 and 11 of V5 into 9 of V6.
AAC_MAX_MSIX definition change.
aac_msi option description and subject change.

Thanks,
Mahesh

-Original Message-
From: James Bottomley [mailto:james.bottom...@hansenpartnership.com] 
Sent: Wednesday, August 12, 2015 11:59 PM
To: Tomas Henzl
Cc: Rajinikanth Pandurangan; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org; aacr...@pmc-sierra.com; Harry Yang; Rich Bono; 
Mahesh Rajashekhara; Achim Leubner; Murthy Bhat
Subject: Re: [PATCH V5 11/11] [SCSI] aacraid: Requests at least 2 MSIx in 
pci_enable_msix_range()


 On 22.7.2015 18:49, rajinikanth.panduran...@pmcs.com wrote:
  From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
  
  Description:
  In MSIx mode, we need at least 2 vectors.
  
  Changes from V4:
Newly created for V5 based on review comment.
  
  Signed-off-by: Rajinikanth Pandurangan
 rajinikanth.pandurangan@pmcs.
 
 Reviewed-by: Tomas Henzl the...@redhat.com

I'm confused by your [PATCH v6] posting: where did this patch go ... do you 
want it dropped or did you just forget to include it?

James


N�r��yb�X��ǧv�^�)޺{.n�+{{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj��!�i

[PATCH V6 08/10] [SCSI] aacraid: Send commit-config to controller firmware

2015-08-11 Thread Mahesh Rajashekhara
Description:
Controller BIOS/UEFI driver used to send this request.  But for
IBM-Power system there is no BIOS/UEFI driver.  So this change is
required for IBM, otherwise controller will be read-only mode.

Changes from V2:
None

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/linit.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 3b6e5c6..35dd849 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1270,8 +1270,11 @@ static int aac_probe_one(struct pci_dev *pdev, const 
struct pci_device_id *id)
shost-max_channel = aac-maximum_num_channels;
else
shost-max_channel = 0;
-
+#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
+   aac_get_config_status(aac, 1);
+#else
aac_get_config_status(aac, 0);
+#endif
aac_get_containers(aac);
list_add(aac-entry, insert);
 
-- 
1.9.3

--
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 V6 10/10] [SCSI] aacraid: Update driver version

2015-08-11 Thread Mahesh Rajashekhara
Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 2de5ebc..074878b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
-- 
1.9.3

--
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 V6 09/10] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-08-11 Thread Mahesh Rajashekhara
Description:
As pci_enable_msix() deprecated, replaced with pci_enable_msix_range()

Changes from V5:
Merged 10 and 11 of V5 into this patch.
AAC_MAX_MSIX definition change.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |  2 +-
 drivers/scsi/aacraid/comminit.c | 20 ++--
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 7b95227..2de5ebc 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  *  D E F I N E S
  
**/
 
-#define AAC_MAX_MSIX   8   /* vectors */
+#define AAC_MAX_MSIX   32  /* vectors */
 #define AAC_PCI_MSI_ENABLE 0x8000
 
 enum {
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index b4b6088..0e954e3 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
 
 void aac_define_int_mode(struct aac_dev *dev)
 {
-   int i, msi_count;
+   int i, msi_count, min_msix;
 
msi_count = i = 0;
/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
@@ -366,22 +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
 
if (msi_count  1 
pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
-   i = pci_enable_msix(dev-pdev,
+   min_msix = 2;
+   i = pci_enable_msix_range(dev-pdev,
dev-msixentry,
+   min_msix,
msi_count);
-/* Check how many MSIX vectors are allocated */
-   if (i = 0) {
+   if (i  0) {
dev-msi_enabled = 1;
-   if (i) {
-   msi_count = i;
-   if (pci_enable_msix(dev-pdev,
-   dev-msixentry,
-   msi_count)) {
-   dev-msi_enabled = 0;
-   printk(KERN_ERR %s%d: MSIX not 
supported!! Will try MSI 0x%x.\n,
-   dev-name, dev-id, i);
-   }
-   }
+   msi_count = i;
} else {
dev-msi_enabled = 0;
printk(KERN_ERR %s%d: MSIX not supported!! Will try 
MSI 0x%x.\n,
-- 
1.9.3

--
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 V5 10/11] [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()

2015-08-11 Thread Mahesh Rajashekhara
Thanks for your review comments, Tomas

Rajinikanth Pandurangan is no longer with PMC-Sierra now. I have taken care 
your review comments in V6 patch set. 

Thanks,
Mahesh
 

-Original Message-
From: Tomas Henzl [mailto:the...@redhat.com] 
Sent: Thursday, July 23, 2015 8:04 PM
To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Rich Bono; Mahesh Rajashekhara; Achim 
Leubner; Murthy Bhat
Subject: Re: [PATCH V5 10/11] [SCSI] aacraid: Replace pci_enable_msix() with 
pci_enable_msix_range()

On 23.7.2015 15:42, Rajinikanth Pandurangan wrote:
 Hello Tomas,
 
 Our real intention was to replace pci_enable_msix() with 
 pci_enable_msix_range().
 In V4, I had min as 8 and max as msi_count (which could be max of 32).  So 
 range was 2 - 32.  But then as you suggested to make separate patch if I 
 wanted to set the min range different, I have created patch 11 in V5.
 In patch 10 of V5, set range as (1 - 32). - I thought this would reflect our 
 original intention.
 After discussed internally, we wanted to have at least minimum of 2 MSIx, so 
 it reflects in patch 11 of V5.
In V4 you had a minimum value of 8 and because AAC_MAX_MSIX also is eight your 
were limiting it to exact 8, that seemed to me as a clear mistake so I pointed 
you to that. Your answer was that this functional change is intended (8 as 
minimum value instead of 2), so I asked you for a new patch for the minimum 
value change.

In your V5 you again use the original range and thus the split to two patches 
makes no sense.
As I already wrote, I accepted it as it is (two patches instead of one is not a 
big problem) If you for some reason will post a new series, please merge 10 and 
11.

 
 Please let me know if you still think I missed something.

For  for future series
- if you wish the upper limit to be 32
change the definition of AAC_MAX_MSIX in aacraid.h
- change the description of the  aac_msi option from the current description it 
seems that msi-x is unsupported
- and and important point is - you may add the 'reviewed-by' tag only if the 
person actually reviewed your patch and not just commented or asked you to make 
some change

Cheers,

tomas


 
 Thanks,
 
 -Original Message-
 From: Tomas Henzl [mailto:the...@redhat.com]
 Sent: Thursday, July 23, 2015 5:54 AM
 To: Rajinikanth Pandurangan; jbottom...@parallels.com; 
 linux-scsi@vger.kernel.org
 Cc: aacr...@pmc-sierra.com; Harry Yang; Rich Bono; Mahesh 
 Rajashekhara; Achim Leubner; Murthy Bhat
 Subject: Re: [PATCH V5 10/11] [SCSI] aacraid: Replace 
 pci_enable_msix() with pci_enable_msix_range()
 
 On 22.7.2015 18:49, rajinikanth.panduran...@pmcs.com wrote:
 From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

 Description:
 As pci_enable_msix() deprecated, replaced with
 pci_enable_msix_range()

 V4 Reviewed/commented by:
  Tomas Henzl the...@redhat.com

 Changes from V4:
  Changed to 1 as minimum msix range in pci_enable_msix_range() to 
 match with original code.
 I don't this is correct, your original code hasn't allowed a single msi-x 
 line too, it allowed it in an exact same range 2,8 like it is now with 
 10+11/11 patch applied.
 It looks like you have decided to not change the minimal supported 
 value in the end, that means that not two but a single patch is 
 preferred. If you for any reason repost your series, please merge
 10+11 into a single patch.
 I can accept it in the current form too so -
 
 Reviewed-by: Tomas Henzl the...@redhat.com
 
 Tomas
 

 Signed-off-by: Rajinikanth Pandurangan 
 rajinikanth.panduran...@pmcs.com
 ---
  drivers/scsi/aacraid/comminit.c | 20 ++--
  1 file changed, 6 insertions(+), 14 deletions(-)

 diff --git a/drivers/scsi/aacraid/comminit.c 
 b/drivers/scsi/aacraid/comminit.c index b4b6088..a02cfb3 100644
 --- a/drivers/scsi/aacraid/comminit.c
 +++ b/drivers/scsi/aacraid/comminit.c
 @@ -338,7 +338,7 @@ static int aac_comm_init(struct aac_dev * dev)
  
  void aac_define_int_mode(struct aac_dev *dev)  {
 -int i, msi_count;
 +int i, msi_count, min_msix;
  
  msi_count = i = 0;
  /* max. vectors from GET_COMM_PREFERRED_SETTINGS */ @@ -366,22
 +366,14 @@ void aac_define_int_mode(struct aac_dev *dev)
  
  if (msi_count  1 
  pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
 -i = pci_enable_msix(dev-pdev,
 +min_msix = 1;
 +i = pci_enable_msix_range(dev-pdev,
  dev-msixentry,
 +min_msix,
  msi_count);
 - /* Check how many MSIX vectors are allocated */
 -if (i = 0) {
 +if (i  0) {
  dev-msi_enabled = 1;
 -if (i) {
 -msi_count = i;
 -if (pci_enable_msix(dev-pdev,
 -dev-msixentry

[PATCH V6 00/10] [SCSI] aacraid: Patchset for aacraid driver version 41010

2015-08-10 Thread Mahesh Rajashekhara
This patchset includes the following changes (bug fixes and new feature 
support) specific to aacraid driver.

V6:
Applied driver update change at the end.
Merged 10 and 11 of V5 into 9 of V6.
AAC_MAX_MSIX definition change.
aac_msi option description and subject change.
Removed 'reviewed-by' tag.

V5:
Splited patch 10 from V4 into 2
Added one more patch to request minimum 2 MSIx.

V4:
Updated code with pci_enable_msix_range instead of exact.

V3:
Increased msleep() time from 1 to 20.
Created new patch for pci_enable_msix() replacement.
Changed subject/description of patch 03.

Mahesh Rajashekhara (10):
  [SCSI] aacraid: Fix for logical device name and UID not exposed to the
OS
  [SCSI] aacraid: Add Power Management support
  [SCSI] aacraid: Change interrupt mode to MSI for series-6  controller
  [SCSI] aacraid: Enable 64-bit write to controller register
  [SCSI] aacraid: Tune response path if IsFastPath bit set
  [SCSI] aacraid: Reset irq affinity hints before releasing irq
  [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from
suspend
  [SCSI] aacraid: Send commit-config to controller firmware
  [SCSI] aacraid: Replace pci_enable_msix() with pci_enable_msix_range()
  [SCSI] aacraid: Update driver version

 drivers/scsi/aacraid/aachba.c   | 265 +---
 drivers/scsi/aacraid/aacraid.h  |  20 ++-
 drivers/scsi/aacraid/comminit.c | 147 +++---
 drivers/scsi/aacraid/commsup.c  | 113 -
 drivers/scsi/aacraid/linit.c| 157 +++-
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |  64 +++---
 8 files changed, 484 insertions(+), 284 deletions(-)

-- 
1.9.3

--
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 V6 02/10] [SCSI] aacraid: Add Power Management support

2015-08-10 Thread Mahesh Rajashekhara
Description:
* .suspend() and .resume() routines implemented in the driver
* aac_release_resources() initiates firmware shutdown
* aac_acquire_resources re-initializes the host interface

Changes from V2:
Increased msleep(1) to msleep(20)
Reverted pci_enable_msix_exact() to pci_enable_msix() as this change has moved 
into a separate patch.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 
 drivers/scsi/aacraid/linit.c| 147 ++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 
*r4);
int  (*adapter_check_health)(struct aac_dev *dev);
int  (*adapter_restart)(struct aac_dev *dev, int bled);
+   void (*adapter_start)(struct aac_dev *dev);
/* Transport operations */
int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
(dev)-a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+   ((dev)-a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
(dev)-a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);
 int aac_src_init(struct aac_dev *dev);
 int aac_srcv_init(struct aac_dev *dev);
 int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * 
hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);
 unsigned int aac_command_normal(struct aac_queue * q);
 unsigned int aac_intr_normal(struct aac_dev *dev, u32 Index,
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45db84a..45a0a04 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include aacraid.h
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev)
+{
+   int i, msi_count;
+
+   msi_count = i = 0;
+   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+   if (dev-max_msix == 0 ||
+   dev-pdev-device == PMC_DEVICE_S6 ||
+   dev-sync_mode) {
+   dev-max_msix = 1;
+   dev-vector_cap =
+   dev-scsi_host_ptr-can_queue +
+   AAC_NUM_MGT_FIB;
+   return;
+   }
+
+   /* Don't bother allocating more MSI-X vectors than cpus */
+   msi_count = min(dev-max_msix,
+   (unsigned int)num_online_cpus());
+
+   dev-max_msix = msi_count;
+
+   if (msi_count  AAC_MAX_MSIX)
+   msi_count = AAC_MAX_MSIX;
+
+   for (i = 0; i  msi_count; i++)
+   dev-msixentry[i].entry = i;
+
+   if (msi_count  1 
+   pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
+   i = pci_enable_msix(dev-pdev,
+   dev-msixentry,
+   msi_count);
+/* Check how many MSIX vectors are allocated */
+   if (i = 0) {
+   dev-msi_enabled = 1;
+   if (i) {
+   msi_count = i;
+   if (pci_enable_msix(dev-pdev,
+   dev-msixentry,
+   msi_count)) {
+   dev-msi_enabled = 0;
+   printk(KERN_ERR %s%d: MSIX not 
supported!! Will try MSI 0x%x.\n,
+   dev-name, dev-id, i);
+   }
+   }
+   } else {
+   dev-msi_enabled = 0;
+   printk(KERN_ERR %s%d: MSIX not supported!! Will try 
MSI 0x%x.\n,
+   dev-name, dev-id, i);
+   }
+   }
+
+   if (!dev-msi_enabled) {
+   msi_count = 1;
+   i = pci_enable_msi(dev-pdev);
+
+   if (!i) {
+   dev-msi_enabled = 1;
+   dev-msi = 1;
+   } else

[PATCH V6 04/10] [SCSI] aacraid: Enable 64-bit write to controller register

2015-08-10 Thread Mahesh Rajashekhara
Description:
If writeq() not supported, then do atomic two 32bit write

Changes from V2:
None

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |  9 +
 drivers/scsi/aacraid/comminit.c |  1 +
 drivers/scsi/aacraid/src.c  | 12 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 62b0999..e54f597 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -844,6 +844,10 @@ struct src_registers {
((AEP)-regs.src.bar0-CSR))
 #define src_writel(AEP, CSR, value)writel(value, \
((AEP)-regs.src.bar0-CSR))
+#if defined(writeq)
+#definesrc_writeq(AEP, CSR, value) writeq(value, \
+   ((AEP)-regs.src.bar0-CSR))
+#endif
 
 #define SRC_ODR_SHIFT  12
 #define SRC_IDR_SHIFT  9
@@ -1163,6 +1167,11 @@ struct aac_dev
struct fsa_dev_info *fsa_dev;
struct task_struct  *thread;
int cardtype;
+   /*
+*This lock will protect the two 32-bit
+*writes to the Inbound Queue
+*/
+   spinlock_t  iq_lock;
 
/*
 *  The following is the device specific extension.
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 45a0a04..b4b6088 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
dev-management_fib_count = 0;
spin_lock_init(dev-manage_lock);
spin_lock_init(dev-sync_lock);
+   spin_lock_init(dev-iq_lock);
dev-max_fib_size = sizeof(struct hw_fib);
dev-sg_tablesize = host-sg_tablesize = (dev-max_fib_size
- sizeof(struct aac_fibhdr)
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index eb07b3d..1409a0b 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
u32 fibsize;
dma_addr_t address;
struct aac_fib_xporthdr *pFibX;
+#if !defined(writeq)
+   unsigned long flags;
+#endif
+
u16 hdr_size = le16_to_cpu(fib-hw_fib_va-header.Size);
 
atomic_inc(q-numpending);
@@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
return -EINVAL;
address |= fibsize;
}
-
+#if defined(writeq)
+   src_writeq(dev, MUnit.IQ_L, (u64)address);
+#else
+   spin_lock_irqsave(fib-dev-iq_lock, flags);
src_writel(dev, MUnit.IQ_H, upper_32_bits(address)  0x);
src_writel(dev, MUnit.IQ_L, address  0x);
-
+   spin_unlock_irqrestore(fib-dev-iq_lock, flags);
+#endif
return 0;
 }
 
-- 
1.9.3

--
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 V6 05/10] [SCSI] aacraid: Tune response path if IsFastPath bit set

2015-08-10 Thread Mahesh Rajashekhara
Description:
If 'IsFastPath' bit is set, then response path assumes no error
and skips error check.

Changes from V2:
None

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 259 ++
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 05f2a02..e4c2437 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib 
* fibptr)
return;
 
BUG_ON(fibptr == NULL);
-
dev = fibptr-dev;
 
-   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+   scsi_dma_unmap(scsicmd);
 
+   /* expose physical device if expose_physicald flag is on */
+   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
+  expose_physicals  0)
+   aac_expose_phy_device(scsicmd);
+
+   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
scsicmd-sense_buffer[0] = '\0';  /* Initialize sense valid flag to 
false */
 
if (fibptr-flags  FIB_CONTEXT_FLAG_FASTRESP) {
@@ -2994,147 +2999,157 @@ static void aac_srb_callback(void *context, struct 
fib * fibptr)
 */
scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
   - le32_to_cpu(srbreply-data_xfer_length));
-   }
-
-   scsi_dma_unmap(scsicmd);
-
-   /* expose physical device if expose_physicald flag is on */
-   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
-  expose_physicals  0)
-   aac_expose_phy_device(scsicmd);
+   /*
+* First check the fib status
+*/
 
-   /*
-* First check the fib status
-*/
+   if (le32_to_cpu(srbreply-status) != ST_OK) {
+   int len;
 
-   if (le32_to_cpu(srbreply-status) != ST_OK){
-   int len;
-   printk(KERN_WARNING aac_srb_callback: srb failed, status = 
%d\n, le32_to_cpu(srbreply-status));
-   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
-   SCSI_SENSE_BUFFERSIZE);
-   scsicmd-result = DID_ERROR  16 | COMMAND_COMPLETE  8 | 
SAM_STAT_CHECK_CONDITION;
-   memcpy(scsicmd-sense_buffer, srbreply-sense_data, len);
-   }
+   printk(KERN_WARNING aac_srb_callback: srb failed, 
status = %d\n, le32_to_cpu(srbreply-status));
+   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
+   SCSI_SENSE_BUFFERSIZE);
+   scsicmd-result = DID_ERROR  16
+   | COMMAND_COMPLETE  8
+   | SAM_STAT_CHECK_CONDITION;
+   memcpy(scsicmd-sense_buffer,
+   srbreply-sense_data, len);
+   }
 
-   /*
-* Next check the srb status
-*/
-   switch( (le32_to_cpu(srbreply-srb_status))0x3f){
-   case SRB_STATUS_ERROR_RECOVERY:
-   case SRB_STATUS_PENDING:
-   case SRB_STATUS_SUCCESS:
-   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
-   break;
-   case SRB_STATUS_DATA_OVERRUN:
-   switch(scsicmd-cmnd[0]){
-   case  READ_6:
-   case  WRITE_6:
-   case  READ_10:
-   case  WRITE_10:
-   case  READ_12:
-   case  WRITE_12:
-   case  READ_16:
-   case  WRITE_16:
-   if (le32_to_cpu(srbreply-data_xfer_length)  
scsicmd-underflow) {
-   printk(KERN_WARNINGaacraid: SCSI CMD 
underflow\n);
-   } else {
-   printk(KERN_WARNINGaacraid: SCSI CMD Data 
Overrun\n);
+   /*
+* Next check the srb status
+*/
+   switch ((le32_to_cpu(srbreply-srb_status))0x3f) {
+   case SRB_STATUS_ERROR_RECOVERY:
+   case SRB_STATUS_PENDING:
+   case SRB_STATUS_SUCCESS:
+   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
+   break;
+   case SRB_STATUS_DATA_OVERRUN:
+   switch (scsicmd-cmnd[0]) {
+   case  READ_6:
+   case  WRITE_6:
+   case  READ_10:
+   case  WRITE_10:
+   case  READ_12:
+   case  WRITE_12:
+   case  READ_16:
+   case  WRITE_16:
+   if (le32_to_cpu(srbreply-data_xfer_length)
+scsicmd-underflow)
+   printk

[PATCH V6 01/10] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

2015-08-10 Thread Mahesh Rajashekhara
Description:
Driver sends the right size of the response buffer.

Changes from V2:
None

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_name),
+ sizeof(struct aac_get_name_resp),
  FsaNormal,
  0, 1,
  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_serial),
+ sizeof(struct aac_get_serial_resp),
  FsaNormal,
  0, 1,
  (fib_callback) get_container_serial_callback,
-- 
1.9.3

--
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 V6 06/10] [SCSI] aacraid: Reset irq affinity hints before releasing irq

2015-08-10 Thread Mahesh Rajashekhara
Description:
Reset irq affinity hints before releasing IRQ
Removed duplicate code of IRQ acquire/release

Changes from V2:
None

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |   2 +
 drivers/scsi/aacraid/commsup.c | 113 ++---
 drivers/scsi/aacraid/src.c |  48 ++---
 3 files changed, 88 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index e54f597..7b95227 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2110,6 +2110,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, 
unsigned divisor)
 #define AAC_OWNER_ERROR_HANDLER0x103
 #define AAC_OWNER_FIRMWARE 0x106
 
+int aac_acquire_irq(struct aac_dev *dev);
+void aac_free_irq(struct aac_dev *dev);
 const char *aac_driverinfo(struct Scsi_Host *);
 struct fib *aac_fib_alloc(struct aac_dev *dev);
 int aac_fib_setup(struct aac_dev *dev);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 4da5749..a1f90fe 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1270,13 +1270,12 @@ retry_next:
 static int _aac_reset_adapter(struct aac_dev *aac, int forced)
 {
int index, quirks;
-   int retval, i;
+   int retval;
struct Scsi_Host *host;
struct scsi_device *dev;
struct scsi_cmnd *command;
struct scsi_cmnd *command_list;
int jafo = 0;
-   int cpu;
 
/*
 * Assumptions:
@@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int 
forced)
aac-comm_phys = 0;
kfree(aac-queues);
aac-queues = NULL;
-   cpu = cpumask_first(cpu_online_mask);
-   if (aac-pdev-device == PMC_DEVICE_S6 ||
-   aac-pdev-device == PMC_DEVICE_S7 ||
-   aac-pdev-device == PMC_DEVICE_S8 ||
-   aac-pdev-device == PMC_DEVICE_S9) {
-   if (aac-max_msix  1) {
-   for (i = 0; i  aac-max_msix; i++) {
-   if (irq_set_affinity_hint(
-   aac-msixentry[i].vector,
-   NULL)) {
-   printk(KERN_ERR %s%d: Failed to reset 
IRQ affinity for cpu %d\n,
-   aac-name,
-   aac-id,
-   cpu);
-   }
-   cpu = cpumask_next(cpu,
-   cpu_online_mask);
-   free_irq(aac-msixentry[i].vector,
-(aac-aac_msix[i]));
-   }
-   pci_disable_msix(aac-pdev);
-   } else {
-   free_irq(aac-pdev-irq, (aac-aac_msix[0]));
-   }
-   } else {
-   free_irq(aac-pdev-irq, aac);
-   }
-   if (aac-msi)
-   pci_disable_msi(aac-pdev);
+   aac_free_irq(aac);
kfree(aac-fsa_dev);
aac-fsa_dev = NULL;
quirks = aac_get_driver_ident(index)-quirks;
@@ -1978,3 +1949,83 @@ int aac_command_thread(void *data)
dev-aif_thread = 0;
return 0;
 }
+
+int aac_acquire_irq(struct aac_dev *dev)
+{
+   int i;
+   int j;
+   int ret = 0;
+   int cpu;
+
+   cpu = cpumask_first(cpu_online_mask);
+   if (!dev-sync_mode  dev-msi_enabled  dev-max_msix  1) {
+   for (i = 0; i  dev-max_msix; i++) {
+   dev-aac_msix[i].vector_no = i;
+   dev-aac_msix[i].dev = dev;
+   if (request_irq(dev-msixentry[i].vector,
+   dev-a_ops.adapter_intr,
+   0, aacraid, (dev-aac_msix[i]))) {
+   printk(KERN_ERR %s%d: Failed to register IRQ 
for vector %d.\n,
+   dev-name, dev-id, i);
+   for (j = 0 ; j  i ; j++)
+   free_irq(dev-msixentry[j].vector,
+(dev-aac_msix[j]));
+   pci_disable_msix(dev-pdev);
+   ret = -1;
+   }
+   if (irq_set_affinity_hint(dev-msixentry[i].vector,
+   get_cpu_mask(cpu))) {
+   printk(KERN_ERR %s%d: Failed to set IRQ 
affinity for cpu %d\n,
+   dev-name, dev-id, cpu);
+   }
+   cpu = cpumask_next(cpu, cpu_online_mask);
+   }
+   } else {
+   dev-aac_msix[0].vector_no = 0;
+   dev-aac_msix[0

[PATCH V6 07/10] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend

2015-08-10 Thread Mahesh Rajashekhara
Description:
Driver blocks ioctls once it received shutdown/suspend request during
suspend/hybernation. This patch unblocks ioctls on resume path.

Changes from V2:
None

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/linit.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 37375cf..3b6e5c6 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1448,6 +1448,11 @@ static int aac_resume(struct pci_dev *pdev)
pci_set_master(pdev);
if (aac_acquire_resources(aac))
goto fail_device;
+   /*
+   * reset this flag to unblock ioctl() as it was set at
+   * aac_send_shutdown() to block ioctls from upperlayer
+   */
+   aac-adapter_shutdown = 0;
scsi_unblock_requests(shost);
 
return 0;
-- 
1.9.3

--
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 V6 03/10] [SCSI] aacraid: Change interrupt mode to MSI for series-6 controller

2015-08-10 Thread Mahesh Rajashekhara
Description:
This change always sets MSI interrupt mode for series-6 controller.

Changes from V2:
aac_msi option description and subject change.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 2 +-
 drivers/scsi/aacraid/src.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index fe59b00..05f2a02 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -259,7 +259,7 @@ MODULE_PARM_DESC(commit, Control whether a COMMIT_CONFIG 
is issued to the
 0=off, 1=on);
 module_param_named(msi, aac_msi, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(msi, IRQ handling.
-0=PIC(default), 1=MSI, 2=MSI-X(unsupported, uses MSI));
+0=PIC(default), 1=MSI, 2=MSI-X));
 module_param(startup_timeout, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(startup_timeout, The duration of time in seconds to wait for
 adapter to have it's kernel up and\n
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index b147341..eb07b3d 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
if (dev-comm_interface != AAC_COMM_MESSAGE_TYPE1)
goto error_iounmap;
 
-   dev-msi = aac_msi  !pci_enable_msi(dev-pdev);
+   dev-msi = !pci_enable_msi(dev-pdev);
 
dev-aac_msix[0].vector_no = 0;
dev-aac_msix[0].dev = dev;
-- 
1.9.3

--
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 8/9] [SCSI] aacraid: Send commit-config to controller firmware

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:13 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 8/9] [SCSI] aacraid: Send commit-config to controller 
firmware

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
Controller BIOS/UEFI driver used to send this request.  But for
IBM-Power system there is no BIOS/UEFI driver.  So this change is
required for IBM, otherwise controller will be read-only mode.

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/linit.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 
1142c28..3df0dfb 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1270,8 +1270,11 @@ static int aac_probe_one(struct pci_dev *pdev, const 
struct pci_device_id *id)
shost-max_channel = aac-maximum_num_channels;
else
shost-max_channel = 0;
-
+#if defined(__powerpc__) || defined(__PPC__) || defined(__ppc__)
+   aac_get_config_status(aac, 1);
+#else
aac_get_config_status(aac, 0);
+#endif
aac_get_containers(aac);
list_add(aac-entry, insert);
 
--
1.9.3

--
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 9/9] [SCSI] aacraid: Update driver version

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:13 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 9/9] [SCSI] aacraid: Update driver version

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h | 2 +-
 drivers/scsi/aacraid/linit.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 7b95227..73c3384 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 40709
+# define AAC_DRIVER_BUILD 41010
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 
3df0dfb..1627928 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -56,7 +56,7 @@
 
 #include aacraid.h
 
-#define AAC_DRIVER_VERSION 1.2-1
+#define AAC_DRIVER_VERSION 1.2-2
 #ifndef AAC_DRIVER_BRANCH
 #define AAC_DRIVER_BRANCH  
 #endif
--
1.9.3

--
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 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once system resumed from suspend

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 7/9] [SCSI] aacraid: Unblock IOCTLs to controller once 
system resumed from suspend

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
Driver blocks ioctls once it received shutdown/suspend request during
suspend/hybernation. This patch unblocks ioctls on resume path.

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/linit.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 
8020348..1142c28 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -1448,6 +1448,11 @@ static int aac_resume(struct pci_dev *pdev)
pci_set_master(pdev);
if (aac_acquire_resources(aac))
goto fail_device;
+   /*
+   * reset this flag to unblock ioctl() as it was set at
+   * aac_send_shutdown() to block ioctls from upperlayer
+   */
+   aac-adapter_shutdown = 0;
scsi_unblock_requests(shost);
 
return 0;
--
1.9.3

--
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 1/9] [SCSI] aacraid: Fix for logical device name and UID not exposed to the OS

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 1/9] [SCSI] aacraid: Fix for logical device name and UID not 
exposed to the OS

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
Driver sends the right size of the response buffer.

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c 
index 9b3dd6e..fe59b00 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -570,7 +570,7 @@ static int aac_get_container_name(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_name),
+ sizeof(struct aac_get_name_resp),
  FsaNormal,
  0, 1,
  (fib_callback)get_container_name_callback,
@@ -1052,7 +1052,7 @@ static int aac_get_container_serial(struct scsi_cmnd * 
scsicmd)
 
status = aac_fib_send(ContainerCommand,
  cmd_fibcontext,
- sizeof (struct aac_get_serial),
+ sizeof(struct aac_get_serial_resp),
  FsaNormal,
  0, 1,
  (fib_callback) get_container_serial_callback,
--
1.9.3

--
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 4/9] [SCSI] aacraid: Enable 64-bit write to controller register

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 4/9] [SCSI] aacraid: Enable 64-bit write to controller 
register

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
If writeq() not supported, then do atomic two 32bit write

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |  9 +  
drivers/scsi/aacraid/comminit.c |  1 +
 drivers/scsi/aacraid/src.c  | 12 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 62b0999..e54f597 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -844,6 +844,10 @@ struct src_registers {
((AEP)-regs.src.bar0-CSR))
 #define src_writel(AEP, CSR, value)writel(value, \
((AEP)-regs.src.bar0-CSR))
+#if defined(writeq)
+#definesrc_writeq(AEP, CSR, value) writeq(value, \
+   ((AEP)-regs.src.bar0-CSR))
+#endif
 
 #define SRC_ODR_SHIFT  12
 #define SRC_IDR_SHIFT  9
@@ -1163,6 +1167,11 @@ struct aac_dev
struct fsa_dev_info *fsa_dev;
struct task_struct  *thread;
int cardtype;
+   /*
+*This lock will protect the two 32-bit
+*writes to the Inbound Queue
+*/
+   spinlock_t  iq_lock;
 
/*
 *  The following is the device specific extension.
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c 
index e0a76d5..e4ff47e 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -424,6 +424,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
dev-management_fib_count = 0;
spin_lock_init(dev-manage_lock);
spin_lock_init(dev-sync_lock);
+   spin_lock_init(dev-iq_lock);
dev-max_fib_size = sizeof(struct hw_fib);
dev-sg_tablesize = host-sg_tablesize = (dev-max_fib_size
- sizeof(struct aac_fibhdr)
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 
eb07b3d..1409a0b 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -447,6 +447,10 @@ static int aac_src_deliver_message(struct fib *fib)
u32 fibsize;
dma_addr_t address;
struct aac_fib_xporthdr *pFibX;
+#if !defined(writeq)
+   unsigned long flags;
+#endif
+
u16 hdr_size = le16_to_cpu(fib-hw_fib_va-header.Size);
 
atomic_inc(q-numpending);
@@ -511,10 +515,14 @@ static int aac_src_deliver_message(struct fib *fib)
return -EINVAL;
address |= fibsize;
}
-
+#if defined(writeq)
+   src_writeq(dev, MUnit.IQ_L, (u64)address); #else
+   spin_lock_irqsave(fib-dev-iq_lock, flags);
src_writel(dev, MUnit.IQ_H, upper_32_bits(address)  0x);
src_writel(dev, MUnit.IQ_L, address  0x);
-
+   spin_unlock_irqrestore(fib-dev-iq_lock, flags); #endif
return 0;
 }
 
--
1.9.3

--
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 2/9] [SCSI] aacraid: Add Power Management support

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 2/9] [SCSI] aacraid: Add Power Management support

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
* .suspend() and .resume() routines implemented in the driver
* aac_release_resources() initiates firmware shutdown
* aac_acquire_resources re-initializes the host interface

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |   5 ++
 drivers/scsi/aacraid/comminit.c | 154 
 drivers/scsi/aacraid/linit.c| 147 ++
 drivers/scsi/aacraid/rx.c   |   1 +
 drivers/scsi/aacraid/sa.c   |   1 +
 drivers/scsi/aacraid/src.c  |   2 +
 6 files changed, 232 insertions(+), 78 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 40fe65c..62b0999 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -547,6 +547,7 @@ struct adapter_ops
int  (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 
p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 
*r4);
int  (*adapter_check_health)(struct aac_dev *dev);
int  (*adapter_restart)(struct aac_dev *dev, int bled);
+   void (*adapter_start)(struct aac_dev *dev);
/* Transport operations */
int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
irq_handler_t adapter_intr;
@@ -1247,6 +1248,9 @@ struct aac_dev
 #define aac_adapter_restart(dev,bled) \
(dev)-a_ops.adapter_restart(dev,bled)
 
+#define aac_adapter_start(dev) \
+   ((dev)-a_ops.adapter_start(dev))
+
 #define aac_adapter_ioremap(dev, size) \
(dev)-a_ops.adapter_ioremap(dev, size)
 
@@ -2127,6 +2131,7 @@ int aac_sa_init(struct aac_dev *dev);  int 
aac_src_init(struct aac_dev *dev);  int aac_srcv_init(struct aac_dev *dev);  
int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * 
hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify);
+void aac_define_int_mode(struct aac_dev *dev);
 unsigned int aac_response_normal(struct aac_queue * q);  unsigned int 
aac_command_normal(struct aac_queue * q);  unsigned int aac_intr_normal(struct 
aac_dev *dev, u32 Index, diff --git a/drivers/scsi/aacraid/comminit.c 
b/drivers/scsi/aacraid/comminit.c index 45db84a..e0a76d5 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -43,8 +43,6 @@
 
 #include aacraid.h
 
-static void aac_define_int_mode(struct aac_dev *dev);
-
 struct aac_common aac_config = {
.irq_mod = 1
 };
@@ -338,6 +336,82 @@ static int aac_comm_init(struct aac_dev * dev)
return 0;
 }
 
+void aac_define_int_mode(struct aac_dev *dev) {
+   int i, msi_count;
+
+   msi_count = i = 0;
+   /* max. vectors from GET_COMM_PREFERRED_SETTINGS */
+   if (dev-max_msix == 0 ||
+   dev-pdev-device == PMC_DEVICE_S6 ||
+   dev-sync_mode) {
+   dev-max_msix = 1;
+   dev-vector_cap =
+   dev-scsi_host_ptr-can_queue +
+   AAC_NUM_MGT_FIB;
+   return;
+   }
+
+   /* Don't bother allocating more MSI-X vectors than cpus */
+   msi_count = min(dev-max_msix,
+   (unsigned int)num_online_cpus());
+
+   dev-max_msix = msi_count;
+
+   if (msi_count  AAC_MAX_MSIX)
+   msi_count = AAC_MAX_MSIX;
+
+   for (i = 0; i  msi_count; i++)
+   dev-msixentry[i].entry = i;
+
+   if (msi_count  1 
+   pci_find_capability(dev-pdev, PCI_CAP_ID_MSIX)) {
+   i = pci_enable_msix_exact(dev-pdev,
+   dev-msixentry,
+   msi_count);
+/* Check how many MSIX vectors are allocated */
+   if (i = 0) {
+   dev-msi_enabled = 1;
+   if (i) {
+   msi_count = i;
+   if (pci_enable_msix_exact(dev-pdev,
+   dev-msixentry,
+   msi_count)) {
+   dev-msi_enabled = 0;
+   printk(KERN_ERR %s%d: MSIX not 
supported!! Will try MSI 0x%x.\n,
+   dev-name, dev-id, i);
+   }
+   }
+   } else {
+   dev-msi_enabled = 0;
+   printk(KERN_ERR %s%d: MSIX not supported!! Will try 
MSI 0x

RE: [Patch V2 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 controller

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 3/9] [SCSI] aacraid: Enable MSI interrupt for series-6 
controller

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
Enable MSI interrupt mode for series-6 controller.

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/src.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 
b147341..eb07b3d 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -742,7 +742,7 @@ int aac_src_init(struct aac_dev *dev)
if (dev-comm_interface != AAC_COMM_MESSAGE_TYPE1)
goto error_iounmap;
 
-   dev-msi = aac_msi  !pci_enable_msi(dev-pdev);
+   dev-msi = !pci_enable_msi(dev-pdev);
 
dev-aac_msix[0].vector_no = 0;
dev-aac_msix[0].dev = dev;
--
1.9.3

--
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 6/9] [SCSI] aacraid: Reset irq affinity hints before releasing irq

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 6/9] [SCSI] aacraid: Reset irq affinity hints before 
releasing irq

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
Reset irq affinity hints before releasing IRQ
Removed duplicate code of IRQ acquire/release

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |   2 +
 drivers/scsi/aacraid/commsup.c | 113 ++---
 drivers/scsi/aacraid/src.c |  48 ++---
 3 files changed, 88 insertions(+), 75 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index e54f597..7b95227 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2110,6 +2110,8 @@ static inline unsigned int cap_to_cyls(sector_t capacity, 
unsigned divisor)
 #define AAC_OWNER_ERROR_HANDLER0x103
 #define AAC_OWNER_FIRMWARE 0x106
 
+int aac_acquire_irq(struct aac_dev *dev); void aac_free_irq(struct 
+aac_dev *dev);
 const char *aac_driverinfo(struct Scsi_Host *);  struct fib 
*aac_fib_alloc(struct aac_dev *dev);  int aac_fib_setup(struct aac_dev *dev); 
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c 
index 4da5749..a1f90fe 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1270,13 +1270,12 @@ retry_next:
 static int _aac_reset_adapter(struct aac_dev *aac, int forced)  {
int index, quirks;
-   int retval, i;
+   int retval;
struct Scsi_Host *host;
struct scsi_device *dev;
struct scsi_cmnd *command;
struct scsi_cmnd *command_list;
int jafo = 0;
-   int cpu;
 
/*
 * Assumptions:
@@ -1339,35 +1338,7 @@ static int _aac_reset_adapter(struct aac_dev *aac, int 
forced)
aac-comm_phys = 0;
kfree(aac-queues);
aac-queues = NULL;
-   cpu = cpumask_first(cpu_online_mask);
-   if (aac-pdev-device == PMC_DEVICE_S6 ||
-   aac-pdev-device == PMC_DEVICE_S7 ||
-   aac-pdev-device == PMC_DEVICE_S8 ||
-   aac-pdev-device == PMC_DEVICE_S9) {
-   if (aac-max_msix  1) {
-   for (i = 0; i  aac-max_msix; i++) {
-   if (irq_set_affinity_hint(
-   aac-msixentry[i].vector,
-   NULL)) {
-   printk(KERN_ERR %s%d: Failed to reset 
IRQ affinity for cpu %d\n,
-   aac-name,
-   aac-id,
-   cpu);
-   }
-   cpu = cpumask_next(cpu,
-   cpu_online_mask);
-   free_irq(aac-msixentry[i].vector,
-(aac-aac_msix[i]));
-   }
-   pci_disable_msix(aac-pdev);
-   } else {
-   free_irq(aac-pdev-irq, (aac-aac_msix[0]));
-   }
-   } else {
-   free_irq(aac-pdev-irq, aac);
-   }
-   if (aac-msi)
-   pci_disable_msi(aac-pdev);
+   aac_free_irq(aac);
kfree(aac-fsa_dev);
aac-fsa_dev = NULL;
quirks = aac_get_driver_ident(index)-quirks;
@@ -1978,3 +1949,83 @@ int aac_command_thread(void *data)
dev-aif_thread = 0;
return 0;
 }
+
+int aac_acquire_irq(struct aac_dev *dev) {
+   int i;
+   int j;
+   int ret = 0;
+   int cpu;
+
+   cpu = cpumask_first(cpu_online_mask);
+   if (!dev-sync_mode  dev-msi_enabled  dev-max_msix  1) {
+   for (i = 0; i  dev-max_msix; i++) {
+   dev-aac_msix[i].vector_no = i;
+   dev-aac_msix[i].dev = dev;
+   if (request_irq(dev-msixentry[i].vector,
+   dev-a_ops.adapter_intr,
+   0, aacraid, (dev-aac_msix[i]))) {
+   printk(KERN_ERR %s%d: Failed to register IRQ 
for vector %d.\n,
+   dev-name, dev-id, i);
+   for (j = 0 ; j  i ; j++)
+   free_irq(dev-msixentry[j].vector,
+(dev-aac_msix[j]));
+   pci_disable_msix(dev-pdev);
+   ret = -1

RE: [Patch V2 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set

2015-06-23 Thread Mahesh Rajashekhara
Reviewed-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com


-Original Message-
From: Rajinikanth Pandurangan 
Sent: Thursday, June 11, 2015 7:12 AM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Mahesh Rajashekhara; Rich Bono; Achim 
Leubner; Murthy Bhat; Rajinikanth Pandurangan
Subject: [Patch V2 5/9] [SCSI] aacraid: Tune response path if IsFastPath bit set

From: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com

Description:
If 'IsFastPath' bit is set, then response path assumes no error
and skips error check.

Signed-off-by: Rajinikanth Pandurangan rajinikanth.panduran...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c | 259 ++
 1 file changed, 137 insertions(+), 122 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c 
index fe59b00..864e9f6 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -2977,11 +2977,16 @@ static void aac_srb_callback(void *context, struct fib 
* fibptr)
return;
 
BUG_ON(fibptr == NULL);
-
dev = fibptr-dev;
 
-   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
+   scsi_dma_unmap(scsicmd);
 
+   /* expose physical device if expose_physicald flag is on */
+   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
+  expose_physicals  0)
+   aac_expose_phy_device(scsicmd);
+
+   srbreply = (struct aac_srb_reply *) fib_data(fibptr);
scsicmd-sense_buffer[0] = '\0';  /* Initialize sense valid flag to 
false */
 
if (fibptr-flags  FIB_CONTEXT_FLAG_FASTRESP) { @@ -2994,147 +2999,157 
@@ static void aac_srb_callback(void *context, struct fib * fibptr)
 */
scsi_set_resid(scsicmd, scsi_bufflen(scsicmd)
   - le32_to_cpu(srbreply-data_xfer_length));
-   }
-
-   scsi_dma_unmap(scsicmd);
-
-   /* expose physical device if expose_physicald flag is on */
-   if (scsicmd-cmnd[0] == INQUIRY  !(scsicmd-cmnd[1]  0x01)
-  expose_physicals  0)
-   aac_expose_phy_device(scsicmd);
+   /*
+* First check the fib status
+*/
 
-   /*
-* First check the fib status
-*/
+   if (le32_to_cpu(srbreply-status) != ST_OK) {
+   int len;
 
-   if (le32_to_cpu(srbreply-status) != ST_OK){
-   int len;
-   printk(KERN_WARNING aac_srb_callback: srb failed, status = 
%d\n, le32_to_cpu(srbreply-status));
-   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
-   SCSI_SENSE_BUFFERSIZE);
-   scsicmd-result = DID_ERROR  16 | COMMAND_COMPLETE  8 | 
SAM_STAT_CHECK_CONDITION;
-   memcpy(scsicmd-sense_buffer, srbreply-sense_data, len);
-   }
+   printk(KERN_WARNING aac_srb_callback: srb failed, 
status = %d\n, le32_to_cpu(srbreply-status));
+   len = min_t(u32, le32_to_cpu(srbreply-sense_data_size),
+   SCSI_SENSE_BUFFERSIZE);
+   scsicmd-result = DID_ERROR  16
+   | COMMAND_COMPLETE  8
+   | SAM_STAT_CHECK_CONDITION;
+   memcpy(scsicmd-sense_buffer,
+   srbreply-sense_data, len);
+   }
 
-   /*
-* Next check the srb status
-*/
-   switch( (le32_to_cpu(srbreply-srb_status))0x3f){
-   case SRB_STATUS_ERROR_RECOVERY:
-   case SRB_STATUS_PENDING:
-   case SRB_STATUS_SUCCESS:
-   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
-   break;
-   case SRB_STATUS_DATA_OVERRUN:
-   switch(scsicmd-cmnd[0]){
-   case  READ_6:
-   case  WRITE_6:
-   case  READ_10:
-   case  WRITE_10:
-   case  READ_12:
-   case  WRITE_12:
-   case  READ_16:
-   case  WRITE_16:
-   if (le32_to_cpu(srbreply-data_xfer_length)  
scsicmd-underflow) {
-   printk(KERN_WARNINGaacraid: SCSI CMD 
underflow\n);
-   } else {
-   printk(KERN_WARNINGaacraid: SCSI CMD Data 
Overrun\n);
+   /*
+* Next check the srb status
+*/
+   switch ((le32_to_cpu(srbreply-srb_status))0x3f) {
+   case SRB_STATUS_ERROR_RECOVERY:
+   case SRB_STATUS_PENDING:
+   case SRB_STATUS_SUCCESS:
+   scsicmd-result = DID_OK  16 | COMMAND_COMPLETE  8;
+   break;
+   case SRB_STATUS_DATA_OVERRUN:
+   switch (scsicmd-cmnd[0]) {
+   case  READ_6

RE: [PATCH scsi] aacraid: aac_src_intr_message() can be static

2015-04-13 Thread Mahesh Rajashekhara
Acked-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com

-Original Message-
From: kbuild test robot [mailto:fengguang...@intel.com] 
Sent: Friday, April 10, 2015 2:24 PM
To: Mahesh Rajashekhara
Cc: kbuild-...@01.org; James Bottomley; Adaptec OEM Raid Solutions; James E.J. 
Bottomley; linux-scsi@vger.kernel.org; linux-ker...@vger.kernel.org
Subject: [PATCH scsi] aacraid: aac_src_intr_message() can be static


Signed-off-by: Fengguang Wu fengguang...@intel.com
---
 src.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c index 
50f181f..79a3ed1 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -46,7 +46,7 @@
 
 static int aac_src_get_sync_status(struct aac_dev *dev);
 
-irqreturn_t aac_src_intr_message(int irq, void *dev_id)
+static irqreturn_t aac_src_intr_message(int irq, void *dev_id)
 {
struct aac_msix_ctx *ctx;
struct aac_dev *dev;
--
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: [V2 PATCH 00/11] aacraid driver updates

2015-04-06 Thread Mahesh Rajashekhara
Hi James,

Can you please let me know the status of this patch set.

This V2 patch set was reviewed by Hannes and Murthy.

Thanks,
Mahesh  

-Original Message-
From: Mahesh Rajashekhara 
Sent: Thursday, March 26, 2015 8:11 PM
To: h...@suse.de; jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner; Mahesh Rajashekhara
Subject: [V2 PATCH 00/11] aacraid driver updates

This patch set includes some important bug fixes and new feature supports.

V2:
Separated unrelated patches from the VPD support one Fixed indentation issues 
Separated version increase and applied at the end

Mahesh Rajashekhara (11):
  aacraid: AIF support for SES device add/remove
  aacraid: IOCTL pass-through command fix
  aacraid: 4KB sector support
  aacraid: MSI-x support
  aacraid: vpd page code 0x83 support
  aacraid: 240 simple volume support
  aacraid: IOP RESET command handling changes
  aacraid: IOCTL fix
  aacraid: performance improvement changes
  aacraid: AIF raw device remove support
  aacraid: driver version change

 drivers/scsi/aacraid/aachba.c   |  410 +++--
 drivers/scsi/aacraid/aacraid.h  |  106 +-
 drivers/scsi/aacraid/commctrl.c |   10 +-
 drivers/scsi/aacraid/comminit.c |  106 +-
 drivers/scsi/aacraid/commsup.c  |   96 +++--
 drivers/scsi/aacraid/dpcsup.c   |   13 +-
 drivers/scsi/aacraid/linit.c|   61 --
 drivers/scsi/aacraid/rx.c   |   14 +-
 drivers/scsi/aacraid/src.c  |  438 +-
 9 files changed, 1012 insertions(+), 242 deletions(-)

--
1.7.7.3

--
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: [V2 PATCH 03/11] aacraid: 4KB sector support

2015-03-27 Thread Mahesh Rajashekhara

Thanks Hannes,

When we created new 4K based logical drive/container with the name length 16 
but we were seeing only first 15 characters in Linux OS by sg_map -i, cat 
/proc/scsi/scsi.

This change fixes logical drive name display issue.
 
-Original Message-
From: Hannes Reinecke [mailto:h...@suse.de] 
Sent: Friday, March 27, 2015 3:45 PM
To: Mahesh Rajashekhara; jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner
Subject: Re: [V2 PATCH 03/11] aacraid: 4KB sector support

On 03/26/2015 03:41 PM, Mahesh Rajashekhara wrote:
 Add 4KB sector support
 
 Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
 ---
  drivers/scsi/aacraid/aachba.c  |  240 +++
  drivers/scsi/aacraid/aacraid.h |   11 ++-
  2 files changed, 200 insertions(+), 51 deletions(-)
 
 diff --git a/drivers/scsi/aacraid/aachba.c 
 b/drivers/scsi/aacraid/aachba.c index b32e77d..aee3eaa 100644
 --- a/drivers/scsi/aacraid/aachba.c
 +++ b/drivers/scsi/aacraid/aachba.c
 @@ -111,6 +111,41 @@
  #define BYTE2(x) (unsigned char)((x)  16)  #define BYTE3(x) 
 (unsigned char)((x)  24)
  
 +/* MODE_SENSE data format */
 +typedef struct {
 + struct {
 + u8  data_length;
 + u8  med_type;
 + u8  dev_par;
 + u8  bd_length;
 + } __attribute__((packed)) hd;
 + struct {
 + u8  dens_code;
 + u8  block_count[3];
 + u8  reserved;
 + u8  block_length[3];
 + } __attribute__((packed)) bd;
 + u8  mpc_buf[3];
 +} __attribute__((packed)) aac_modep_data;
 +
 +/* MODE_SENSE_10 data format */
 +typedef struct {
 + struct {
 + u8  data_length[2];
 + u8  med_type;
 + u8  dev_par;
 + u8  rsrvd[2];
 + u8  bd_length[2];
 + } __attribute__((packed)) hd;
 + struct {
 + u8  dens_code;
 + u8  block_count[3];
 + u8  reserved;
 + u8  block_length[3];
 + } __attribute__((packed)) bd;
 + u8  mpc_buf[3];
 +} __attribute__((packed)) aac_modep10_data;
 +
  
 /*--
   *  S T R U C T S / T Y P E D E F S
   
 *-
 ---*/ @@ -438,7 +473,7 @@ static void 
 get_container_name_callback(void *context, struct fib * fibptr)
   if ((le32_to_cpu(get_name_reply-status) == CT_OK)
 (get_name_reply-data[0] != '\0')) {
   char *sp = get_name_reply-data;
 - sp[sizeof(((struct aac_get_name_resp *)NULL)-data)-1] = '\0';
 + sp[sizeof(((struct aac_get_name_resp *)NULL)-data)] = '\0';
   while (*sp == ' ')
   ++sp;
   if (*sp) {
What has this to do with 4k block support?
Looks rather like an unrelated bugfix to me...

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG 
Nürnberg)
--
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: [V2 PATCH 07/11] aacraid: IOP RESET command handling changes

2015-03-27 Thread Mahesh Rajashekhara
Thanks Hannes,

This patch fixes the IOP_RESET issue. Sending IOP_RESET command need to wait 
for only 10 sec instead of 5 minutes in case of firmware does not response 
IOP_RESET command.
Disable interrupt before setup interrupt routine to prevent spurious interrupts.

-Original Message-
From: Hannes Reinecke [mailto:h...@suse.de] 
Sent: Friday, March 27, 2015 3:51 PM
To: Mahesh Rajashekhara; jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner
Subject: Re: [V2 PATCH 07/11] aacraid: IOP RESET command handling changes

On 03/26/2015 03:41 PM, Mahesh Rajashekhara wrote:
 Add IOP RESET command handling changes
 
 Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com

The message is very terse; some more information would've been good.

Otherwise:

Reviewed-by: Hannes Reinecke h...@suse.de

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG 
Nürnberg)
--
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: [V2 PATCH 08/11] aacraid: IOCTL fix

2015-03-27 Thread Mahesh Rajashekhara
Thanks Hannes,

After getting the platform shutdown command VM_CloseAll response from the 
firmware, driver was getting configuration IOCTL request from the upper layers 
and it sends down to firmware. This causes firmware assert issue.

This patch fixes the firmware assert issue. During the shutdown, if driver gets 
commands from the upper layer, driver sends error code to the upper layers. 

-Original Message-
From: Hannes Reinecke [mailto:h...@suse.de] 
Sent: Friday, March 27, 2015 3:51 PM
To: Mahesh Rajashekhara; jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: Achim Leubner
Subject: Re: [V2 PATCH 08/11] aacraid: IOCTL fix

On 03/26/2015 03:41 PM, Mahesh Rajashekhara wrote:
 Add cfg IOCTL command fix
 
 Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com

Same here; this patch could do with some more information.
Otherwise:

Reviewed-by: Hannes Reinecke h...@suse.de

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG 
Nürnberg)
--
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: [V2 PATCH 04/11] aacraid: MSI-x support

2015-03-27 Thread Mahesh Rajashekhara
msi_enabled field is used in per Adapter structure (struct aac_dev). If the 
driver uses MSIx or MSI interrupt mode, this will be set.

Before posting the commands (for each and every command requests) to the 
Adapter and vector number assignments, this will be checked.

Thanks,
Mahesh


-Original Message-
From: Johannes Thumshirn [mailto:morbid...@gmail.com] 
Sent: Friday, March 27, 2015 6:59 PM
To: Mahesh Rajashekhara
Cc: h...@suse.de; jbottom...@parallels.com; linux-scsi@vger.kernel.org; Achim 
Leubner
Subject: Re: [V2 PATCH 04/11] aacraid: MSI-x support

Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com writes:

 Add MSI-x interrupt mode support.

 Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
 ---
  drivers/scsi/aacraid/aacraid.h  |   80 -
  drivers/scsi/aacraid/comminit.c |   95 +-
  drivers/scsi/aacraid/commsup.c  |   20 ++-
  drivers/scsi/aacraid/dpcsup.c   |9 +-
  drivers/scsi/aacraid/linit.c|   20 ++-
  drivers/scsi/aacraid/src.c  |  388 
 ++-
  6 files changed, 505 insertions(+), 107 deletions(-)

 diff --git a/drivers/scsi/aacraid/aacraid.h 
 b/drivers/scsi/aacraid/aacraid.h index 9e38b20..015c341 100644
 --- a/drivers/scsi/aacraid/aacraid.h
 +++ b/drivers/scsi/aacraid/aacraid.h
 @@ -6,11 +6,61 @@
  #define nblank(x) _nblank(x)[0]
  
  #include linux/interrupt.h
 +#include linux/pci.h
  
  
 /*--
   *  D E F I N E S
   
 *-
 ---*/
  
 +#define AAC_MAX_MSIX 32  /* vectors */
 +#define AAC_PCI_MSI_ENABLE   0x8000
 +
 +enum {
 + AAC_ENABLE_INTERRUPT= 0x0,
 + AAC_DISABLE_INTERRUPT,
 + AAC_ENABLE_MSIX,
 + AAC_DISABLE_MSIX,
 + AAC_CLEAR_AIF_BIT,
 + AAC_CLEAR_SYNC_BIT,
 + AAC_ENABLE_INTX
 +};
 +
 +#define AAC_INT_MODE_INTX(10)
 +#define AAC_INT_MODE_MSI (11)
 +#define AAC_INT_MODE_AIF (12)
 +#define AAC_INT_MODE_SYNC(13)
 +
 +#define AAC_INT_ENABLE_TYPE1_INTX0xfffb
 +#define AAC_INT_ENABLE_TYPE1_MSIX0xfffa
 +#define AAC_INT_DISABLE_ALL  0x
 +
 +/* Bit definitions in IOA-Host Interrupt Register */
 +#define PMC_TRANSITION_TO_OPERATIONAL(131)
 +#define PMC_IOARCB_TRANSFER_FAILED   (128)
 +#define PMC_IOA_UNIT_CHECK   (127)
 +#define PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE (126)
 +#define PMC_CRITICAL_IOA_OP_IN_PROGRESS  (125)
 +#define PMC_IOARRIN_LOST (14)
 +#define PMC_SYSTEM_BUS_MMIO_ERROR(13)
 +#define PMC_IOA_PROCESSOR_IN_ERROR_STATE (12)
 +#define PMC_HOST_RRQ_VALID   (11)
 +#define PMC_OPERATIONAL_STATUS   (131)
 +#define PMC_ALLOW_MSIX_VECTOR0   (10)
 +
 +#define PMC_IOA_ERROR_INTERRUPTS (PMC_IOARCB_TRANSFER_FAILED | \
 +  PMC_IOA_UNIT_CHECK | \
 +  PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE | \
 +  PMC_IOARRIN_LOST | \
 +  PMC_SYSTEM_BUS_MMIO_ERROR | \
 +  PMC_IOA_PROCESSOR_IN_ERROR_STATE)
 +
 +#define PMC_ALL_INTERRUPT_BITS   (PMC_IOA_ERROR_INTERRUPTS | \
 +  PMC_HOST_RRQ_VALID | \
 +  PMC_TRANSITION_TO_OPERATIONAL | \
 +  PMC_ALLOW_MSIX_VECTOR0)
 +#define  PMC_GLOBAL_INT_BIT2 0x0004
 +#define  PMC_GLOBAL_INT_BIT0 0x0001
 +
  #ifndef AAC_DRIVER_BUILD
  # define AAC_DRIVER_BUILD 30300
  # define AAC_DRIVER_BRANCH -ms
 @@ -36,6 +86,7 @@
  #define CONTAINER_TO_ID(cont)(cont)
  #define CONTAINER_TO_LUN(cont)   (0)
  
 +#define PMC_DEVICE_S60x28b
  #define PMC_DEVICE_S70x28c
  #define PMC_DEVICE_S80x28d
  #define PMC_DEVICE_S90x28f
 @@ -434,7 +485,7 @@ enum fib_xfer_state {  struct aac_init  {
   __le32  InitStructRevision;
 - __le32  MiniPortRevision;
 + __le32  Sa_MSIXVectors;
   __le32  fsrev;
   __le32  CommHeaderAddress;
   __le32  FastIoCommAreaAddress;
 @@ -755,7 +806,8 @@ struct rkt_registers {
  
  struct src_mu_registers {
   /*  PCI*| Name */
 - __le32  reserved0[8];   /*  00h | Reserved */
 + __le32  reserved0[6];   /*  00h | Reserved */
 + __le32  IOAR[2];/*  18h | IOA-host interrupt register */
   __le32  IDR;/*  20h | Inbound Doorbell Register */
   __le32  IISR;   /*  24h | Inbound Int. Status Register */
   __le32  reserved1[3];   /*  28h | Reserved */
 @@ -767,17 +819,18 @@ struct src_mu_registers {
   __le32  OMR;/*  bch | Outbound Message Register */
   __le32  IQ_L;   /*  c0h | Inbound Queue (Low address

[V2 PATCH 08/11] aacraid: IOCTL fix

2015-03-26 Thread Mahesh Rajashekhara
Add cfg IOCTL command fix

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |1 +
 drivers/scsi/aacraid/comminit.c |3 +++
 drivers/scsi/aacraid/linit.c|4 +++-
 3 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9b469a4..43d8076 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1222,6 +1222,7 @@ struct aac_dev
int msi_enabled;/* MSI/MSI-X enabled */
struct msix_entry   msixentry[AAC_MAX_MSIX];
struct aac_msix_ctx aac_msix[AAC_MAX_MSIX]; /* context */
+   u8  adapter_shutdown;
 };
 
 #define aac_adapter_interrupt(dev) \
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 284b1c5..27432b9 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -231,6 +231,7 @@ int aac_send_shutdown(struct aac_dev * dev)
/* FIB should be freed only after getting the response from the F/W */
if (status != -ERESTARTSYS)
aac_fib_free(fibctx);
+   dev-adapter_shutdown = 1;
if ((dev-pdev-device == PMC_DEVICE_S7 ||
 dev-pdev-device == PMC_DEVICE_S8 ||
 dev-pdev-device == PMC_DEVICE_S9) 
@@ -400,6 +401,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
}
dev-max_msix = 0;
dev-msi_enabled = 0;
+   dev-adapter_shutdown = 0;
if ((!aac_adapter_sync_cmd(dev, GET_COMM_PREFERRED_SETTINGS,
  0, 0, 0, 0, 0, 0,
  status+0, status+1, status+2, status+3, status+4))
@@ -511,6 +513,7 @@ static void aac_define_int_mode(struct aac_dev *dev)
 
int i, msi_count;
 
+   msi_count = i = 0;
/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
if (dev-max_msix == 0 ||
dev-pdev-device == PMC_DEVICE_S6 ||
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 75c3501..36653a9 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -713,7 +713,9 @@ static long aac_cfg_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
 {
int ret;
-   if (!capable(CAP_SYS_RAWIO))
+   struct aac_dev *aac;
+   aac = (struct aac_dev *)file-private_data;
+   if (!capable(CAP_SYS_RAWIO) || aac-adapter_shutdown)
return -EPERM;
mutex_lock(aac_mutex);
ret = aac_do_ioctl(file-private_data, cmd, (void __user *)arg);
-- 
1.7.7.3

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


[V2 PATCH 10/11] aacraid: AIF raw device remove support

2015-03-26 Thread Mahesh Rajashekhara
Add AIF raw device remove support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |3 +++
 drivers/scsi/aacraid/commsup.c |   33 +
 2 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 2ba158b..fe014a6 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2065,6 +2065,9 @@ extern struct aac_common aac_config;
 /* PMC NEW COMM: Request the event data */
 #defineAifReqEvent 200
 
+/* RAW device deleted */
+#defineAifRawDeviceRemove  203
+
 /*
  * Adapter Initiated FIB command structures. Start with the adapter
  * initiated FIBs that really come from the adapter, and get responded
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 1a3c0e0..4da5749 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -883,6 +883,39 @@ static void aac_handle_aif(struct aac_dev * dev, struct 
fib * fibptr)
switch (le32_to_cpu(aifcmd-command)) {
case AifCmdDriverNotify:
switch (le32_to_cpu(((__le32 *)aifcmd-data)[0])) {
+   case AifRawDeviceRemove:
+   container = le32_to_cpu(((__le32 *)aifcmd-data)[1]);
+   if ((container  28)) {
+   container = (u32)-1;
+   break;
+   }
+   channel = (container  24)  0xF;
+   if (channel = dev-maximum_num_channels) {
+   container = (u32)-1;
+   break;
+   }
+   id = container  0x;
+   if (id = dev-maximum_num_physicals) {
+   container = (u32)-1;
+   break;
+   }
+   lun = (container  16)  0xFF;
+   container = (u32)-1;
+   channel = aac_phys_to_logical(channel);
+   device_config_needed =
+ (((__le32 *)aifcmd-data)[0] ==
+   cpu_to_le32(AifRawDeviceRemove)) ? DELETE : ADD;
+
+   if (device_config_needed == ADD) {
+   device = scsi_device_lookup(
+   dev-scsi_host_ptr,
+   channel, id, lun);
+   if (device) {
+   scsi_remove_device(device);
+   scsi_device_put(device);
+   }
+   }
+   break;
/*
 *  Morph or Expand complete
 */
-- 
1.7.7.3

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


[V2 PATCH 07/11] aacraid: IOP RESET command handling changes

2015-03-26 Thread Mahesh Rajashekhara
Add IOP RESET command handling changes

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |1 +
 drivers/scsi/aacraid/comminit.c |4 +++-
 drivers/scsi/aacraid/src.c  |   36 +++-
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index bf14ae0..9b469a4 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1216,6 +1216,7 @@ struct aac_dev
int sync_mode;
struct fib  *sync_fib;
struct list_headsync_fib_list;
+   u32 doorbell_mask;
u32 max_msix;   /* max. MSI-X vectors */
u32 vector_cap; /* MSI-X vector capab.*/
int msi_enabled;/* MSI/MSI-X enabled */
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index fdd9524..284b1c5 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -358,8 +358,10 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
dev-raw_io_interface = dev-raw_io_64 = 0;
 
if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES,
-   0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) 
+   0, 0, 0, 0, 0, 0,
+   status+0, status+1, status+2, status+3, NULL)) 
(status[0] == 0x0001)) {
+   dev-doorbell_mask = status[3];
if (status[1]  le32_to_cpu(AAC_OPT_NEW_COMM_64))
dev-raw_io_64 = 1;
dev-sync_mode = aac_sync_mode;
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 50f181f..4a963cd 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -204,6 +204,7 @@ static int src_sync_cmd(struct aac_dev *dev, u32 command,
u32 *status, u32 * r1, u32 * r2, u32 * r3, u32 * r4)
 {
unsigned long start;
+   unsigned long delay;
int ok;
 
/*
@@ -246,10 +247,14 @@ static int src_sync_cmd(struct aac_dev *dev, u32 command,
ok = 0;
start = jiffies;
 
-   /*
-*  Wait up to 5 minutes
-*/
-   while (time_before(jiffies, start+300*HZ)) {
+   if (command == IOP_RESET_ALWAYS) {
+   /* Wait up to 10 sec */
+   delay = 10*HZ;
+   } else {
+   /* Wait up to 5 minutes */
+   delay = 300*HZ;
+   }
+   while (time_before(jiffies, start+delay)) {
udelay(5);  /* Delay 5 microseconds to let Mon960 
get info. */
/*
 *  Mon960 will set doorbell0 bit when it has 
completed the command.
@@ -574,10 +579,17 @@ static int aac_src_restart_adapter(struct aac_dev *dev, 
int bled)
if (bled)
printk(KERN_ERR %s%d: adapter kernel panic'd %x.\n,
dev-name, dev-id, bled);
+   dev-a_ops.adapter_enable_int = aac_src_disable_interrupt;
bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS,
0, 0, 0, 0, 0, 0, var, reset_mask, NULL, NULL, NULL);
-   if (bled || (var != 0x0001))
-   return -EINVAL;
+   if ((bled || (var != 0x0001)) 
+   !dev-doorbell_mask)
+   return -EINVAL;
+   else if (dev-doorbell_mask) {
+   reset_mask = dev-doorbell_mask;
+   bled = 0;
+   var = 0x0001;
+   }
 
if ((dev-pdev-device == PMC_DEVICE_S7 ||
dev-pdev-device == PMC_DEVICE_S8 ||
@@ -587,10 +599,13 @@ static int aac_src_restart_adapter(struct aac_dev *dev, 
int bled)
msleep(5000); /* Delay 5 seconds */
}
 
-   if (dev-supplement_adapter_info.SupportedOptions2 
-   AAC_OPTION_DOORBELL_RESET) {
+   if (!bled  (dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_DOORBELL_RESET)) {
src_writel(dev, MUnit.IDR, reset_mask);
ssleep(45);
+   } else {
+   src_writel(dev, MUnit.IDR, 0x100);
+   ssleep(45);
}
}
 
@@ -612,7 +627,6 @@ int aac_src_select_comm(struct aac_dev *dev, int comm)
 {
switch (comm) {
case AAC_COMM_MESSAGE:
-   dev-a_ops.adapter_enable_int = 
aac_src_enable_interrupt_message;
dev-a_ops.adapter_intr = aac_src_intr_message;
dev-a_ops.adapter_deliver = aac_src_deliver_message

[V2 PATCH 05/11] aacraid: vpd page code 0x83 support

2015-03-26 Thread Mahesh Rajashekhara
Add vpd page code 0x83 support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c |  165 ++---
 1 files changed, 153 insertions(+), 12 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index aee3eaa..09027e9 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -163,6 +163,48 @@ struct inquiry_data {
u8 inqd_prl[4]; /* Product Revision Level */
 };
 
+/* Added for VPD 0x83 */
+typedef struct {
+   u8 CodeSet:4;   /* VPD_CODE_SET */
+   u8 Reserved:4;
+   u8 IdentifierType:4;/* VPD_IDENTIFIER_TYPE */
+   u8 Reserved2:4;
+   u8 Reserved3;
+   u8 IdentifierLength;
+   u8 VendId[8];
+   u8 ProductId[16];
+   u8 SerialNumber[8]; /* SN in ASCII */
+
+} TVPD_ID_Descriptor_Type_1;
+
+typedef struct {
+   u8 CodeSet:4;   /* VPD_CODE_SET */
+   u8 Reserved:4;
+   u8 IdentifierType:4;/* VPD_IDENTIFIER_TYPE */
+   u8 Reserved2:4;
+   u8 Reserved3;
+   u8 IdentifierLength;
+   struct TEU64Id {
+   u32 Serial;
+/* The serial number supposed to be 40 bits,
+ * bit we only support 32, so make the last byte zero. */
+   u8 Reserved;
+   u8 VendId[3];
+   } EU64Id;
+
+} TVPD_ID_Descriptor_Type_2;
+
+typedef struct {
+   u8 DeviceType:5;
+   u8 DeviceTypeQualifier:3;
+   u8 PageCode;
+   u8 Reserved;
+   u8 PageLength;
+   TVPD_ID_Descriptor_Type_1 IdDescriptorType1;
+   TVPD_ID_Descriptor_Type_2 IdDescriptorType2;
+
+} TVPD_Page83;
+
 /*
  *  M O D U L E   G L O B A L S
  */
@@ -890,14 +932,88 @@ static void get_container_serial_callback(void *context, 
struct fib * fibptr)
get_serial_reply = (struct aac_get_serial_resp *) fib_data(fibptr);
/* Failure is irrelevant, using default value instead */
if (le32_to_cpu(get_serial_reply-status) == CT_OK) {
-   char sp[13];
-   /* EVPD bit set */
-   sp[0] = INQD_PDT_DA;
-   sp[1] = scsicmd-cmnd[2];
-   sp[2] = 0;
-   sp[3] = snprintf(sp+4, sizeof(sp)-4, %08X,
- le32_to_cpu(get_serial_reply-uid));
-   scsi_sg_copy_from_buffer(scsicmd, sp, sizeof(sp));
+   /*Check to see if it's for VPD 0x83 or 0x80 */
+   if (scsicmd-cmnd[2] == 0x83) {
+   /* vpd page 0x83 - Device Identification Page */
+   int i;
+   TVPD_Page83 VPDPage83Data;
+
+   memset(((u8 *)VPDPage83Data), 0,
+  sizeof(VPDPage83Data));
+
+   /* DIRECT_ACCESS_DEVIC */
+   VPDPage83Data.DeviceType = 0;
+   /* DEVICE_CONNECTED */
+   VPDPage83Data.DeviceTypeQualifier = 0;
+   /* VPD_DEVICE_IDENTIFIERS */
+   VPDPage83Data.PageCode = 0x83;
+   VPDPage83Data.Reserved = 0;
+   VPDPage83Data.PageLength =
+   sizeof(VPDPage83Data.IdDescriptorType1) +
+   sizeof(VPDPage83Data.IdDescriptorType2);
+
+   /* T10 Vendor Identifier Field Format */
+   /* VpdCodeSetAscii */
+   VPDPage83Data.IdDescriptorType1.CodeSet = 2;
+   /* VpdIdentifierTypeVendorId */
+   VPDPage83Data.IdDescriptorType1.IdentifierType = 1;
+   VPDPage83Data.IdDescriptorType1.IdentifierLength =
+   sizeof(VPDPage83Data.IdDescriptorType1) - 4;
+
+   /* ADAPTEC  for adaptec */
+   memcpy(VPDPage83Data.IdDescriptorType1.VendId,
+   ADAPTEC ,
+   sizeof(VPDPage83Data.IdDescriptorType1.VendId));
+   memcpy(VPDPage83Data.IdDescriptorType1.ProductId,
+   ARRAY   ,
+   sizeof(
+   VPDPage83Data.IdDescriptorType1.ProductId));
+
+   /* Convert to ascii based serial number.
+* The LSB is the the end.
+*/
+   for (i = 0; i  8; i++) {
+   u8 temp =
+   (u8)((get_serial_reply-uid  ((7 - i) 
* 4))  0xF);
+   if (temp   0x9) {
+   
VPDPage83Data.IdDescriptorType1.SerialNumber[i] =
+   'A' + (temp - 0xA);
+   } else {
+   
VPDPage83Data.IdDescriptorType1.SerialNumber[i

[V2 PATCH 06/11] aacraid: 240 simple volume support

2015-03-26 Thread Mahesh Rajashekhara
Add 240 simple volume support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c  |5 +
 drivers/scsi/aacraid/aacraid.h |3 +++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 09027e9..9b3dd6e 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -462,6 +462,11 @@ int aac_get_containers(struct aac_dev *dev)
if (status = 0) {
dresp = (struct aac_get_container_count_resp *)fib_data(fibptr);
maximum_num_containers = 
le32_to_cpu(dresp-ContainerSwitchEntries);
+   if (fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_SUPPORTED_240_VOLUMES) {
+   maximum_num_containers =
+   le32_to_cpu(dresp-MaxSimpleVolumes);
+   }
aac_fib_complete(fibptr);
}
/* FIB should be freed only after getting the response from the F/W */
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 015c341..bf14ae0 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1016,6 +1016,8 @@ struct aac_supplement_adapter_info
 #define AAC_OPTION_DOORBELL_RESET  cpu_to_le32(0x4000)
 /* 4KB sector size */
 #define AAC_OPTION_VARIABLE_BLOCK_SIZE cpu_to_le32(0x0004)
+/* 240 simple volume support */
+#define AAC_OPTION_SUPPORTED_240_VOLUMES cpu_to_le32(0x1000)
 #define AAC_SIS_VERSION_V3 3
 #define AAC_SIS_SLOT_UNKNOWN   0xFF
 
@@ -1751,6 +1753,7 @@ struct aac_get_container_count_resp {
__le32  MaxContainers;
__le32  ContainerSwitchEntries;
__le32  MaxPartitions;
+   __le32  MaxSimpleVolumes;
 };
 
 
-- 
1.7.7.3

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


[V2 PATCH 09/11] aacraid: performance improvement changes

2015-03-26 Thread Mahesh Rajashekhara
Add performance improvement changes.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |5 +++--
 drivers/scsi/aacraid/comminit.c |4 ++--
 drivers/scsi/aacraid/commsup.c  |   37 ++---
 drivers/scsi/aacraid/dpcsup.c   |4 ++--
 drivers/scsi/aacraid/linit.c|   37 +++--
 drivers/scsi/aacraid/rx.c   |   14 +++---
 drivers/scsi/aacraid/src.c  |   14 ++
 7 files changed, 57 insertions(+), 58 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 43d8076..2ba158b 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  *  D E F I N E S
  
**/
 
-#define AAC_MAX_MSIX   32  /* vectors */
+#define AAC_MAX_MSIX   8   /* vectors */
 #define AAC_PCI_MSI_ENABLE 0x8000
 
 enum {
@@ -633,7 +633,8 @@ struct aac_queue {
spinlock_t  lockdata;   /* Actual lock (used only on 
one side of the lock) */
struct list_headcmdq;   /* A queue of FIBs which need 
to be prcessed by the FS thread. This is */
/* only valid for command 
queues which receive entries from the adapter. */
-   u32 numpending; /* Number of entries on 
outstanding queue. */
+   /* Number of entries on outstanding queue. */
+   atomic_tnumpending;
struct aac_dev *dev;/* Back pointer to adapter 
structure */
 };
 
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 27432b9..45db84a 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -53,7 +53,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void 
**commaddr, unsigned long co
 {
unsigned char *base;
unsigned long size, align;
-   const unsigned long fibsize = 4096;
+   const unsigned long fibsize = dev-max_fib_size;
const unsigned long printfbufsiz = 256;
unsigned long host_rrq_size = 0;
struct aac_init *init;
@@ -182,7 +182,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void 
**commaddr, unsigned long co
 
 static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 
*mem, int qsize)
 {
-   q-numpending = 0;
+   atomic_set(q-numpending, 0);
q-dev = dev;
init_waitqueue_head(q-cmdready);
INIT_LIST_HEAD(q-cmdq);
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index e615a0b..1a3c0e0 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -208,14 +208,10 @@ struct fib *aac_fib_alloc(struct aac_dev *dev)
 
 void aac_fib_free(struct fib *fibptr)
 {
-   unsigned long flags, flagsv;
+   unsigned long flags;
 
-   spin_lock_irqsave(fibptr-event_lock, flagsv);
-   if (fibptr-done == 2) {
-   spin_unlock_irqrestore(fibptr-event_lock, flagsv);
+   if (fibptr-done == 2)
return;
-   }
-   spin_unlock_irqrestore(fibptr-event_lock, flagsv);
 
spin_lock_irqsave(fibptr-dev-fib_lock, flags);
if (unlikely(fibptr-flags  FIB_CONTEXT_FLAG_TIMED_OUT))
@@ -321,7 +317,7 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, 
struct aac_entry **entr
/* Queue is full */
if ((*index + 1) == le32_to_cpu(*(q-headers.consumer))) {
printk(KERN_WARNING Queue %d full, %u outstanding.\n,
-   qid, q-numpending);
+   qid, atomic_read(q-numpending));
return 0;
} else {
*entry = q-base + *index;
@@ -414,7 +410,6 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
struct aac_dev * dev = fibptr-dev;
struct hw_fib * hw_fib = fibptr-hw_fib_va;
unsigned long flags = 0;
-   unsigned long qflags;
unsigned long mflags = 0;
unsigned long sflags = 0;
 
@@ -568,9 +563,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
int blink;
if (time_is_before_eq_jiffies(timeout)) {
struct aac_queue * q = 
dev-queues-queue[AdapNormCmdQueue];
-   spin_lock_irqsave(q-lock, qflags);
-   q-numpending--;
-   spin_unlock_irqrestore(q-lock, qflags);
+   atomic_dec(q-numpending);
if (wait == -1) {
printk(KERN_ERR aacraid: 
aac_fib_send: first asynchronous command timed out.\n

[V2 PATCH 11/11] aacraid: driver version change

2015-03-26 Thread Mahesh Rajashekhara
Add driver version and build change

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/aacraid/linit.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index fe014a6..40fe65c 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 30300
+# define AAC_DRIVER_BUILD 40709
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c
index 7bbf1b3..9eec027 100644
--- a/drivers/scsi/aacraid/linit.c
+++ b/drivers/scsi/aacraid/linit.c
@@ -56,7 +56,7 @@
 
 #include aacraid.h
 
-#define AAC_DRIVER_VERSION 1.2-0
+#define AAC_DRIVER_VERSION 1.2-1
 #ifndef AAC_DRIVER_BRANCH
 #define AAC_DRIVER_BRANCH  
 #endif
-- 
1.7.7.3

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


[V2 PATCH 04/11] aacraid: MSI-x support

2015-03-26 Thread Mahesh Rajashekhara
Add MSI-x interrupt mode support.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |   80 -
 drivers/scsi/aacraid/comminit.c |   95 +-
 drivers/scsi/aacraid/commsup.c  |   20 ++-
 drivers/scsi/aacraid/dpcsup.c   |9 +-
 drivers/scsi/aacraid/linit.c|   20 ++-
 drivers/scsi/aacraid/src.c  |  388 ++-
 6 files changed, 505 insertions(+), 107 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9e38b20..015c341 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -6,11 +6,61 @@
 #define nblank(x) _nblank(x)[0]
 
 #include linux/interrupt.h
+#include linux/pci.h
 
 
/*--
  *  D E F I N E S
  
**/
 
+#define AAC_MAX_MSIX   32  /* vectors */
+#define AAC_PCI_MSI_ENABLE 0x8000
+
+enum {
+   AAC_ENABLE_INTERRUPT= 0x0,
+   AAC_DISABLE_INTERRUPT,
+   AAC_ENABLE_MSIX,
+   AAC_DISABLE_MSIX,
+   AAC_CLEAR_AIF_BIT,
+   AAC_CLEAR_SYNC_BIT,
+   AAC_ENABLE_INTX
+};
+
+#define AAC_INT_MODE_INTX  (10)
+#define AAC_INT_MODE_MSI   (11)
+#define AAC_INT_MODE_AIF   (12)
+#define AAC_INT_MODE_SYNC  (13)
+
+#define AAC_INT_ENABLE_TYPE1_INTX  0xfffb
+#define AAC_INT_ENABLE_TYPE1_MSIX  0xfffa
+#define AAC_INT_DISABLE_ALL0x
+
+/* Bit definitions in IOA-Host Interrupt Register */
+#define PMC_TRANSITION_TO_OPERATIONAL  (131)
+#define PMC_IOARCB_TRANSFER_FAILED (128)
+#define PMC_IOA_UNIT_CHECK (127)
+#define PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE (126)
+#define PMC_CRITICAL_IOA_OP_IN_PROGRESS(125)
+#define PMC_IOARRIN_LOST   (14)
+#define PMC_SYSTEM_BUS_MMIO_ERROR  (13)
+#define PMC_IOA_PROCESSOR_IN_ERROR_STATE (12)
+#define PMC_HOST_RRQ_VALID (11)
+#define PMC_OPERATIONAL_STATUS (131)
+#define PMC_ALLOW_MSIX_VECTOR0 (10)
+
+#define PMC_IOA_ERROR_INTERRUPTS   (PMC_IOARCB_TRANSFER_FAILED | \
+PMC_IOA_UNIT_CHECK | \
+PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE | \
+PMC_IOARRIN_LOST | \
+PMC_SYSTEM_BUS_MMIO_ERROR | \
+PMC_IOA_PROCESSOR_IN_ERROR_STATE)
+
+#define PMC_ALL_INTERRUPT_BITS (PMC_IOA_ERROR_INTERRUPTS | \
+PMC_HOST_RRQ_VALID | \
+PMC_TRANSITION_TO_OPERATIONAL | \
+PMC_ALLOW_MSIX_VECTOR0)
+#definePMC_GLOBAL_INT_BIT2 0x0004
+#definePMC_GLOBAL_INT_BIT0 0x0001
+
 #ifndef AAC_DRIVER_BUILD
 # define AAC_DRIVER_BUILD 30300
 # define AAC_DRIVER_BRANCH -ms
@@ -36,6 +86,7 @@
 #define CONTAINER_TO_ID(cont)  (cont)
 #define CONTAINER_TO_LUN(cont) (0)
 
+#define PMC_DEVICE_S6  0x28b
 #define PMC_DEVICE_S7  0x28c
 #define PMC_DEVICE_S8  0x28d
 #define PMC_DEVICE_S9  0x28f
@@ -434,7 +485,7 @@ enum fib_xfer_state {
 struct aac_init
 {
__le32  InitStructRevision;
-   __le32  MiniPortRevision;
+   __le32  Sa_MSIXVectors;
__le32  fsrev;
__le32  CommHeaderAddress;
__le32  FastIoCommAreaAddress;
@@ -755,7 +806,8 @@ struct rkt_registers {
 
 struct src_mu_registers {
/*  PCI*| Name */
-   __le32  reserved0[8];   /*  00h | Reserved */
+   __le32  reserved0[6];   /*  00h | Reserved */
+   __le32  IOAR[2];/*  18h | IOA-host interrupt register */
__le32  IDR;/*  20h | Inbound Doorbell Register */
__le32  IISR;   /*  24h | Inbound Int. Status Register */
__le32  reserved1[3];   /*  28h | Reserved */
@@ -767,17 +819,18 @@ struct src_mu_registers {
__le32  OMR;/*  bch | Outbound Message Register */
__le32  IQ_L;   /*  c0h | Inbound Queue (Low address) */
__le32  IQ_H;   /*  c4h | Inbound Queue (High address) */
+   __le32  ODR_MSI;/*  c8h | MSI register for sync./AIF */
 };
 
 struct src_registers {
-   struct src_mu_registers MUnit;  /* 00h - c7h */
+   struct src_mu_registers MUnit;  /* 00h - cbh */
union {
struct {
-   __le32 reserved1[130790];   /* c8h - 7fc5fh */
+   __le32 reserved1[130789];   /* cch - 7fc5fh */
struct src_inbound IndexRegs;   /* 7fc60h */
} tupelo;
struct {
-   __le32 reserved1[974];  /* c8h - fffh

[V2 PATCH 03/11] aacraid: 4KB sector support

2015-03-26 Thread Mahesh Rajashekhara
Add 4KB sector support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c  |  240 +++
 drivers/scsi/aacraid/aacraid.h |   11 ++-
 2 files changed, 200 insertions(+), 51 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index b32e77d..aee3eaa 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -111,6 +111,41 @@
 #define BYTE2(x) (unsigned char)((x)  16)
 #define BYTE3(x) (unsigned char)((x)  24)
 
+/* MODE_SENSE data format */
+typedef struct {
+   struct {
+   u8  data_length;
+   u8  med_type;
+   u8  dev_par;
+   u8  bd_length;
+   } __attribute__((packed)) hd;
+   struct {
+   u8  dens_code;
+   u8  block_count[3];
+   u8  reserved;
+   u8  block_length[3];
+   } __attribute__((packed)) bd;
+   u8  mpc_buf[3];
+} __attribute__((packed)) aac_modep_data;
+
+/* MODE_SENSE_10 data format */
+typedef struct {
+   struct {
+   u8  data_length[2];
+   u8  med_type;
+   u8  dev_par;
+   u8  rsrvd[2];
+   u8  bd_length[2];
+   } __attribute__((packed)) hd;
+   struct {
+   u8  dens_code;
+   u8  block_count[3];
+   u8  reserved;
+   u8  block_length[3];
+   } __attribute__((packed)) bd;
+   u8  mpc_buf[3];
+} __attribute__((packed)) aac_modep10_data;
+
 
/*--
  *  S T R U C T S / T Y P E D E F S
  
**/
@@ -438,7 +473,7 @@ static void get_container_name_callback(void *context, 
struct fib * fibptr)
if ((le32_to_cpu(get_name_reply-status) == CT_OK)
  (get_name_reply-data[0] != '\0')) {
char *sp = get_name_reply-data;
-   sp[sizeof(((struct aac_get_name_resp *)NULL)-data)-1] = '\0';
+   sp[sizeof(((struct aac_get_name_resp *)NULL)-data)] = '\0';
while (*sp == ' ')
++sp;
if (*sp) {
@@ -539,6 +574,14 @@ static void _aac_probe_container2(void * context, struct 
fib * fibptr)
if ((le32_to_cpu(dresp-status) == ST_OK) 
(le32_to_cpu(dresp-mnt[0].vol) != CT_NONE) 
(le32_to_cpu(dresp-mnt[0].state) != FSCS_HIDDEN)) {
+   if 
(!(fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE)) {
+   dresp-mnt[0].fileinfo.bdevinfo.block_size = 
0x200;
+   fsa_dev_ptr-block_size = 0x200;
+   } else {
+   fsa_dev_ptr-block_size =
+   
le32_to_cpu(dresp-mnt[0].fileinfo.bdevinfo.block_size);
+   }
fsa_dev_ptr-valid = 1;
/* sense_key holds the current state of the spin-up */
if (dresp-mnt[0].state  cpu_to_le32(FSCS_NOT_READY))
@@ -571,7 +614,9 @@ static void _aac_probe_container1(void * context, struct 
fib * fibptr)
int status;
 
dresp = (struct aac_mount *) fib_data(fibptr);
-   dresp-mnt[0].capacityhigh = 0;
+   if (!(fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE))
+   dresp-mnt[0].capacityhigh = 0;
if ((le32_to_cpu(dresp-status) != ST_OK) ||
(le32_to_cpu(dresp-mnt[0].vol) != CT_NONE)) {
_aac_probe_container2(context, fibptr);
@@ -586,7 +631,12 @@ static void _aac_probe_container1(void * context, struct 
fib * fibptr)
 
dinfo = (struct aac_query_mount *)fib_data(fibptr);
 
-   dinfo-command = cpu_to_le32(VM_NameServe64);
+   if (fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE)
+   dinfo-command = cpu_to_le32(VM_NameServeAllBlk);
+   else
+   dinfo-command = cpu_to_le32(VM_NameServe64);
+
dinfo-count = cpu_to_le32(scmd_id(scsicmd));
dinfo-type = cpu_to_le32(FT_FILESYS);
 
@@ -621,7 +671,12 @@ static int _aac_probe_container(struct scsi_cmnd * 
scsicmd, int (*callback)(stru
 
dinfo = (struct aac_query_mount *)fib_data(fibptr);
 
-   dinfo-command = cpu_to_le32(VM_NameServe);
+   if (fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE)
+   dinfo-command = cpu_to_le32(VM_NameServeAllBlk);
+   else
+   dinfo-command = cpu_to_le32(VM_NameServe

[V2 PATCH 01/11] aacraid: AIF support for SES device add/remove

2015-03-26 Thread Mahesh Rajashekhara
Add new AIF support for SES device add/remove

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |2 ++
 drivers/scsi/aacraid/commsup.c |8 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index eaaf870..284db39 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1951,6 +1951,8 @@ extern struct aac_common aac_config;
 #defineAifEnEnclosureManagement 13 /* EM_DRIVE_* */
 #defineEM_DRIVE_INSERTION  31
 #defineEM_DRIVE_REMOVAL32
+#defineEM_SES_DRIVE_INSERTION  33
+#defineEM_SES_DRIVE_REMOVAL26
 #defineAifEnBatteryEvent   14  /* Change in 
Battery State */
 #defineAifEnAddContainer   15  /* A new array 
was created */
 #defineAifEnDeleteContainer16  /* A container 
was deleted */
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index cab190a..090ba68 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1044,6 +1044,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct 
fib * fibptr)
switch (le32_to_cpu(((__le32 *)aifcmd-data)[3])) {
case EM_DRIVE_INSERTION:
case EM_DRIVE_REMOVAL:
+   case EM_SES_DRIVE_INSERTION:
+   case EM_SES_DRIVE_REMOVAL:
container = le32_to_cpu(
((__le32 *)aifcmd-data)[2]);
if ((container  28)) {
@@ -1069,8 +1071,10 @@ static void aac_handle_aif(struct aac_dev * dev, struct 
fib * fibptr)
}
channel = aac_phys_to_logical(channel);
device_config_needed =
- (((__le32 *)aifcmd-data)[3]
-   == cpu_to_le32(EM_DRIVE_INSERTION)) ?
+ __le32 *)aifcmd-data)[3]
+   == cpu_to_le32(EM_DRIVE_INSERTION)) ||
+   (((__le32 *)aifcmd-data)[3]
+   == cpu_to_le32(EM_SES_DRIVE_INSERTION))) ?
  ADD : DELETE;
break;
}
-- 
1.7.7.3

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


[V2 PATCH 00/11] aacraid driver updates

2015-03-26 Thread Mahesh Rajashekhara
This patch set includes some important bug fixes and new feature supports.

V2:
Separated unrelated patches from the VPD support one
Fixed indentation issues
Separated version increase and applied at the end

Mahesh Rajashekhara (11):
  aacraid: AIF support for SES device add/remove
  aacraid: IOCTL pass-through command fix
  aacraid: 4KB sector support
  aacraid: MSI-x support
  aacraid: vpd page code 0x83 support
  aacraid: 240 simple volume support
  aacraid: IOP RESET command handling changes
  aacraid: IOCTL fix
  aacraid: performance improvement changes
  aacraid: AIF raw device remove support
  aacraid: driver version change

 drivers/scsi/aacraid/aachba.c   |  410 +++--
 drivers/scsi/aacraid/aacraid.h  |  106 +-
 drivers/scsi/aacraid/commctrl.c |   10 +-
 drivers/scsi/aacraid/comminit.c |  106 +-
 drivers/scsi/aacraid/commsup.c  |   96 +++--
 drivers/scsi/aacraid/dpcsup.c   |   13 +-
 drivers/scsi/aacraid/linit.c|   61 --
 drivers/scsi/aacraid/rx.c   |   14 +-
 drivers/scsi/aacraid/src.c  |  438 +-
 9 files changed, 1012 insertions(+), 242 deletions(-)

-- 
1.7.7.3

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


[V2 PATCH 02/11] aacraid: IOCTL pass-through command fix

2015-03-26 Thread Mahesh Rajashekhara
The Linux aacriad driver fails to detect the case of SG list count=0 on IOCTL 
pass-through command and cause intermittent fault.
The result is the Linux aacriad driver send down IOCTL pass-through command 
with one not initialized SG list to firmware when receiving SG list count =0 on 
pass-through command.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/commctrl.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index fbcd48d..54195a1 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -689,7 +689,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
kfree (usg);
}
srbcmd-count = cpu_to_le32(byte_count);
-   psg-count = cpu_to_le32(sg_indx+1);
+   if (user_srbcmd-sg.count)
+   psg-count = cpu_to_le32(sg_indx+1);
+   else
+   psg-count = 0;
status = aac_fib_send(ScsiPortCommand64, srbfib, 
actual_fibsize, FsaNormal, 1, 1,NULL,NULL);
} else {
struct user_sgmap* upsg = user_srbcmd-sg;
@@ -775,7 +778,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
}
}
srbcmd-count = cpu_to_le32(byte_count);
-   psg-count = cpu_to_le32(sg_indx+1);
+   if (user_srbcmd-sg.count)
+   psg-count = cpu_to_le32(sg_indx+1);
+   else
+   psg-count = 0;
status = aac_fib_send(ScsiPortCommand, srbfib, actual_fibsize, 
FsaNormal, 1, 1, NULL, NULL);
}
if (status == -ERESTARTSYS) {
-- 
1.7.7.3

--
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 7/7] aacraid: AIF raw device remove support

2015-03-26 Thread Mahesh Rajashekhara
Thanks for your review comments. I have prepared V2 patch set and in which I 
have taken care all your review comments. 

Regards,
Mahesh

-Original Message-
From: Hannes Reinecke [mailto:h...@suse.de] 
Sent: Wednesday, March 18, 2015 4:59 PM
To: Achim Leubner; Mahesh Rajashekhara; jbottom...@parallels.com; 
linux-scsi@vger.kernel.org
Subject: Re: [PATCH 7/7] aacraid: AIF raw device remove support

On 03/17/2015 04:28 PM, Achim Leubner wrote:
 Reviewed-by: Achim Leubner achim.leub...@pmcs.com
 
 
 -Original Message-
 From: Mahesh Rajashekhara
 Sent: Wednesday, March 4, 2015 9:39 AM
 To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
 Cc: aacr...@pmc-sierra.com; Harry Yang; Achim Leubner; Rajinikanth 
 Pandurangan; Rich Bono; Mahesh Rajashekhara
 Subject: [PATCH 7/7] aacraid: AIF raw device remove support
 
 Add AIF raw device remove support
 
 Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
Reviewed-by: Hannes Reinecke h...@suse.de

But please split off the unrelated patches from the VPD support one.
And I would recommend to split off the version increase into a separate one, 
too, to be applied at the end.
Otherwise it'll be hard to track which patches belong to which version.

Cheers,

Hannes
-- 
Dr. Hannes ReineckezSeries  Storage
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton HRB 21284 (AG 
Nürnberg)
--
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/7] aacraid driver updates

2015-03-16 Thread Mahesh Rajashekhara
Hi James,

Can you please let me know the status of this patch set which I submitted 
sometime back.

Thanks,
Mahesh

-Original Message-
From: Mahesh Rajashekhara 
Sent: Wednesday, March 04, 2015 2:08 PM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Achim Leubner; Rajinikanth Pandurangan; 
Rich Bono; Mahesh Rajashekhara
Subject: [PATCH 0/7] aacraid driver updates

This patch set includes some important bug fixes and new feature supports.

Mahesh Rajashekhara (7):
  aacraid: AIF support for SES device add/remove
  aacraid: IOCTL pass-through command fix
  aacraid: 4KB sector support
  aacraid: MSI-x support
  aacraid: vpd page code 0x83 support
  aacraid: performance improvement changes
  aacraid: AIF raw device remove support

 drivers/scsi/aacraid/aachba.c   |  355 +--
 drivers/scsi/aacraid/aacraid.h  |  102 +-
 drivers/scsi/aacraid/commctrl.c |   10 +-
 drivers/scsi/aacraid/comminit.c |  106 ++-
 drivers/scsi/aacraid/commsup.c  |   78 ++--
 drivers/scsi/aacraid/dpcsup.c   |   13 +-
 drivers/scsi/aacraid/linit.c|   48 +++--
 drivers/scsi/aacraid/rx.c   |   14 +-
 drivers/scsi/aacraid/src.c  |  404 +--
 9 files changed, 894 insertions(+), 236 deletions(-)

-- 
1.7.7.3

--
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 7/7] aacraid: AIF raw device remove support

2015-03-04 Thread Mahesh Rajashekhara
Add AIF raw device remove support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |3 +++
 drivers/scsi/aacraid/commsup.c |   32 
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 74a0440..5aaa9a6 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -2061,6 +2061,9 @@ extern struct aac_common aac_config;
 /* PMC NEW COMM: Request the event data */
 #defineAifReqEvent 200
 
+/* RAW device deleted */
+#defineAifRawDeviceRemove  203
+
 /*
  * Adapter Initiated FIB command structures. Start with the adapter
  * initiated FIBs that really come from the adapter, and get responded
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 0555023..8bb9ee4 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -884,6 +884,38 @@ static void aac_handle_aif(struct aac_dev * dev, struct 
fib * fibptr)
switch (le32_to_cpu(aifcmd-command)) {
case AifCmdDriverNotify:
switch (le32_to_cpu(((__le32 *)aifcmd-data)[0])) {
+   case AifRawDeviceRemove:
+   container = le32_to_cpu(((__le32 *)aifcmd-data)[1]);
+   if ((container  28)) {
+   container = (u32)-1;
+   break;
+   }
+   channel = (container  24)  0xF;
+   if (channel = dev-maximum_num_channels) {
+   container = (u32)-1;
+   break;
+   }
+   id = container  0x;
+   if (id = dev-maximum_num_physicals) {
+   container = (u32)-1;
+   break;
+   }
+   lun = (container  16)  0xFF;
+   container = (u32)-1;
+   channel = aac_phys_to_logical(channel);
+   device_config_needed =
+ (((__le32 *)aifcmd-data)[0] ==
+   cpu_to_le32(AifRawDeviceRemove)) ? DELETE : ADD;
+
+   if (device_config_needed == ADD) {
+   device = scsi_device_lookup(dev-scsi_host_ptr, 
channel, id, lun);
+   if (device) {
+   scsi_remove_device(device);
+   scsi_device_put(device);
+   }
+   }
+   break;
+
/*
 *  Morph or Expand complete
 */
-- 
1.7.7.3

--
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 0/7] aacraid driver updates

2015-03-04 Thread Mahesh Rajashekhara
This patch set includes some important bug fixes and new feature supports.

Mahesh Rajashekhara (7):
  aacraid: AIF support for SES device add/remove
  aacraid: IOCTL pass-through command fix
  aacraid: 4KB sector support
  aacraid: MSI-x support
  aacraid: vpd page code 0x83 support
  aacraid: performance improvement changes
  aacraid: AIF raw device remove support

 drivers/scsi/aacraid/aachba.c   |  355 +--
 drivers/scsi/aacraid/aacraid.h  |  102 +-
 drivers/scsi/aacraid/commctrl.c |   10 +-
 drivers/scsi/aacraid/comminit.c |  106 ++-
 drivers/scsi/aacraid/commsup.c  |   78 ++--
 drivers/scsi/aacraid/dpcsup.c   |   13 +-
 drivers/scsi/aacraid/linit.c|   48 +++--
 drivers/scsi/aacraid/rx.c   |   14 +-
 drivers/scsi/aacraid/src.c  |  404 +--
 9 files changed, 894 insertions(+), 236 deletions(-)

-- 
1.7.7.3

--
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 2/7] aacraid: IOCTL pass-through command fix

2015-03-04 Thread Mahesh Rajashekhara
The Linux aacriad driver fails to detect the case of SG list count=0 on IOCTL 
pass-through command and cause intermittent fault.
The result is the Linux aacriad driver send down IOCTL pass-through command 
with one not initialized SG list to firmware when receiving SG list count =0 on 
pass-through command.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/commctrl.c |   10 --
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index fbcd48d..54195a1 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -689,7 +689,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
kfree (usg);
}
srbcmd-count = cpu_to_le32(byte_count);
-   psg-count = cpu_to_le32(sg_indx+1);
+   if (user_srbcmd-sg.count)
+   psg-count = cpu_to_le32(sg_indx+1);
+   else
+   psg-count = 0;
status = aac_fib_send(ScsiPortCommand64, srbfib, 
actual_fibsize, FsaNormal, 1, 1,NULL,NULL);
} else {
struct user_sgmap* upsg = user_srbcmd-sg;
@@ -775,7 +778,10 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
}
}
srbcmd-count = cpu_to_le32(byte_count);
-   psg-count = cpu_to_le32(sg_indx+1);
+   if (user_srbcmd-sg.count)
+   psg-count = cpu_to_le32(sg_indx+1);
+   else
+   psg-count = 0;
status = aac_fib_send(ScsiPortCommand, srbfib, actual_fibsize, 
FsaNormal, 1, 1, NULL, NULL);
}
if (status == -ERESTARTSYS) {
-- 
1.7.7.3

--
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 4/7] aacraid: MSI-x support

2015-03-04 Thread Mahesh Rajashekhara
Add MSI-x interrupt mode support.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c   |6 +-
 drivers/scsi/aacraid/aacraid.h  |   79 -
 drivers/scsi/aacraid/comminit.c |   86 +-
 drivers/scsi/aacraid/commsup.c  |   19 ++-
 drivers/scsi/aacraid/dpcsup.c   |9 +-
 drivers/scsi/aacraid/linit.c|   18 ++-
 drivers/scsi/aacraid/src.c  |  365 +--
 7 files changed, 473 insertions(+), 109 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 0819644..eb524e6 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -473,7 +473,7 @@ static void get_container_name_callback(void *context, 
struct fib * fibptr)
if ((le32_to_cpu(get_name_reply-status) == CT_OK)
  (get_name_reply-data[0] != '\0')) {
char *sp = get_name_reply-data;
-   sp[sizeof(((struct aac_get_name_resp *)NULL)-data)-1] = '\0';
+   sp[sizeof(((struct aac_get_name_resp *)NULL)-data)] = '\0';
while (*sp == ' ')
++sp;
if (*sp) {
@@ -613,7 +613,9 @@ static void _aac_probe_container1(void * context, struct 
fib * fibptr)
int status;
 
dresp = (struct aac_mount *) fib_data(fibptr);
-   dresp-mnt[0].capacityhigh = 0;
+   if (!(fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE))
+   dresp-mnt[0].capacityhigh = 0;
if ((le32_to_cpu(dresp-status) != ST_OK) ||
(le32_to_cpu(dresp-mnt[0].vol) != CT_NONE)) {
_aac_probe_container2(context, fibptr);
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 93579f3..c162a65 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -6,11 +6,61 @@
 #define nblank(x) _nblank(x)[0]
 
 #include linux/interrupt.h
+#include linux/pci.h
 
 
/*--
  *  D E F I N E S
  
**/
 
+#define AAC_MAX_MSIX   32  /* vectors */
+#define AAC_PCI_MSI_ENABLE 0x8000
+
+enum {
+   AAC_ENABLE_INTERRUPT= 0x0,
+   AAC_DISABLE_INTERRUPT,
+   AAC_ENABLE_MSIX,
+   AAC_DISABLE_MSIX,
+   AAC_CLEAR_AIF_BIT,
+   AAC_CLEAR_SYNC_BIT,
+   AAC_ENABLE_INTX
+};
+
+#define AAC_INT_MODE_INTX  (10)
+#define AAC_INT_MODE_MSI   (11)
+#define AAC_INT_MODE_AIF   (12)
+#define AAC_INT_MODE_SYNC  (13)
+
+#define AAC_INT_ENABLE_TYPE1_INTX  0xfffb
+#define AAC_INT_ENABLE_TYPE1_MSIX  0xfffa
+#define AAC_INT_DISABLE_ALL0x
+
+/* Bit definitions in IOA-Host Interrupt Register */
+#define PMC_TRANSITION_TO_OPERATIONAL  (0x8000  0)
+#define PMC_IOARCB_TRANSFER_FAILED (0x8000  3)
+#define PMC_IOA_UNIT_CHECK (0x8000  4)
+#define PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE (0x8000  5)
+#define PMC_CRITICAL_IOA_OP_IN_PROGRESS(0x8000  6)
+#define PMC_IOARRIN_LOST   (0x8000  27)
+#define PMC_SYSTEM_BUS_MMIO_ERROR  (0x8000  28)
+#define PMC_IOA_PROCESSOR_IN_ERROR_STATE (0x8000  29)
+#define PMC_HOST_RRQ_VALID (0x8000  30)
+#define PMC_OPERATIONAL_STATUS (0x8000  0)
+#define PMC_ALLOW_MSIX_VECTOR0 (0x8000  31)
+
+#define PMC_IOA_ERROR_INTERRUPTS   (PMC_IOARCB_TRANSFER_FAILED | \
+PMC_IOA_UNIT_CHECK | \
+PMC_NO_HOST_RRQ_FOR_CMD_RESPONSE | \
+PMC_IOARRIN_LOST | \
+PMC_SYSTEM_BUS_MMIO_ERROR | \
+PMC_IOA_PROCESSOR_IN_ERROR_STATE)
+
+#define PMC_ALL_INTERRUPT_BITS (PMC_IOA_ERROR_INTERRUPTS | \
+PMC_HOST_RRQ_VALID | \
+PMC_TRANSITION_TO_OPERATIONAL | \
+PMC_ALLOW_MSIX_VECTOR0)
+#definePMC_GLOBAL_INT_BIT2 0x0004
+#definePMC_GLOBAL_INT_BIT0 0x0001
+
 #ifndef AAC_DRIVER_BUILD
 # define AAC_DRIVER_BUILD 30300
 # define AAC_DRIVER_BRANCH -ms
@@ -36,6 +86,7 @@
 #define CONTAINER_TO_ID(cont)  (cont)
 #define CONTAINER_TO_LUN(cont) (0)
 
+#define PMC_DEVICE_S6  0x28b
 #define PMC_DEVICE_S7  0x28c
 #define PMC_DEVICE_S8  0x28d
 #define PMC_DEVICE_S9  0x28f
@@ -434,7 +485,7 @@ enum fib_xfer_state {
 struct aac_init
 {
__le32  InitStructRevision;
-   __le32  MiniPortRevision;
+   __le32  NoOfMSIXVectors;
__le32  fsrev;
__le32  CommHeaderAddress;
__le32  FastIoCommAreaAddress;
@@ -755,7 +806,8 @@ struct rkt_registers {
 
 struct

[PATCH 3/7] aacraid: 4KB sector support

2015-03-04 Thread Mahesh Rajashekhara
Add 4KB sector support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c  |  195 +++-
 drivers/scsi/aacraid/aacraid.h |   10 ++-
 2 files changed, 160 insertions(+), 45 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index b32e77d..0819644 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -111,6 +111,41 @@
 #define BYTE2(x) (unsigned char)((x)  16)
 #define BYTE3(x) (unsigned char)((x)  24)
 
+/* MODE_SENSE data format */
+typedef struct {
+   struct {
+   u8  data_length;
+   u8  med_type;
+   u8  dev_par;
+   u8  bd_length;
+   } __attribute__((packed)) hd;
+   struct {
+   u8  dens_code;
+   u8  block_count[3];
+   u8  reserved;
+   u8  block_length[3];
+   } __attribute__((packed)) bd;
+   u8  mpc_buf[3];
+} __attribute__((packed)) aac_modep_data;
+
+/* MODE_SENSE_10 data format */
+typedef struct {
+   struct {
+   u8  data_length[2];
+   u8  med_type;
+   u8  dev_par;
+   u8  rsrvd[2];
+   u8  bd_length[2];
+   } __attribute__((packed)) hd;
+   struct {
+   u8  dens_code;
+   u8  block_count[3];
+   u8  reserved;
+   u8  block_length[3];
+   } __attribute__((packed)) bd;
+   u8  mpc_buf[3];
+} __attribute__((packed)) aac_modep10_data;
+
 
/*--
  *  S T R U C T S / T Y P E D E F S
  
**/
@@ -539,6 +574,13 @@ static void _aac_probe_container2(void * context, struct 
fib * fibptr)
if ((le32_to_cpu(dresp-status) == ST_OK) 
(le32_to_cpu(dresp-mnt[0].vol) != CT_NONE) 
(le32_to_cpu(dresp-mnt[0].state) != FSCS_HIDDEN)) {
+   if 
(!(fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE)) {
+   dresp-mnt[0].fileinfo.bdevinfo.block_size = 
0x200;
+   fsa_dev_ptr-block_size = 0x200;
+   } else {
+   fsa_dev_ptr-block_size = 
le32_to_cpu(dresp-mnt[0].fileinfo.bdevinfo.block_size);
+   }
fsa_dev_ptr-valid = 1;
/* sense_key holds the current state of the spin-up */
if (dresp-mnt[0].state  cpu_to_le32(FSCS_NOT_READY))
@@ -586,7 +628,12 @@ static void _aac_probe_container1(void * context, struct 
fib * fibptr)
 
dinfo = (struct aac_query_mount *)fib_data(fibptr);
 
-   dinfo-command = cpu_to_le32(VM_NameServe64);
+   if (fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE)
+   dinfo-command = cpu_to_le32(VM_NameServeAllBlk);
+   else
+   dinfo-command = cpu_to_le32(VM_NameServe64);
+
dinfo-count = cpu_to_le32(scmd_id(scsicmd));
dinfo-type = cpu_to_le32(FT_FILESYS);
 
@@ -621,7 +668,12 @@ static int _aac_probe_container(struct scsi_cmnd * 
scsicmd, int (*callback)(stru
 
dinfo = (struct aac_query_mount *)fib_data(fibptr);
 
-   dinfo-command = cpu_to_le32(VM_NameServe);
+   if (fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_VARIABLE_BLOCK_SIZE)
+   dinfo-command = cpu_to_le32(VM_NameServeAllBlk);
+   else
+   dinfo-command = cpu_to_le32(VM_NameServe);
+
dinfo-count = cpu_to_le32(scmd_id(scsicmd));
dinfo-type = cpu_to_le32(FT_FILESYS);
scsicmd-SCp.ptr = (char *)callback;
@@ -982,7 +1034,7 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
memset(readcmd2, 0, sizeof(struct aac_raw_io2));
readcmd2-blockLow = cpu_to_le32((u32)(lba0x));
readcmd2-blockHigh = 
cpu_to_le32((u32)((lba0xLL)32));
-   readcmd2-byteCount = cpu_to_le32(count9);
+   readcmd2-byteCount = cpu_to_le32(count * 
dev-fsa_dev[scmd_id(cmd)].block_size);
readcmd2-cid = cpu_to_le16(scmd_id(cmd));
readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
ret = aac_build_sgraw2(cmd, readcmd2,
@@ -997,7 +1049,7 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd = (struct aac_raw_io *) fib_data(fib);
readcmd-block[0] = cpu_to_le32((u32)(lba0x

[PATCH 5/7] aacraid: vpd page code 0x83 support

2015-03-04 Thread Mahesh Rajashekhara
Add vpd page code 0x83 support

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aachba.c   |  154 ---
 drivers/scsi/aacraid/aacraid.h  |4 +
 drivers/scsi/aacraid/comminit.c |8 ++-
 drivers/scsi/aacraid/commsup.c  |   12 +---
 drivers/scsi/aacraid/linit.c|   20 +
 drivers/scsi/aacraid/src.c  |   34 +++--
 6 files changed, 185 insertions(+), 47 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index eb524e6..3e4e0c8 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -163,6 +163,45 @@ struct inquiry_data {
u8 inqd_prl[4]; /* Product Revision Level */
 };
 
+/* Added for VPD 0x83 */
+typedef struct {
+   u8 CodeSet:4;   /* VPD_CODE_SET */
+   u8 Reserved:4;
+   u8 IdentifierType:4;/* VPD_IDENTIFIER_TYPE */
+   u8 Reserved2:4;
+   u8 Reserved3;
+   u8 IdentifierLength;
+   u8 VendId[8];
+   u8 ProductId[16];
+   u8 SerialNumber[8]; /* SN in ASCII */
+} TVPD_ID_Descriptor_Type_1;
+
+typedef struct {
+   u8 CodeSet:4;   /* VPD_CODE_SET */
+   u8 Reserved:4;
+   u8 IdentifierType:4;/* VPD_IDENTIFIER_TYPE */
+   u8 Reserved2:4;
+   u8 Reserved3;
+   u8 IdentifierLength;
+   struct TEU64Id {
+   u32 Serial;
+/* The serial number supposed to be 40 bits,
+ * bit we only support 32, so make the last byte zero. */
+   u8 Reserved;
+   u8 VendId[3];
+   } EU64Id;
+} TVPD_ID_Descriptor_Type_2;
+
+typedef struct {
+   u8 DeviceType:5;
+   u8 DeviceTypeQualifier:3;
+   u8 PageCode;
+   u8 Reserved;
+   u8 PageLength;
+   TVPD_ID_Descriptor_Type_1 IdDescriptorType1;
+   TVPD_ID_Descriptor_Type_2 IdDescriptorType2;
+} TVPD_Page83;
+
 /*
  *  M O D U L E   G L O B A L S
  */
@@ -420,6 +459,9 @@ int aac_get_containers(struct aac_dev *dev)
if (status = 0) {
dresp = (struct aac_get_container_count_resp *)fib_data(fibptr);
maximum_num_containers = 
le32_to_cpu(dresp-ContainerSwitchEntries);
+   if (fibptr-dev-supplement_adapter_info.SupportedOptions2 
+   AAC_OPTION_SUPPORTED_240_VOLUMES)
+   maximum_num_containers = 
le32_to_cpu(dresp-MaxSimpleVolumes);
aac_fib_complete(fibptr);
}
/* FIB should be freed only after getting the response from the F/W */
@@ -889,14 +931,81 @@ static void get_container_serial_callback(void *context, 
struct fib * fibptr)
get_serial_reply = (struct aac_get_serial_resp *) fib_data(fibptr);
/* Failure is irrelevant, using default value instead */
if (le32_to_cpu(get_serial_reply-status) == CT_OK) {
-   char sp[13];
-   /* EVPD bit set */
-   sp[0] = INQD_PDT_DA;
-   sp[1] = scsicmd-cmnd[2];
-   sp[2] = 0;
-   sp[3] = snprintf(sp+4, sizeof(sp)-4, %08X,
- le32_to_cpu(get_serial_reply-uid));
-   scsi_sg_copy_from_buffer(scsicmd, sp, sizeof(sp));
+   /*Check to see if it's for VPD 0x83 or 0x80 */
+   if (scsicmd-cmnd[2] == 0x83) {
+   /* vpd page 0x83 - Device Identification Page */
+   int i;
+   TVPD_Page83 VPDPage83Data;
+
+   memset(((u8 *)VPDPage83Data), 0,
+  sizeof(VPDPage83Data));
+
+   /* DIRECT_ACCESS_DEVIC */
+   VPDPage83Data.DeviceType = 0;
+   /* DEVICE_CONNECTED */
+   VPDPage83Data.DeviceTypeQualifier = 0;
+   /* VPD_DEVICE_IDENTIFIERS */
+   VPDPage83Data.PageCode = 0x83;
+   VPDPage83Data.Reserved = 0;
+   VPDPage83Data.PageLength = 
sizeof(VPDPage83Data.IdDescriptorType1) +
+   sizeof(VPDPage83Data.IdDescriptorType2);
+
+   /* T10 Vendor Identifier Field Format */
+   /* VpdCodeSetAscii */
+   VPDPage83Data.IdDescriptorType1.CodeSet = 2;
+   /* VpdIdentifierTypeVendorId */
+   VPDPage83Data.IdDescriptorType1.IdentifierType = 1;
+   VPDPage83Data.IdDescriptorType1.IdentifierLength = 
sizeof(VPDPage83Data.IdDescriptorType1) - 4;
+
+   /* ADAPTEC  for adaptec */
+   memcpy(VPDPage83Data.IdDescriptorType1.VendId, ADAPTEC 
,
+   sizeof(VPDPage83Data.IdDescriptorType1.VendId));
+   memcpy(VPDPage83Data.IdDescriptorType1.ProductId, 
ARRAY   ,
+   
sizeof(VPDPage83Data.IdDescriptorType1.ProductId));
+
+   /* Convert

[PATCH 6/7] aacraid: performance improvement changes

2015-03-04 Thread Mahesh Rajashekhara
Add performance improvement changes.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |6 +++---
 drivers/scsi/aacraid/comminit.c |   12 +++-
 drivers/scsi/aacraid/commsup.c  |7 ++-
 drivers/scsi/aacraid/dpcsup.c   |4 ++--
 drivers/scsi/aacraid/linit.c|   10 --
 drivers/scsi/aacraid/rx.c   |   14 +++---
 drivers/scsi/aacraid/src.c  |5 +
 7 files changed, 26 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index a37762e..74a0440 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  *  D E F I N E S
  
**/
 
-#define AAC_MAX_MSIX   32  /* vectors */
+#define AAC_MAX_MSIX   8   /* vectors */
 #define AAC_PCI_MSI_ENABLE 0x8000
 
 enum {
@@ -62,7 +62,7 @@ enum {
 #definePMC_GLOBAL_INT_BIT0 0x0001
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 30300
+# define AAC_DRIVER_BUILD 40709
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
@@ -633,7 +633,7 @@ struct aac_queue {
spinlock_t  lockdata;   /* Actual lock (used only on 
one side of the lock) */
struct list_headcmdq;   /* A queue of FIBs which need 
to be prcessed by the FS thread. This is */
/* only valid for command 
queues which receive entries from the adapter. */
-   u32 numpending; /* Number of entries on 
outstanding queue. */
+   atomic_tnumpending; /* Number of entries on 
outstanding queue. */
struct aac_dev *dev;/* Back pointer to adapter 
structure */
 };
 
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index c3e13ae..c16043e 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -181,7 +181,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void 
**commaddr, unsigned long co
 
 static void aac_queue_init(struct aac_dev * dev, struct aac_queue * q, u32 
*mem, int qsize)
 {
-   q-numpending = 0;
+   atomic_set(q-numpending, 0);
q-dev = dev;
init_waitqueue_head(q-cmdready);
INIT_LIST_HEAD(q-cmdq);
@@ -510,6 +510,7 @@ static void aac_define_int_mode(struct aac_dev *dev)
 {
 
int i, msi_count;
+   int cpu;
 
msi_count = i = 0;
/* max. vectors from GET_COMM_PREFERRED_SETTINGS */
@@ -571,6 +572,15 @@ static void aac_define_int_mode(struct aac_dev *dev)
else {
if (dev-max_msix  msi_count)
dev-max_msix = msi_count;
+
+   /* Added to set IRQ affinity */
+   cpu = cpumask_first(cpu_online_mask);
+   cpu = cpumask_next(cpu, cpu_online_mask);
+
+   for (i = 0; i  dev-max_msix; i++) {
+   irq_set_affinity_hint(dev-msixentry[i].vector, 
get_cpu_mask(cpu));
+   cpu = cpumask_next(cpu, cpu_online_mask);
+   }
}
dev-vector_cap = (dev-scsi_host_ptr-can_queue + AAC_NUM_MGT_FIB) / 
msi_count;
 }
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index 2bed445..0555023 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -318,7 +318,7 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, 
struct aac_entry **entr
/* Queue is full */
if ((*index + 1) == le32_to_cpu(*(q-headers.consumer))) {
printk(KERN_WARNING Queue %d full, %u outstanding.\n,
-   qid, q-numpending);
+   qid, atomic_read(q-numpending));
return 0;
} else {
*entry = q-base + *index;
@@ -411,7 +411,6 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
struct aac_dev * dev = fibptr-dev;
struct hw_fib * hw_fib = fibptr-hw_fib_va;
unsigned long flags = 0;
-   unsigned long qflags;
unsigned long mflags = 0;
unsigned long sflags = 0;
 
@@ -565,9 +564,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned 
long size,
int blink;
if (time_is_before_eq_jiffies(timeout)) {
struct aac_queue * q = 
dev-queues-queue[AdapNormCmdQueue];
-   spin_lock_irqsave(q-lock, qflags);
-   q-numpending--;
-   spin_unlock_irqrestore(q-lock, qflags);
+   atomic_dec(q-numpending);
if (wait == -1

[PATCH 1/7] aacraid: AIF support for SES device add/remove

2015-03-04 Thread Mahesh Rajashekhara
Add new AIF support for SES device add/remove

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |2 ++
 drivers/scsi/aacraid/commsup.c |8 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index eaaf870..284db39 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -1951,6 +1951,8 @@ extern struct aac_common aac_config;
 #defineAifEnEnclosureManagement 13 /* EM_DRIVE_* */
 #defineEM_DRIVE_INSERTION  31
 #defineEM_DRIVE_REMOVAL32
+#defineEM_SES_DRIVE_INSERTION  33
+#defineEM_SES_DRIVE_REMOVAL26
 #defineAifEnBatteryEvent   14  /* Change in 
Battery State */
 #defineAifEnAddContainer   15  /* A new array 
was created */
 #defineAifEnDeleteContainer16  /* A container 
was deleted */
diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c
index cab190a..090ba68 100644
--- a/drivers/scsi/aacraid/commsup.c
+++ b/drivers/scsi/aacraid/commsup.c
@@ -1044,6 +1044,8 @@ static void aac_handle_aif(struct aac_dev * dev, struct 
fib * fibptr)
switch (le32_to_cpu(((__le32 *)aifcmd-data)[3])) {
case EM_DRIVE_INSERTION:
case EM_DRIVE_REMOVAL:
+   case EM_SES_DRIVE_INSERTION:
+   case EM_SES_DRIVE_REMOVAL:
container = le32_to_cpu(
((__le32 *)aifcmd-data)[2]);
if ((container  28)) {
@@ -1069,8 +1071,10 @@ static void aac_handle_aif(struct aac_dev * dev, struct 
fib * fibptr)
}
channel = aac_phys_to_logical(channel);
device_config_needed =
- (((__le32 *)aifcmd-data)[3]
-   == cpu_to_le32(EM_DRIVE_INSERTION)) ?
+ __le32 *)aifcmd-data)[3]
+   == cpu_to_le32(EM_DRIVE_INSERTION)) ||
+   (((__le32 *)aifcmd-data)[3]
+   == cpu_to_le32(EM_SES_DRIVE_INSERTION))) ?
  ADD : DELETE;
break;
}
-- 
1.7.7.3

--
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 1/1] aacraid: kdump fix

2014-01-13 Thread Mahesh Rajashekhara
Thanks for your review comments, Tomas

We have initialized var in this driver patch. This patch fixes kernel panic 
issue while booting into the kdump kernel.

We have triggered crash and kdump vmcore was successful. No issues seen while 
booting into the OS.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/aacraid/rx.c  |7 ---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9323d05..eaaf870 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 30200
+# define AAC_DRIVER_BUILD 30300
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index dada38a..bb9917c 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -480,7 +480,7 @@ static int aac_rx_ioremap(struct aac_dev * dev, u32 size)
 
 static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
 {
-   u32 var;
+   u32 var = 0;
 
if (!(dev-supplement_adapter_info.SupportedOptions2 
  AAC_OPTION_MU_RESET) || (bled = 0) || (bled == -2)) {
@@ -500,13 +500,14 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, 
int bled)
if (bled  (bled != -ETIMEDOUT))
return -EINVAL;
}
-   if (bled || (var == 0x3803000F)) { /* USE_OTHER_METHOD */
+   if (bled  (var == 0x3803000F)) { /* USE_OTHER_METHOD */
rx_writel(dev, MUnit.reserved2, 3);
msleep(5000); /* Delay 5 seconds */
var = 0x0001;
}
-   if (var != 0x0001)
+   if (bled  (var != 0x0001))
return -EINVAL;
+   ssleep(5);
if (rx_readl(dev, MUnit.OMRx[0])  KERNEL_PANIC)
return -ENODEV;
if (startup_timeout  300)
-- 
1.7.7.3

--
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 1/1] aacraid: kdump fix

2014-01-07 Thread Mahesh Rajashekhara
Hi James,

Can you please let me know the status of this patch which I submitted sometime 
back.

Thanks  Regards,
Mahesh

-Original Message-
From: Mahesh Rajashekhara 
Sent: Monday, December 23, 2013 3:38 PM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Harry Yang; Achim Leubner; Rich Bono; Mahesh 
Rajashekhara
Subject: [PATCH 1/1] aacraid: kdump fix

This patch fixes kernel panic issue while booting into the kdump kernel.

We have triggered crash and kdump vmcore was successful. No issues seen while 
booting into the OS.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/aacraid/rx.c  |5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h 
index 9323d05..eaaf870 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 30200
+# define AAC_DRIVER_BUILD 30300
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c index 
dada38a..9f2d88f 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -500,13 +500,14 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, 
int bled)
if (bled  (bled != -ETIMEDOUT))
return -EINVAL;
}
-   if (bled || (var == 0x3803000F)) { /* USE_OTHER_METHOD */
+   if (bled  (var == 0x3803000F)) { /* USE_OTHER_METHOD */
rx_writel(dev, MUnit.reserved2, 3);
msleep(5000); /* Delay 5 seconds */
var = 0x0001;
}
-   if (var != 0x0001)
+   if (bled  (var != 0x0001))
return -EINVAL;
+   ssleep(5);
if (rx_readl(dev, MUnit.OMRx[0])  KERNEL_PANIC)
return -ENODEV;
if (startup_timeout  300)
--
1.7.7.3

--
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 1/1] aacraid: kdump fix

2013-12-23 Thread Mahesh Rajashekhara
This patch fixes kernel panic issue while booting into the kdump kernel.

We have triggered crash and kdump vmcore was successful. No issues seen while 
booting into the OS.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/aacraid/rx.c  |5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 9323d05..eaaf870 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 30200
+# define AAC_DRIVER_BUILD 30300
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
diff --git a/drivers/scsi/aacraid/rx.c b/drivers/scsi/aacraid/rx.c
index dada38a..9f2d88f 100644
--- a/drivers/scsi/aacraid/rx.c
+++ b/drivers/scsi/aacraid/rx.c
@@ -500,13 +500,14 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, 
int bled)
if (bled  (bled != -ETIMEDOUT))
return -EINVAL;
}
-   if (bled || (var == 0x3803000F)) { /* USE_OTHER_METHOD */
+   if (bled  (var == 0x3803000F)) { /* USE_OTHER_METHOD */
rx_writel(dev, MUnit.reserved2, 3);
msleep(5000); /* Delay 5 seconds */
var = 0x0001;
}
-   if (var != 0x0001)
+   if (bled  (var != 0x0001))
return -EINVAL;
+   ssleep(5);
if (rx_readl(dev, MUnit.OMRx[0])  KERNEL_PANIC)
return -ENODEV;
if (startup_timeout  300)
-- 
1.7.7.3

--
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 1/1] aacraid: prevent ZERO_SIZE_PTR dereference

2013-10-31 Thread Mahesh Rajashekhara
It appears that driver runs into a problem here if fibsize is too small because 
we allocate user_srbcmd with fibsize size only but later we access it until 
user_srbcmd-sg.count to copy it over to srbcmd. Seems to be not correct to 
test (fibsize  sizeof(*user_srbcmd)) because this structure already includes 
one sg element and this is not needed for commands without data. So, we would 
recommend to add the following (instead of test for fibsize == 0).

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/commctrl.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index d85ac1a..fbcd48d 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -511,7 +511,8 @@ static int aac_send_raw_srb(struct aac_dev* dev, void 
__user * arg)
goto cleanup;
}
 
-   if (fibsize  (dev-max_fib_size - sizeof(struct aac_fibhdr))) {
+   if ((fibsize  (sizeof(struct user_aac_srb) - sizeof(struct 
user_sgentry))) ||
+   (fibsize  (dev-max_fib_size - sizeof(struct aac_fibhdr {
rcode = -EINVAL;
goto cleanup;
}
-- 
1.7.7.3

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


Linux boot Support for 4KB sector drives ?

2013-07-01 Thread Mahesh Rajashekhara
Hello,

Does any of the Linux OS flavors support booting from the 4K sector
(advanced format) drive  in legacy BIOS mode (MBR partitioning scheme) ?

Thanks  Regards,
Mahesh


--
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 1/1] aacraid: Fix for arrays are going offline in the system. System hangs

2013-06-18 Thread Mahesh Rajashekhara
Hi James,

One of the customer had reported that the set of raid logical arrays will 
become unavailable (I/O offline) after a long hours of IO stress test.  The OS 
wouldn`t be accessible afterwards and require a hard reset.

This driver patch has a fix for race condition between the doorbell and the 
circular buffer. The driver is modified to do an extra read after clearing the 
doorbell in case there had been a completion posted during the small timing 
window.

With this fix, we ran IO stress for ~13 days. There were no IO failures.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/src.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index 0f56d8d..7e17107 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -93,6 +93,9 @@ static irqreturn_t aac_src_intr_message(int irq, void *dev_id)
int send_it = 0;
extern int aac_sync_mode;
 
+   src_writel(dev, MUnit.ODR_C, bellbits);
+   src_readl(dev, MUnit.ODR_C);
+
if (!aac_sync_mode) {
src_writel(dev, MUnit.ODR_C, bellbits);
src_readl(dev, MUnit.ODR_C);
-- 
1.7.11.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 1/1] aacraid: Dual firmware image support

2013-03-19 Thread Mahesh Rajashekhara
Hi Tomas,

Thanks for your review comments.
I have used sslep(10) instead udelay in this patch.

Hi James,

Patch description:
This patch adds dual flash firmware support for Series 7 and above controllers.

Regards,
Mahesh

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |6 +-
 drivers/scsi/aacraid/comminit.c |2 +-
 drivers/scsi/aacraid/src.c  |   26 +-
 3 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index a6f7190..9323d05 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 3
+# define AAC_DRIVER_BUILD 30200
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
@@ -1918,6 +1918,10 @@ extern struct aac_common aac_config;
 #defineMONITOR_PANIC   0x0020
 #defineKERNEL_UP_AND_RUNNING   0x0080
 #defineKERNEL_PANIC0x0100
+#defineFLASH_UPD_PENDING   0x2000
+#defineFLASH_UPD_SUCCESS   0x4000
+#defineFLASH_UPD_FAILED0x8000
+#defineFWUPD_TIMEOUT   (5 * 60)
 
 /*
  * Doorbell bit defines
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 3f75995..177b094 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -214,7 +214,7 @@ int aac_send_shutdown(struct aac_dev * dev)
cmd = (struct aac_close *) fib_data(fibctx);
 
cmd-command = cpu_to_le32(VM_CloseAll);
-   cmd-cid = cpu_to_le32(0x);
+   cmd-cid = cpu_to_le32(0xfffe);
 
status = aac_fib_send(ContainerCommand,
  fibctx,
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index e2e3492..0f56d8d 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -703,6 +703,28 @@ int aac_srcv_init(struct aac_dev *dev)
!aac_src_restart_adapter(dev, 0))
++restart;
/*
+*  Check to see if flash update is running.
+*  Wait for the adapter to be up and running. Wait up to 5 minutes
+*/
+   status = src_readl(dev, MUnit.OMR);
+   if (status  FLASH_UPD_PENDING) {
+   start = jiffies;
+   do {
+   status = src_readl(dev, MUnit.OMR);
+   if (time_after(jiffies, start+HZ*FWUPD_TIMEOUT)) {
+   printk(KERN_ERR %s%d: adapter flash update 
failed.\n,
+   dev-name, instance);
+   goto error_iounmap;
+   }
+   } while (!(status  FLASH_UPD_SUCCESS) 
+!(status  FLASH_UPD_FAILED));
+   /* Delay 10 seconds.
+* Because right now FW is doing a soft reset,
+* do not read scratch pad register at this time
+*/
+   ssleep(10);
+   }
+   /*
 *  Check to see if the board panic'd while booting.
 */
status = src_readl(dev, MUnit.OMR);
@@ -730,7 +752,9 @@ int aac_srcv_init(struct aac_dev *dev)
/*
 *  Wait for the adapter to be up and running. Wait up to 3 minutes
 */
-   while (!((status = src_readl(dev, MUnit.OMR))  KERNEL_UP_AND_RUNNING)) 
{
+   while (!((status = src_readl(dev, MUnit.OMR)) 
+   KERNEL_UP_AND_RUNNING) ||
+   status == 0x) {
if ((restart 
  (status  (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC))) ||
  time_after(jiffies, start+HZ*startup_timeout)) {
-- 
1.7.7.6

--
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 1/1] aacraid: Dual firmware image support

2013-03-18 Thread Mahesh Rajashekhara
This patch adds dual flash firmware support for Series 7 and above controllers.

Signed-off-by: Mahesh Rajashekhara mahesh.rajashekh...@pmcs.com
---
 drivers/scsi/aacraid/aacraid.h  |6 +-
 drivers/scsi/aacraid/comminit.c |2 +-
 drivers/scsi/aacraid/src.c  |   31 ++-
 3 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index a6f7190..9323d05 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,7 +12,7 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 3
+# define AAC_DRIVER_BUILD 30200
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
@@ -1918,6 +1918,10 @@ extern struct aac_common aac_config;
 #defineMONITOR_PANIC   0x0020
 #defineKERNEL_UP_AND_RUNNING   0x0080
 #defineKERNEL_PANIC0x0100
+#defineFLASH_UPD_PENDING   0x2000
+#defineFLASH_UPD_SUCCESS   0x4000
+#defineFLASH_UPD_FAILED0x8000
+#defineFWUPD_TIMEOUT   (5 * 60)
 
 /*
  * Doorbell bit defines
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 3f75995..177b094 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -214,7 +214,7 @@ int aac_send_shutdown(struct aac_dev * dev)
cmd = (struct aac_close *) fib_data(fibctx);
 
cmd-command = cpu_to_le32(VM_CloseAll);
-   cmd-cid = cpu_to_le32(0x);
+   cmd-cid = cpu_to_le32(0xfffe);
 
status = aac_fib_send(ContainerCommand,
  fibctx,
diff --git a/drivers/scsi/aacraid/src.c b/drivers/scsi/aacraid/src.c
index e2e3492..b8be2ab 100644
--- a/drivers/scsi/aacraid/src.c
+++ b/drivers/scsi/aacraid/src.c
@@ -685,6 +685,7 @@ int aac_srcv_init(struct aac_dev *dev)
unsigned long status;
int restart = 0;
int instance = dev-id;
+   int waitCount;
const char *name = dev-name;
 
dev-a_ops.adapter_ioremap = aac_srcv_ioremap;
@@ -703,6 +704,32 @@ int aac_srcv_init(struct aac_dev *dev)
!aac_src_restart_adapter(dev, 0))
++restart;
/*
+*  Check to see if flash update is running.
+*  Wait for the adapter to be up and running. Wait up to 5 minutes
+*/
+   status = src_readl(dev, MUnit.OMR);
+   if (status  FLASH_UPD_PENDING) {
+   start = jiffies;
+   do {
+   status = src_readl(dev, MUnit.OMR);
+   if (time_after(jiffies, start+HZ*FWUPD_TIMEOUT)) {
+   printk(KERN_ERR %s%d: adapter flash update 
failed.\n,
+   dev-name, instance);
+   goto error_iounmap;
+   }
+   } while (!(status  FLASH_UPD_SUCCESS) 
+!(status  FLASH_UPD_FAILED));
+   /* Delay 10 seconds.
+* Because right now FW is doing a soft reset,
+* do not read scratch pad register at this time
+*/
+   waitCount = 10 * 1;
+   while (waitCount) {
+   udelay(100);/* delay 100 microseconds */
+   waitCount--;
+   }
+   }
+   /*
 *  Check to see if the board panic'd while booting.
 */
status = src_readl(dev, MUnit.OMR);
@@ -730,7 +757,9 @@ int aac_srcv_init(struct aac_dev *dev)
/*
 *  Wait for the adapter to be up and running. Wait up to 3 minutes
 */
-   while (!((status = src_readl(dev, MUnit.OMR))  KERNEL_UP_AND_RUNNING)) 
{
+   while (!((status = src_readl(dev, MUnit.OMR)) 
+   KERNEL_UP_AND_RUNNING) ||
+   status == 0x) {
if ((restart 
  (status  (KERNEL_PANIC|SELF_TEST_FAILED|MONITOR_PANIC))) ||
  time_after(jiffies, start+HZ*startup_timeout)) {
-- 
1.7.7.6

--
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: Linux Libsas/Libata updates/releases

2013-02-06 Thread Mahesh Rajashekhara
** Resending in TEXT/PLAIN, earlier sent email bounce back **

Adding linux-scsi group to this email...

I would like to check with you if anyone had encountered similar issues
with upper layers older libsas/libata drivers. It would be of great help
if anyone can shed some light on this issue.  

Please advise!

Sincerely,
Mahesh

From: Tony Ruiz 
Sent: Tuesday, February 05, 2013 6:15 AM
To: 'James Bottomley'
Cc: Mahesh Rajashekhara
Subject: Linux Libsas/Libata updates/releases


Hi James,

I am the manager for the PMC-Sierra driver team working on the arcsas
and pmc8001 drivers.   

We are in the Beta testing phase of the pmc8001 Linux driver with newer
ASIC support.  When we use the updated libsas/libata libraries like
those in RHEL 6.3 or SuSe SP3 Beta, medium error handling works fine.
When we use kernels with older libsas/libata libraries with medium error
(details below) the system crashes.   We worked with SuSe and they
provided the updated libraries which work well and asked us to opened a
bug with SLES to make sure they include the latest into their kernel:
798738 - SLES 11 SP2 does not contain several libsas/libata backport
commits for handling ATA errors.

My question is:
-   Is there a recommend way to release our driver with these
updated libraries?
-   If there are none, is there an easy solution for customers' to
update only these components instead of the entire kernel?

Thanks in advanced.

Tony Ruiz
Manager of Host Software
PMC-Sierra, Inc.



Details of the issue:
1.  If a target/drive has medium error and IO has been aborted,
during this phase LibATA has some issues in this Error Handling Path and
system eventually crashes.
a.  This is very consistent with SUSE11SP2 (3.0.13) Kernel, but the
private branch of SLES11SP3 (3.0.57) which is still in BETA has all the
LibATA Error Handling back ported, this resolved all these error
handling issues.
b.  This very same issue with Debian 6.0.3 till 6.0.6
c.  With RHEL6.3 everything is working fine, since the Libsas/LibATA
changes are back-ported from 3.4 kernels to their RHEL6.3 Kernel
(2.6.32-279).
Sequence:
-   Medium Error Reported by drive for an IO either Read/Write_FPDMA
(NCQ Command) 
-   Firmware Raise NCQ Event 
-   Holds the IO expects RLE and puts the drive into Error State
-   Internally driver is issuing RLE because we don't have the IO
Context 
-   FW/Drive processes RLE 
-   Driver Receives RLE Response
-   Issues Abort ALL (as per SATA Spec)
-   FW releases all IO's by completing as IO Aborted
-   Driver Completes these to Midlayer

In the Successful case the sequence follows:
-   Receives RLE, but driver is faking it now
-   then receives Hard-Resetting Link
-   Domain Revalidation
-   Rediscover
-   IO's Successfully restarted.

In the Failure case the sequence follows:
-   System hangs
--
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 1/1] aacraid: 1024 max outstanding command support

2013-01-24 Thread Mahesh Rajashekhara
Hi James,

Can you please let us know the status of this patch. Can we get a
sign-off/approval of this patch.

Regards,
Mahesh

-Original Message-
From: Mahesh Rajashekhara 
Sent: Thursday, January 10, 2013 5:53 PM
To: jbottom...@parallels.com; linux-scsi@vger.kernel.org
Cc: aacr...@pmc-sierra.com; Vinay Goli; Achim Leubner; Tony Ruiz; Mahesh
Rajashekhara
Subject: [PATCH 1/1] aacraid: 1024 max outstanding command support

Hi James,

This patch adds 1024 max outstanding command support for Series 7 and
above controllers.

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aacraid.h  |  8 ++--
drivers/scsi/aacraid/comminit.c | 11 ++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h
b/drivers/scsi/aacraid/aacraid.h index 742f5d7..a6f7190 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,13 +12,13 @@
 
*---
-*/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 29801
+# define AAC_DRIVER_BUILD 3
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
 
 #define AAC_NUM_MGT_FIB 8
-#define AAC_NUM_IO_FIB (512 - AAC_NUM_MGT_FIB)
+#define AAC_NUM_IO_FIB (1024 - AAC_NUM_MGT_FIB)
 #define AAC_NUM_FIB(AAC_NUM_IO_FIB + AAC_NUM_MGT_FIB)
 
 #define AAC_MAX_LUN(8)
@@ -36,6 +36,10 @@
 #define CONTAINER_TO_ID(cont)  (cont)
 #define CONTAINER_TO_LUN(cont) (0)
 
+#define PMC_DEVICE_S7  0x28c
+#define PMC_DEVICE_S8  0x28d
+#define PMC_DEVICE_S9  0x28f
+
 #define aac_phys_to_logical(x)  ((x)+1)  #define aac_logical_to_phys(x)
((x)?(x)-1:0)
 
diff --git a/drivers/scsi/aacraid/comminit.c
b/drivers/scsi/aacraid/comminit.c index 8e5d3be..3f75995 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -404,7 +404,13 @@ struct aac_dev *aac_init_adapter(struct aac_dev
*dev)
dev-max_fib_size = status[1]  0xFFE0;
host-sg_tablesize = status[2]  16;
dev-sg_tablesize = status[2]  0x;
-   host-can_queue = (status[3]  0x) -
AAC_NUM_MGT_FIB;
+   if (dev-pdev-device == PMC_DEVICE_S7 ||
+   dev-pdev-device == PMC_DEVICE_S8 ||
+   dev-pdev-device == PMC_DEVICE_S9)
+   host-can_queue = ((status[3]  16) ?
(status[3]  16) :
+   (status[3]  0x)) - AAC_NUM_MGT_FIB;
+   else
+   host-can_queue = (status[3]  0x) -
AAC_NUM_MGT_FIB;
dev-max_num_aif = status[4]  0x;
/*
 *  NOTE:
@@ -452,6 +458,9 @@ struct aac_dev *aac_init_adapter(struct aac_dev
*dev)
}
}
 
+   if (host-can_queue  AAC_NUM_IO_FIB)
+   host-can_queue = AAC_NUM_IO_FIB;
+
/*
 *  Ok now init the communication subsystem
 */
--
1.7.11.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 1/1] aacraid: 1024 max outstanding command support

2013-01-10 Thread Mahesh Rajashekhara
Hi James,

This patch adds 1024 max outstanding command support for Series 7 and above 
controllers.

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aacraid.h  |  8 ++--
 drivers/scsi/aacraid/comminit.c | 11 ++-
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h
index 742f5d7..a6f7190 100644
--- a/drivers/scsi/aacraid/aacraid.h
+++ b/drivers/scsi/aacraid/aacraid.h
@@ -12,13 +12,13 @@
  
**/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 29801
+# define AAC_DRIVER_BUILD 3
 # define AAC_DRIVER_BRANCH -ms
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
 
 #define AAC_NUM_MGT_FIB 8
-#define AAC_NUM_IO_FIB (512 - AAC_NUM_MGT_FIB)
+#define AAC_NUM_IO_FIB (1024 - AAC_NUM_MGT_FIB)
 #define AAC_NUM_FIB(AAC_NUM_IO_FIB + AAC_NUM_MGT_FIB)
 
 #define AAC_MAX_LUN(8)
@@ -36,6 +36,10 @@
 #define CONTAINER_TO_ID(cont)  (cont)
 #define CONTAINER_TO_LUN(cont) (0)
 
+#define PMC_DEVICE_S7  0x28c
+#define PMC_DEVICE_S8  0x28d
+#define PMC_DEVICE_S9  0x28f
+
 #define aac_phys_to_logical(x)  ((x)+1)
 #define aac_logical_to_phys(x)  ((x)?(x)-1:0)
 
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 8e5d3be..3f75995 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -404,7 +404,13 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
dev-max_fib_size = status[1]  0xFFE0;
host-sg_tablesize = status[2]  16;
dev-sg_tablesize = status[2]  0x;
-   host-can_queue = (status[3]  0x) - AAC_NUM_MGT_FIB;
+   if (dev-pdev-device == PMC_DEVICE_S7 ||
+   dev-pdev-device == PMC_DEVICE_S8 ||
+   dev-pdev-device == PMC_DEVICE_S9)
+   host-can_queue = ((status[3]  16) ? (status[3]  
16) :
+   (status[3]  0x)) - AAC_NUM_MGT_FIB;
+   else
+   host-can_queue = (status[3]  0x) - 
AAC_NUM_MGT_FIB;
dev-max_num_aif = status[4]  0x;
/*
 *  NOTE:
@@ -452,6 +458,9 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)
}
}
 
+   if (host-can_queue  AAC_NUM_IO_FIB)
+   host-can_queue = AAC_NUM_IO_FIB;
+
/*
 *  Ok now init the communication subsystem
 */
-- 
1.7.11.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


RE: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling

2012-11-14 Thread Mahesh Rajashekhara
Hi James,

We have taken care the review comments and re-submitted the patch a while ago.
http://marc.info/?l=linux-scsim=135063478232396w=2
 

Tomas has provided Acked-by to the patch.
http://marc.info/?l=linux-scsim=135065706307974w=2

  
Thanks,
Mahesh


-Original Message-
From: James Bottomley [mailto:jbottom...@parallels.com] 
Sent: Wednesday, November 14, 2012 12:33 PM
To: Tomas Henzl
Cc: Mahesh Rajashekhara; linux-scsi@vger.kernel.org; aacr...@pmc-sierra.com; 
Achim Leubner; Tony Ruiz
Subject: Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling

On Tue, 2012-10-16 at 23:34 +0200, Tomas Henzl wrote:
 On 10/16/2012 10:59 PM, Mahesh Rajashekhara wrote:
  This patch handles SCSI dma mapping failure case. Reporting error code to 
  the upper layer instead of BUG_ON().
 
  This patch is created against current upstream kernel.
 
  Signed-off-by: Mahesh Rajashekhara 
  mahesh_rajashekh...@pmc-sierra.com
  ---
   drivers/scsi/aacraid/aachba.c  |   63 
  +++-
   drivers/scsi/aacraid/aacraid.h |2 +-
   2 files changed, 50 insertions(+), 15 deletions(-)
 
  diff --git a/drivers/scsi/aacraid/aachba.c 
  b/drivers/scsi/aacraid/aachba.c index d79457a..efa2900 100644
  --- a/drivers/scsi/aacraid/aachba.c
  +++ b/drivers/scsi/aacraid/aachba.c
  @@ -971,6 +971,7 @@ static int aac_read_raw_io(struct fib * fib, 
  struct scsi_cmnd * cmd, u64 lba, u3  {
  struct aac_dev *dev = fib-dev;
  u16 fibsize, command;
  +   unsigned long ret;
   
  aac_fib_init(fib);
  if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  
  !dev-sync_mode) { @@ -982,7 +983,10 @@ static int aac_read_raw_io(struct 
  fib * fib, struct scsi_cmnd * cmd, u64 lba, u3
  readcmd2-byteCount = cpu_to_le32(count9);
  readcmd2-cid = cpu_to_le16(scmd_id(cmd));
  readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
  -   aac_build_sgraw2(cmd, readcmd2, 
  dev-scsi_host_ptr-sg_tablesize);
  +   ret = aac_build_sgraw2(cmd, readcmd2,
  +   dev-scsi_host_ptr-sg_tablesize);
  +   if (ret  0)
  +   return ret;
 
 Hi Mahesh, 'ret' is 'unsigned', the above test will not work.
 Tomas

Ping on this please Mahesh?  The criticism seems completely valid to me.

James

N�r��yb�X��ǧv�^�)޺{.n�+{{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj��!�i

RE: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling

2012-11-01 Thread Mahesh Rajashekhara
Hello James,

Can you please let us know the status of this patch. Can we get a
sign-off/approval of this patch.

Thanks,
Mahesh

-Original Message-
From: Tomas Henzl [mailto:the...@redhat.com] 
Sent: Friday, October 19, 2012 8:00 PM
To: Mahesh Rajashekhara
Cc: jbottom...@parallels.com; linux-scsi@vger.kernel.org;
aacr...@pmc-sierra.com; Achim Leubner; Tony Ruiz
Subject: Re: [PATCH 1/1] aacraid: SCSI dma mapping failure case handling

On 10/19/2012 03:51 PM, Mahesh Rajashekhara wrote:
 Hi James,

 We've incorporated the changes suggested by Tomas in this driver
patch.  I would request you to please consider this patch. Please let us
know your comments if any.

 Patch Description:
 This patch handles SCSI dma mapping failure case. Reporting error code
to the upper layer instead of BUG_ON().

 Signed-off-by: Mahesh Rajashekhara
mahesh_rajashekh...@pmc-sierra.com

Acked-by: Tomas Henzl the...@redhat.com

Thanks.

--
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 1/1] aacraid: SCSI dma mapping failure case handling

2012-10-19 Thread Mahesh Rajashekhara
Hi James,

We've incorporated the changes suggested by Tomas in this driver patch.  I 
would request you to please consider this patch. Please let us know your 
comments if any.

Patch Description:
This patch handles SCSI dma mapping failure case. Reporting error code to the 
upper layer instead of BUG_ON().

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aachba.c  |   87 +--
 drivers/scsi/aacraid/aacraid.h |2 +-
 2 files changed, 65 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index d79457a..681434e 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -132,11 +132,13 @@ struct inquiry_data {
  *  M O D U L E   G L O B A L S
  */
 
-static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* 
sgmap);
-static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* 
psg);
-static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct 
sgmapraw* psg);
-static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct 
aac_raw_io2 *rio2, int sg_max);
-static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, 
int nseg_new);
+static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap);
+static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg);
+static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg);
+static long aac_build_sgraw2(struct scsi_cmnd *scsicmd,
+   struct aac_raw_io2 *rio2, int sg_max);
+static int aac_convert_sgraw2(struct aac_raw_io2 *rio2,
+   int pages, int nseg, int nseg_new);
 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
 #ifdef AAC_DETAILED_STATUS_INFO
 static char *aac_get_status_string(u32 status);
@@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
 {
struct aac_dev *dev = fib-dev;
u16 fibsize, command;
+   long ret;
 
aac_fib_init(fib);
if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  !dev-sync_mode) {
@@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd2-byteCount = cpu_to_le32(count9);
readcmd2-cid = cpu_to_le16(scmd_id(cmd));
readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
-   aac_build_sgraw2(cmd, readcmd2, 
dev-scsi_host_ptr-sg_tablesize);
+   ret = aac_build_sgraw2(cmd, readcmd2,
+   dev-scsi_host_ptr-sg_tablesize);
+   if (ret  0)
+   return ret;
command = ContainerRawIo2;
fibsize = sizeof(struct aac_raw_io2) +
((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
@@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd-flags = cpu_to_le16(RIO_TYPE_READ);
readcmd-bpTotal = 0;
readcmd-bpComplete = 0;
-   aac_build_sgraw(cmd, readcmd-sg);
+   ret = aac_build_sgraw(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
command = ContainerRawIo;
fibsize = sizeof(struct aac_raw_io) +
((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct 
sgentryraw));
@@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
 {
u16 fibsize;
struct aac_read64 *readcmd;
+   long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read64 *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtHostRead64);
@@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
readcmd-pad   = 0;
readcmd-flags = 0;
 
-   aac_build_sg64(cmd, readcmd-sg);
+   ret = aac_build_sg64(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read64) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry64));
@@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
 {
u16 fibsize;
struct aac_read *readcmd;
+   long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtBlockRead);
@@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
readcmd-block = cpu_to_le32((u32)(lba0x));
readcmd-count = cpu_to_le32(count * 512);
 
-   aac_build_sg(cmd, readcmd-sg);
+   ret = aac_build_sg(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize

[PATCH 1/1] aacraid: SCSI dma mapping failure case handling

2012-10-17 Thread Mahesh Rajashekhara
From: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com

Hi Tomas,

Thanks for the correction.

I have changed 'ret' is of type 'long' now.

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aachba.c  |   87 +--
 drivers/scsi/aacraid/aacraid.h |2 +-
 2 files changed, 65 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index d79457a..681434e 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -132,11 +132,13 @@ struct inquiry_data {
  *  M O D U L E   G L O B A L S
  */
 
-static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* 
sgmap);
-static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* 
psg);
-static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct 
sgmapraw* psg);
-static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct 
aac_raw_io2 *rio2, int sg_max);
-static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, 
int nseg_new);
+static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap);
+static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg);
+static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg);
+static long aac_build_sgraw2(struct scsi_cmnd *scsicmd,
+   struct aac_raw_io2 *rio2, int sg_max);
+static int aac_convert_sgraw2(struct aac_raw_io2 *rio2,
+   int pages, int nseg, int nseg_new);
 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
 #ifdef AAC_DETAILED_STATUS_INFO
 static char *aac_get_status_string(u32 status);
@@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
 {
struct aac_dev *dev = fib-dev;
u16 fibsize, command;
+   long ret;
 
aac_fib_init(fib);
if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  !dev-sync_mode) {
@@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd2-byteCount = cpu_to_le32(count9);
readcmd2-cid = cpu_to_le16(scmd_id(cmd));
readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
-   aac_build_sgraw2(cmd, readcmd2, 
dev-scsi_host_ptr-sg_tablesize);
+   ret = aac_build_sgraw2(cmd, readcmd2,
+   dev-scsi_host_ptr-sg_tablesize);
+   if (ret  0)
+   return ret;
command = ContainerRawIo2;
fibsize = sizeof(struct aac_raw_io2) +
((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
@@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd-flags = cpu_to_le16(RIO_TYPE_READ);
readcmd-bpTotal = 0;
readcmd-bpComplete = 0;
-   aac_build_sgraw(cmd, readcmd-sg);
+   ret = aac_build_sgraw(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
command = ContainerRawIo;
fibsize = sizeof(struct aac_raw_io) +
((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct 
sgentryraw));
@@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
 {
u16 fibsize;
struct aac_read64 *readcmd;
+   long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read64 *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtHostRead64);
@@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
readcmd-pad   = 0;
readcmd-flags = 0;
 
-   aac_build_sg64(cmd, readcmd-sg);
+   ret = aac_build_sg64(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read64) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry64));
@@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
 {
u16 fibsize;
struct aac_read *readcmd;
+   long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtBlockRead);
@@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
readcmd-block = cpu_to_le32((u32)(lba0x));
readcmd-count = cpu_to_le32(count * 512);
 
-   aac_build_sg(cmd, readcmd-sg);
+   ret = aac_build_sg(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry));
@@ -1079,6 +1095,7 @@ static

[PATCH 1/1] aacraid: SCSI dma mapping failure case handling

2012-10-17 Thread Mahesh Rajashekhara
I have changed all aac_build_... function prototypes  as of type 'long' and 
they return 'byte_count' is of type 'long'.

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aachba.c  |   95 ---
 drivers/scsi/aacraid/aacraid.h |2 +-
 2 files changed, 69 insertions(+), 28 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index d79457a..0371f80 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -132,11 +132,13 @@ struct inquiry_data {
  *  M O D U L E   G L O B A L S
  */
 
-static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* 
sgmap);
-static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* 
psg);
-static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct 
sgmapraw* psg);
-static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct 
aac_raw_io2 *rio2, int sg_max);
-static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, 
int nseg_new);
+static long aac_build_sg(struct scsi_cmnd *scsicmd, struct sgmap *sgmap);
+static long aac_build_sg64(struct scsi_cmnd *scsicmd, struct sgmap64 *psg);
+static long aac_build_sgraw(struct scsi_cmnd *scsicmd, struct sgmapraw *psg);
+static long aac_build_sgraw2(struct scsi_cmnd *scsicmd,
+   struct aac_raw_io2 *rio2, int sg_max);
+static int aac_convert_sgraw2(struct aac_raw_io2 *rio2,
+   int pages, int nseg, int nseg_new);
 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
 #ifdef AAC_DETAILED_STATUS_INFO
 static char *aac_get_status_string(u32 status);
@@ -971,6 +973,7 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
 {
struct aac_dev *dev = fib-dev;
u16 fibsize, command;
+   long ret;
 
aac_fib_init(fib);
if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  !dev-sync_mode) {
@@ -982,7 +985,10 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd2-byteCount = cpu_to_le32(count9);
readcmd2-cid = cpu_to_le16(scmd_id(cmd));
readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
-   aac_build_sgraw2(cmd, readcmd2, 
dev-scsi_host_ptr-sg_tablesize);
+   ret = aac_build_sgraw2(cmd, readcmd2,
+   dev-scsi_host_ptr-sg_tablesize);
+   if (ret  0)
+   return ret;
command = ContainerRawIo2;
fibsize = sizeof(struct aac_raw_io2) +
((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
@@ -996,7 +1002,9 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd-flags = cpu_to_le16(RIO_TYPE_READ);
readcmd-bpTotal = 0;
readcmd-bpComplete = 0;
-   aac_build_sgraw(cmd, readcmd-sg);
+   ret = aac_build_sgraw(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
command = ContainerRawIo;
fibsize = sizeof(struct aac_raw_io) +
((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct 
sgentryraw));
@@ -1019,6 +1027,8 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
 {
u16 fibsize;
struct aac_read64 *readcmd;
+   long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read64 *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtHostRead64);
@@ -1028,7 +1038,9 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
readcmd-pad   = 0;
readcmd-flags = 0;
 
-   aac_build_sg64(cmd, readcmd-sg);
+   ret = aac_build_sg64(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read64) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry64));
@@ -1050,6 +1062,8 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
 {
u16 fibsize;
struct aac_read *readcmd;
+   long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtBlockRead);
@@ -1057,7 +1071,9 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
readcmd-block = cpu_to_le32((u32)(lba0x));
readcmd-count = cpu_to_le32(count * 512);
 
-   aac_build_sg(cmd, readcmd-sg);
+   ret = aac_build_sg(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry));
@@ -1079,6 +1095,7 @@ static int aac_write_raw_io

[PATCH 1/1] aacraid: SCSI dma mapping failure case handling

2012-10-16 Thread Mahesh Rajashekhara
This patch handles SCSI dma mapping failure case. Reporting error code to the 
upper layer instead of BUG_ON().

This patch is created against current upstream kernel.

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aachba.c  |   63 +++-
 drivers/scsi/aacraid/aacraid.h |2 +-
 2 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index d79457a..efa2900 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -971,6 +971,7 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
 {
struct aac_dev *dev = fib-dev;
u16 fibsize, command;
+   unsigned long ret;
 
aac_fib_init(fib);
if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  !dev-sync_mode) {
@@ -982,7 +983,10 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd2-byteCount = cpu_to_le32(count9);
readcmd2-cid = cpu_to_le16(scmd_id(cmd));
readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
-   aac_build_sgraw2(cmd, readcmd2, 
dev-scsi_host_ptr-sg_tablesize);
+   ret = aac_build_sgraw2(cmd, readcmd2,
+   dev-scsi_host_ptr-sg_tablesize);
+   if (ret  0)
+   return ret;
command = ContainerRawIo2;
fibsize = sizeof(struct aac_raw_io2) +
((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
@@ -996,7 +1000,9 @@ static int aac_read_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u3
readcmd-flags = cpu_to_le16(RIO_TYPE_READ);
readcmd-bpTotal = 0;
readcmd-bpComplete = 0;
-   aac_build_sgraw(cmd, readcmd-sg);
+   ret = aac_build_sgraw(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
command = ContainerRawIo;
fibsize = sizeof(struct aac_raw_io) +
((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct 
sgentryraw));
@@ -1019,6 +1025,7 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
 {
u16 fibsize;
struct aac_read64 *readcmd;
+   unsigned long ret;
aac_fib_init(fib);
readcmd = (struct aac_read64 *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtHostRead64);
@@ -1028,7 +1035,9 @@ static int aac_read_block64(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
readcmd-pad   = 0;
readcmd-flags = 0;
 
-   aac_build_sg64(cmd, readcmd-sg);
+   ret = aac_build_sg64(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read64) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry64));
@@ -1050,6 +1059,8 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
 {
u16 fibsize;
struct aac_read *readcmd;
+   unsigned long ret;
+
aac_fib_init(fib);
readcmd = (struct aac_read *) fib_data(fib);
readcmd-command = cpu_to_le32(VM_CtBlockRead);
@@ -1057,7 +1068,9 @@ static int aac_read_block(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u32
readcmd-block = cpu_to_le32((u32)(lba0x));
readcmd-count = cpu_to_le32(count * 512);
 
-   aac_build_sg(cmd, readcmd-sg);
+   ret = aac_build_sg(cmd, readcmd-sg);
+   if (ret  0)
+   return ret;
fibsize = sizeof(struct aac_read) +
((le32_to_cpu(readcmd-sg.count) - 1) *
 sizeof (struct sgentry));
@@ -1079,6 +1092,7 @@ static int aac_write_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
 {
struct aac_dev *dev = fib-dev;
u16 fibsize, command;
+   unsigned long ret;
 
aac_fib_init(fib);
if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  !dev-sync_mode) {
@@ -1093,7 +1107,10 @@ static int aac_write_raw_io(struct fib * fib, struct 
scsi_cmnd * cmd, u64 lba, u
   (((aac_cache  5) != 5) || 
!fib-dev-cache_protected)) ?
cpu_to_le16(RIO2_IO_TYPE_WRITE|RIO2_IO_SUREWRITE) :
cpu_to_le16(RIO2_IO_TYPE_WRITE);
-   aac_build_sgraw2(cmd, writecmd2, 
dev-scsi_host_ptr-sg_tablesize);
+   ret = aac_build_sgraw2(cmd, writecmd2,
+   dev-scsi_host_ptr-sg_tablesize);
+   if (ret  0)
+   return ret;
command = ContainerRawIo2;
fibsize = sizeof(struct aac_raw_io2) +
((le32_to_cpu(writecmd2-sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
@@ -1110,7 +1127,9 @@ static int aac_write_raw_io

[PATCH 1/1] aacraid: Series 7 Async. (performance) mode support

2012-07-14 Thread Mahesh Rajashekhara
Hi James,

We rebuild aacraid Series 7 Async. mode (performance) driver patch over the 
sources available in the `misc` (aacraid Endian Fix patches) branch.

Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com
---
 drivers/scsi/aacraid/aachba.c   |  237 +--
 drivers/scsi/aacraid/aacraid.h  |   74 ++---
 drivers/scsi/aacraid/commctrl.c |2 +
 drivers/scsi/aacraid/comminit.c |   54 +
 drivers/scsi/aacraid/commsup.c  |   22 ++--
 drivers/scsi/aacraid/dpcsup.c   |6 +-
 drivers/scsi/aacraid/linit.c|2 +-
 drivers/scsi/aacraid/src.c  |   85 --
 8 files changed, 357 insertions(+), 125 deletions(-)

diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c
index 5255166..d79457a 100644
--- a/drivers/scsi/aacraid/aachba.c
+++ b/drivers/scsi/aacraid/aachba.c
@@ -135,6 +135,8 @@ struct inquiry_data {
 static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* 
sgmap);
 static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* 
psg);
 static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct 
sgmapraw* psg);
+static unsigned long aac_build_sgraw2(struct scsi_cmnd *scsicmd, struct 
aac_raw_io2 *rio2, int sg_max);
+static int aac_convert_sgraw2(struct aac_raw_io2 *rio2, int pages, int nseg, 
int nseg_new);
 static int aac_send_srb_fib(struct scsi_cmnd* scsicmd);
 #ifdef AAC_DETAILED_STATUS_INFO
 static char *aac_get_status_string(u32 status);
@@ -152,10 +154,14 @@ int aac_commit = -1;
 int startup_timeout = 180;
 int aif_timeout = 120;
 int aac_sync_mode;  /* Only Sync. transfer - disabled */
+int aac_convert_sgl = 1;   /* convert non-conformable s/g list - enabled */
 
 module_param(aac_sync_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(aac_sync_mode, Force sync. transfer mode
 0=off, 1=on);
+module_param(aac_convert_sgl, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(aac_convert_sgl, Convert non-conformable s/g list
+0=off, 1=on);
 module_param(nondasd, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(nondasd, Control scanning of hba for nondasd devices.
 0=off, 1=on);
@@ -963,25 +969,44 @@ static void io_callback(void *context, struct fib * 
fibptr);
 
 static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, 
u32 count)
 {
-   u16 fibsize;
-   struct aac_raw_io *readcmd;
+   struct aac_dev *dev = fib-dev;
+   u16 fibsize, command;
+
aac_fib_init(fib);
-   readcmd = (struct aac_raw_io *) fib_data(fib);
-   readcmd-block[0] = cpu_to_le32((u32)(lba0x));
-   readcmd-block[1] = cpu_to_le32((u32)((lba0xLL)32));
-   readcmd-count = cpu_to_le32(count9);
-   readcmd-cid = cpu_to_le16(scmd_id(cmd));
-   readcmd-flags = cpu_to_le16(IO_TYPE_READ);
-   readcmd-bpTotal = 0;
-   readcmd-bpComplete = 0;
+   if (dev-comm_interface == AAC_COMM_MESSAGE_TYPE2  !dev-sync_mode) {
+   struct aac_raw_io2 *readcmd2;
+   readcmd2 = (struct aac_raw_io2 *) fib_data(fib);
+   memset(readcmd2, 0, sizeof(struct aac_raw_io2));
+   readcmd2-blockLow = cpu_to_le32((u32)(lba0x));
+   readcmd2-blockHigh = 
cpu_to_le32((u32)((lba0xLL)32));
+   readcmd2-byteCount = cpu_to_le32(count9);
+   readcmd2-cid = cpu_to_le16(scmd_id(cmd));
+   readcmd2-flags = cpu_to_le16(RIO2_IO_TYPE_READ);
+   aac_build_sgraw2(cmd, readcmd2, 
dev-scsi_host_ptr-sg_tablesize);
+   command = ContainerRawIo2;
+   fibsize = sizeof(struct aac_raw_io2) +
+   ((le32_to_cpu(readcmd2-sgeCnt)-1) * sizeof(struct 
sge_ieee1212));
+   } else {
+   struct aac_raw_io *readcmd;
+   readcmd = (struct aac_raw_io *) fib_data(fib);
+   readcmd-block[0] = cpu_to_le32((u32)(lba0x));
+   readcmd-block[1] = 
cpu_to_le32((u32)((lba0xLL)32));
+   readcmd-count = cpu_to_le32(count9);
+   readcmd-cid = cpu_to_le16(scmd_id(cmd));
+   readcmd-flags = cpu_to_le16(RIO_TYPE_READ);
+   readcmd-bpTotal = 0;
+   readcmd-bpComplete = 0;
+   aac_build_sgraw(cmd, readcmd-sg);
+   command = ContainerRawIo;
+   fibsize = sizeof(struct aac_raw_io) +
+   ((le32_to_cpu(readcmd-sg.count)-1) * sizeof(struct 
sgentryraw));
+   }
 
-   aac_build_sgraw(cmd, readcmd-sg);
-   fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd-sg.count) 
- 1) * sizeof (struct sgentryraw));
BUG_ON(fibsize  (fib-dev-max_fib_size - sizeof(struct aac_fibhdr)));
/*
 *  Now send the Fib to the adapter
 */
-   return aac_fib_send(ContainerRawIo,
+   return aac_fib_send(command,
  fib,
  fibsize

RE: [PATCH 1/1] aacraid: Series 7 Async. (performance) mode support

2012-07-13 Thread Mahesh Rajashekhara
Hi James,

We downloaded the upstream aacraid sources from git clone 
git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git. Looks like Endian 
fix patches are not available. Can you please send us the current pointer to 
download sources? So that, we rebuild our Series 7 Async performance driver 
patch over them.

Thanks  Regards,
Mahesh

-Original Message-
From: James Bottomley [mailto:jbottom...@parallels.com] 
Sent: Friday, July 13, 2012 1:56 PM
To: Mahesh Rajashekhara
Cc: linux-scsi@vger.kernel.org; aacr...@pmc-sierra.com; Achim Leubner; Tony Ruiz
Subject: Re: [PATCH 1/1] aacraid: Series 7 Async. (performance) mode support

On Wed, 2012-07-11 at 13:26 +0530, Mahesh Rajashekhara wrote:
 - Series 7 Async. (performance) mode support added
 - New scatter/gather list format for Series 7
 - Driver converts s/g list to a firmware suitable list for best performance 
 on Series 7, this can be disabled
   with driver parameter aac_convert_sgl for testing purposes
 - New container read/write command structure for Series 7
 - Fast response support for the SCSI pass-through path added
 - Async. status response buffer changes
 
 Signed-off-by: Mahesh Rajashekhara mahesh_rajashekh...@pmc-sierra.com

This doesn't apply:

patching file drivers/scsi/aacraid/aachba.c
patching file drivers/scsi/aacraid/aacraid.h
Hunk #8 succeeded at 1135 (offset 1 line).
Hunk #9 succeeded at 1194 (offset 1 line).
Hunk #10 succeeded at 1301 (offset 1 line).
Hunk #11 succeeded at 1361 (offset 1 line).
Hunk #12 succeeded at 1381 (offset 1 line).
patching file drivers/scsi/aacraid/commctrl.c
patching file drivers/scsi/aacraid/comminit.c
Hunk #3 FAILED at 117.
1 out of 4 hunks FAILED -- saving rejects to file
drivers/scsi/aacraid/comminit.c.rej
patching file drivers/scsi/aacraid/commsup.c
Hunk #7 succeeded at 710 (offset 3 lines).
Hunk #8 succeeded at 724 (offset 3 lines).
Hunk #9 succeeded at 788 (offset 3 lines).
patching file drivers/scsi/aacraid/dpcsup.c
patching file drivers/scsi/aacraid/linit.c
Hunk #1 succeeded at 1166 (offset 9 lines).
patching file drivers/scsi/aacraid/src.c
Hunk #6 FAILED at 396.
Hunk #7 succeeded at 764 (offset 11 lines).
1 out of 7 hunks FAILED -- saving rejects to file
drivers/scsi/aacraid/src.c.rej

I think it's because of the endian fix patches ... but you guys acked
them, so I expect you to rebuild your patches over them.

Thanks,

James

N�r��yb�X��ǧv�^�)޺{.n�+{{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�mzZ+�ݢj��!�i