mptscsi: BUG: unable to handle kernel NULL pointer, in scsi_send_eh_cmnd

2012-07-10 Thread Meelis Roos
Resending with correct linux-scsi address - please rteply to this one if 
you see duplicate messages.

I am using Linux 3.4.0 with a 53c1030 and a tape library that sometimes 
barfs for yet unknown reasons. When it happens, I get a BUG with 
backtrace and this scsi channel is dead until I reboot. Seems to be 
something with either generic scsi error handling or with mpt scsi.

Full dmesg:

[0.00] Initializing cgroup subsys cpu
[0.00] Linux version 3.4.0 (mroos@kosmos) (gcc version 4.4.5 (Debian 
4.4.5-8) ) #22 SMP Mon Jun 11 18:19:26 EEST 2012
[0.00] BIOS-provided physical RAM map:
[0.00]  BIOS-e820:  - 00099800 (usable)
[0.00]  BIOS-e820: 00099800 - 000a (reserved)
[0.00]  BIOS-e820: 000e - 0010 (reserved)
[0.00]  BIOS-e820: 0010 - 5ffeb180 (usable)
[0.00]  BIOS-e820: 5ffeb180 - 5fff (ACPI data)
[0.00]  BIOS-e820: 5fff - 6000 (reserved)
[0.00]  BIOS-e820: fec0 - 0001 (reserved)
[0.00] Notice: NX (Execute Disable) protection missing in CPU!
[0.00] DMI 2.3 present.
[0.00] DMI: IBM eserver xSeries 232 -[866823G]-/, BIOS 
-[QAE133AUS-1.08]- 02/25/2004
[0.00] e820 update range:  - 0001 (usable) 
== (reserved)
[0.00] e820 remove range: 000a - 0010 (usable)
[0.00] last_pfn = 0x5ffeb max_arch_pfn = 0x10
[0.00] MTRR default type: uncachable
[0.00] MTRR fixed ranges enabled:
[0.00]   0-9 write-back
[0.00]   A-B uncachable
[0.00]   C-D3FFF write-protect
[0.00]   D4000-D uncachable
[0.00]   E-F write-protect
[0.00] MTRR variable ranges enabled:
[0.00]   0 base 0 mask FC000 write-back
[0.00]   1 base 04000 mask FE000 write-back
[0.00]   2 base 1 mask F write-back
[0.00]   3 base 2 mask E write-back
[0.00]   4 disabled
[0.00]   5 disabled
[0.00]   6 disabled
[0.00]   7 disabled
[0.00] PAT not supported by CPU.
[0.00] e820 update range: 6000 - 0001 (usable) 
== (reserved)
[0.00] found SMP MP-table at [c0099940] 99940
[0.00] initial memory mapped : 0 - 0180
[0.00] Base memory trampoline at [c0098000] 98000 size 4096
[0.00] init_memory_mapping: -377fe000
[0.00]  00 - 40 page 4k
[0.00]  40 - 003740 page 2M
[0.00]  003740 - 00377fe000 page 4k
[0.00] kernel direct mapping tables up to 377fe000 @ 17fb000-180
[0.00] ACPI: RSDP 000fdf70 00014 (v00 IBM   )
[0.00] ACPI: RSDT 5ffeff80 0002C (v01 IBMSERQURTZ 1000 IBM  
45444F43)
[0.00] ACPI: FACP 5ffeff00 00074 (v01 IBMSERQURTZ 1000 IBM  
45444F43)
[0.00] ACPI: DSDT 5ffeb180 04C69 (v01 IBMSERQURTZ 1000 MSFT 
010B)
[0.00] ACPI: FACS 5ffefe40 00040
[0.00] ACPI: APIC 5ffefe80 00068 (v01 IBMSERQURTZ 1000 IBM  
45444F43)
[0.00] ACPI: Local APIC address 0xfee0
[0.00] 647MB HIGHMEM available.
[0.00] 887MB LOWMEM available.
[0.00]   mapped low ram: 0 - 377fe000
[0.00]   low ram: 0 - 377fe000
[0.00] Zone PFN ranges:
[0.00]   DMA  0x0010 - 0x1000
[0.00]   Normal   0x1000 - 0x000377fe
[0.00]   HighMem  0x000377fe - 0x0005ffeb
[0.00] Movable zone start PFN for each node
[0.00] Early memory PFN ranges
[0.00] 0: 0x0010 - 0x0099
[0.00] 0: 0x0100 - 0x0005ffeb
[0.00] On node 0 totalpages: 393076
[0.00]   DMA zone: 32 pages used for memmap
[0.00]   DMA zone: 0 pages reserved
[0.00]   DMA zone: 3945 pages, LIFO batch:0
[0.00]   Normal zone: 1744 pages used for memmap
[0.00]   Normal zone: 221486 pages, LIFO batch:31
[0.00]   HighMem zone: 1296 pages used for memmap
[0.00]   HighMem zone: 164573 pages, LIFO batch:31
[0.00] Using APIC driver default
[0.00] ACPI: PM-Timer IO Port: 0x4e8
[0.00] ACPI: Local APIC address 0xfee0
[0.00] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x03] enabled)
[0.00] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x00] enabled)
[0.00] ACPI: IOAPIC (id[0x0e] address[0xfec0] gsi_base[0])
[0.00] IOAPIC[0]: apic_id 14, version 17, address 0xfec0, GSI 0-15
[0.00] ACPI: IOAPIC (id[0x0d] address[0xfec01000] gsi_base[16])
[0.00] IOAPIC[1]: apic_id 13, version 17, address 0xfec01000, GSI 16-31
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[0.00] ACPI: INT_SRC_OVR (bus 0 bus_irq 7 global_irq 

Re: mptscsi: BUG: unable to handle kernel NULL pointer, in scsi_send_eh_cmnd

2012-07-10 Thread James Bottomley
On Tue, 2012-07-10 at 11:44 +0300, Meelis Roos wrote:
 Resending with correct linux-scsi address - please rteply to this one if 
 you see duplicate messages.
 
 I am using Linux 3.4.0 with a 53c1030 and a tape library that sometimes 
 barfs for yet unknown reasons. When it happens, I get a BUG with 
 backtrace and this scsi channel is dead until I reboot. Seems to be 
 something with either generic scsi error handling or with mpt scsi.

I think it might actually be fixed by this:

http://git.kernel.org/?p=linux/kernel/git/jejb/scsi.git;a=commit;h=222a806af830fda34ad1f6bc991cd226916de060

James


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


[PATCH 0/1] Option for scsi_debug to fake removable devices

2012-07-10 Thread Martin Pitt
Hello all,

sorry for resending this twice to the lists. Initially I thought
mailing James directly was not appropriate, but I was now told that
get_maintainer.pl is actually speaking the truth and I am supposed to
do just that.


For the purposes of automatically testing udisks and gvfs automounting
I would like to add a parameter to scsi_debug to control the
removable attribute of the created block device. With that, we can
test system-internal and removable drives, as well as CD-ROMs (which
scsi_debug can already emulate). udisks requires different privileges
for mounting system-internal drives vs.  removable/hotpluggable
drives. This will also allow us to write system integration tests for
gvfs, which will exercise the whole stack including the actual polkit
configuration in a VM.

I wrote a simple kernel patch for this (against linux-next), and
tested this quite thoroughly.

I ran the style checker, and it reports two problems:

 8 --
WARNING: line over 80 characters
#109: FILE: drivers/scsi/scsi_debug.c:3255:
+   ret |= driver_create_file(sdebug_driverfs_driver, 
driver_attr_removable);

WARNING: Prefer pr_err(... to printk(KERN_ERR, ...
#126: FILE: drivers/scsi/scsi_debug.c:3353:
+   printk(KERN_ERR scsi_debug_init: removable must be 0 or 1\n);
 8 --

But as the existing code uses this style in the adjacent lines, I
favored consistency over fixing those. If the latter is desired, I'd
rather send a separate patch with just the style cleanup for the whole
file.

I got an ack from David Zeuthen (the primary udisks maintainer)
already, noted so in the patch.

Thank you in advance for considering,

Martin

-- 
Martin Pitt| http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


signature.asc
Description: Digital signature


[PATCH 1/1] [SCSI] scsi_debug: Add removable parameter

2012-07-10 Thread Martin Pitt
Add removable module parameter to set the removable attribute of any
subsequently created debug block device. It is a writable driver option, so
that you can switch between removable and fixed media block devices in
between the add_host calls.

This is useful for being able to test the different behaviour/required
privileges in e. g. the udisks test suite.

Signed-off-by: Martin Pitt martin.p...@ubuntu.com
Acked-By: David Zeuthen zeut...@gmail.com
---
 drivers/scsi/scsi_debug.c |   30 +++---
 1 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 182d5a5..57fbd5a 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -109,6 +109,7 @@ static const char * scsi_debug_version_date = 20100324;
 #define DEF_OPT_BLKS 64
 #define DEF_PHYSBLK_EXP 0
 #define DEF_PTYPE   0
+#define DEF_REMOVABLE false
 #define DEF_SCSI_LEVEL   5/* INQUIRY, byte2 [5-SPC-3] */
 #define DEF_SECTOR_SIZE 512
 #define DEF_UNMAP_ALIGNMENT 0
@@ -193,11 +194,11 @@ static unsigned int scsi_debug_unmap_granularity = 
DEF_UNMAP_GRANULARITY;
 static unsigned int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS;
 static unsigned int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC;
 static unsigned int scsi_debug_write_same_length = DEF_WRITESAME_LENGTH;
+static bool scsi_debug_removable = DEF_REMOVABLE;
 
 static int scsi_debug_cmnd_count = 0;
 
 #define DEV_READONLY(TGT)  (0)
-#define DEV_REMOVEABLE(TGT)(0)
 
 static unsigned int sdebug_store_sectors;
 static sector_t sdebug_capacity;   /* in sectors */
@@ -919,7 +920,7 @@ static int resp_inquiry(struct scsi_cmnd * scp, int target,
return ret;
}
/* drops through here for a standard inquiry */
-   arr[1] = DEV_REMOVEABLE(target) ? 0x80 : 0; /* Removable disk */
+   arr[1] = scsi_debug_removable ? 0x80 : 0;   /* Removable disk */
arr[2] = scsi_debug_scsi_level;
arr[3] = 2;/* response_data_format==2 */
arr[4] = SDEBUG_LONG_INQ_SZ - 5;
@@ -1211,7 +1212,7 @@ static int resp_format_pg(unsigned char * p, int 
pcontrol, int target)
p[11] = sdebug_sectors_per  0xff;
p[12] = (scsi_debug_sector_size  8)  0xff;
p[13] = scsi_debug_sector_size  0xff;
-   if (DEV_REMOVEABLE(target))
+   if (scsi_debug_removable)
p[20] |= 0x20; /* should agree with INQUIRY */
if (1 == pcontrol)
memset(p + 2, 0, sizeof(format_pg) - 2);
@@ -2754,6 +2755,7 @@ module_param_named(opt_blks, scsi_debug_opt_blks, int, 
S_IRUGO);
 module_param_named(opts, scsi_debug_opts, int, S_IRUGO | S_IWUSR);
 module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO);
 module_param_named(ptype, scsi_debug_ptype, int, S_IRUGO | S_IWUSR);
+module_param_named(removable, scsi_debug_removable, bool, S_IRUGO | S_IWUSR);
 module_param_named(scsi_level, scsi_debug_scsi_level, int, S_IRUGO);
 module_param_named(sector_size, scsi_debug_sector_size, int, S_IRUGO);
 module_param_named(unmap_alignment, scsi_debug_unmap_alignment, int, S_IRUGO);
@@ -2796,6 +2798,7 @@ MODULE_PARM_DESC(opt_blks, optimal transfer length in 
block (def=64));
 MODULE_PARM_DESC(opts, 1-noise, 2-medium_err, 4-timeout, 
8-recovered_err... (def=0));
 MODULE_PARM_DESC(physblk_exp, physical block exponent (def=0));
 MODULE_PARM_DESC(ptype, SCSI peripheral type(def=0[disk]));
+MODULE_PARM_DESC(removable, claim to have removable media (def=0));
 MODULE_PARM_DESC(scsi_level, SCSI level to simulate(def=5[SPC-3]));
 MODULE_PARM_DESC(sector_size, logical block size in bytes (def=512));
 MODULE_PARM_DESC(unmap_alignment, lowest aligned thin provisioning lba 
(def=0));
@@ -3205,6 +3208,25 @@ static ssize_t sdebug_map_show(struct device_driver 
*ddp, char *buf)
 }
 DRIVER_ATTR(map, S_IRUGO, sdebug_map_show, NULL);
 
+static ssize_t sdebug_removable_show(struct device_driver *ddp,
+char *buf)
+{
+   return scnprintf(buf, PAGE_SIZE, %d\n, scsi_debug_removable ? 1 : 0);
+}
+static ssize_t sdebug_removable_store(struct device_driver *ddp,
+ const char *buf, size_t count)
+{
+   int n;
+
+   if ((count  0)  (1 == sscanf(buf, %d, n))  (n = 0)) {
+   scsi_debug_removable = (n  0);
+   return count;
+   }
+   return -EINVAL;
+}
+DRIVER_ATTR(removable, S_IRUGO | S_IWUSR, sdebug_removable_show,
+   sdebug_removable_store);
+
 
 /* Note: The following function creates attribute files in the
/sys/bus/pseudo/drivers/scsi_debug directory. The advantage of these
@@ -3230,6 +3252,7 @@ static int do_create_driverfs_files(void)
ret |= driver_create_file(sdebug_driverfs_driver, 
driver_attr_num_tgts);
ret |= driver_create_file(sdebug_driverfs_driver, driver_attr_ptype);
ret |= driver_create_file(sdebug_driverfs_driver, driver_attr_opts);
+   ret |= 

Re: mptscsi: BUG: unable to handle kernel NULL pointer, in scsi_send_eh_cmnd

2012-07-10 Thread Meelis Roos
  I am using Linux 3.4.0 with a 53c1030 and a tape library that sometimes 
  barfs for yet unknown reasons. When it happens, I get a BUG with 
  backtrace and this scsi channel is dead until I reboot. Seems to be 
  something with either generic scsi error handling or with mpt scsi.
 
 I think it might actually be fixed by this:
 
 http://git.kernel.org/?p=linux/kernel/git/jejb/scsi.git;a=commit;h=222a806af830fda34ad1f6bc991cd226916de060

Tested on top on 3.4.0, works - mptscsih is reset successfully, domain 
validation for all scsi devices succeeds, no BUG. Scsi communication 
works.

-- 
Meelis Roos (mr...@linux.ee)
--
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: mptscsi: BUG: unable to handle kernel NULL pointer, in scsi_send_eh_cmnd

2012-07-10 Thread James Bottomley
On Tue, 2012-07-10 at 14:54 +0300, Meelis Roos wrote:
   I am using Linux 3.4.0 with a 53c1030 and a tape library that sometimes 
   barfs for yet unknown reasons. When it happens, I get a BUG with 
   backtrace and this scsi channel is dead until I reboot. Seems to be 
   something with either generic scsi error handling or with mpt scsi.
  
  I think it might actually be fixed by this:
  
  http://git.kernel.org/?p=linux/kernel/git/jejb/scsi.git;a=commit;h=222a806af830fda34ad1f6bc991cd226916de060
 
 Tested on top on 3.4.0, works - mptscsih is reset successfully, domain 
 validation for all scsi devices succeeds, no BUG. Scsi communication 
 works.

Thanks .. I'll be pushing it today.

James



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


[PATCH RESEND 0/3] drivers/scsi/ufs: Misc fixes

2012-07-10 Thread Venkatraman S
Hi James,
  These patches have been posted to lkml and have been in linux-next
for sometime through Andrew Morton's tree.
 I think they should be taken through your tree for next merge window.

Can you please merge these ? 

Thanks and regards,
Venkat.

Namjae Jeon (1):
  drivers/scsi/ufs: fix incorrect return value about SUCCESS and FAILED

Venkatraman S (2):
  drivers/scsi/ufs: use module_pci_driver
  drivers/scsi/ufs: reverse the ufshcd_is_device_present logic

 drivers/scsi/ufs/ufshcd.c |   35 ++-
 1 files changed, 10 insertions(+), 25 deletions(-)

--
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 RESEND 2/3] drivers/scsi/ufs: reverse the ufshcd_is_device_present logic

2012-07-10 Thread Venkatraman S
Otherwise it counter intuitively returns 0 if device is present.

Signed-off-by: Venkatraman S svenk...@ti.com
Reviewed-by: Namjae Jeon linkinj...@gmail.com
Acked-by: Santosh Y santos...@gmail.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---
 drivers/scsi/ufs/ufshcd.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 40c43bf..48b01fe 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -232,11 +232,11 @@ static inline u32 ufshcd_get_ufs_version(struct ufs_hba 
*hba)
  *   the host controller
  * @reg_hcs - host controller status register value
  *
- * Returns 0 if device present, non-zero if no device detected
+ * Returns 1 if device present, 0 if no device detected
  */
 static inline int ufshcd_is_device_present(u32 reg_hcs)
 {
-   return (DEVICE_PRESENT  reg_hcs) ? 0 : -1;
+   return (DEVICE_PRESENT  reg_hcs) ? 1 : 0;
 }
 
 /**
@@ -911,7 +911,7 @@ static int ufshcd_make_hba_operational(struct ufs_hba *hba)
 
/* check if device present */
reg = readl((hba-mmio_base + REG_CONTROLLER_STATUS));
-   if (ufshcd_is_device_present(reg)) {
+   if (!ufshcd_is_device_present(reg)) {
dev_err(hba-pdev-dev, cc: Device not present\n);
err = -ENXIO;
goto out;
-- 
1.7.0.4

--
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 RESEND 1/3] drivers/scsi/ufs: use module_pci_driver

2012-07-10 Thread Venkatraman S
Use macro module_pci_driver and get rid of boilerplate code.  No
functional changes.

Signed-off-by: Venkatraman S svenk...@ti.com
Acked-by: Santosh Y santos...@gmail.com
Cc: James E.J. Bottomley jbottom...@parallels.com
Signed-off-by: Andrew Morton a...@linux-foundation.org
---
 drivers/scsi/ufs/ufshcd.c |   19 +--
 1 files changed, 1 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 6a4fd00..40c43bf 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1953,24 +1953,7 @@ static struct pci_driver ufshcd_pci_driver = {
 #endif
 };
 
-/**
- * ufshcd_init - Driver registration routine
- */
-static int __init ufshcd_init(void)
-{
-   return pci_register_driver(ufshcd_pci_driver);
-}
-module_init(ufshcd_init);
-
-/**
- * ufshcd_exit - Driver exit clean-up routine
- */
-static void __exit ufshcd_exit(void)
-{
-   pci_unregister_driver(ufshcd_pci_driver);
-}
-module_exit(ufshcd_exit);
-
+module_pci_driver(ufshcd_pci_driver);
 
 MODULE_AUTHOR(Santosh Yaragnavi santosh...@samsung.com, 
  Vinayak Holikatti h.vina...@samsung.com);
-- 
1.7.0.4

--
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 RESEND 3/3] drivers/scsi/ufs: fix incorrect return value about SUCCESS and FAILED

2012-07-10 Thread James Bottomley
On Tue, 2012-07-10 at 19:39 +0530, Venkatraman S wrote:
 From: Namjae Jeon linkinj...@gmail.com
 
 Currently the UFS host driver has returned incorrect values for SUCCESS
 and FAILED.  Fix it to return the correct value to the upper layer.
 
 Signed-off-by: Namjae Jeon linkinj...@gmail.com
 Acked-by: Santosh Y santos...@gmail.com
 Cc: James Bottomley james.bottom...@hansenpartnership.com
 Signed-off-by: Andrew Morton a...@linux-foundation.org

The signoff chain here doesn't make sense.  It needs to be signed off by
you, not by Andrew since you're the one sending the patches.  Signoffs
follow the way the patch is transmitted, so it needs author (it has)
followed by maintainer ack (it has) followed by signoff of the person
sending the patch to the list (that's you) which is missing.

James


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


[PATCH RESEND 3/3] drivers/scsi/ufs: fix incorrect return value about SUCCESS and FAILED

2012-07-10 Thread Venkatraman S
From: Namjae Jeon linkinj...@gmail.com

Currently the UFS host driver has returned incorrect values for SUCCESS
and FAILED.  Fix it to return the correct value to the upper layer.

Signed-off-by: Namjae Jeon linkinj...@gmail.com
Acked-by: Santosh Y santos...@gmail.com
Signed-off-by: Venkatraman S svenk...@ti.com
Cc: James Bottomley james.bottom...@hansenpartnership.com
---
 drivers/scsi/ufs/ufshcd.c |   10 ++
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index 48b01fe..58f4ba6 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -1163,6 +1163,8 @@ static int ufshcd_task_req_compl(struct ufs_hba *hba, u32 
index)
if (task_result != UPIU_TASK_MANAGEMENT_FUNC_COMPL 
task_result != UPIU_TASK_MANAGEMENT_FUNC_SUCCEEDED)
task_result = FAILED;
+   else
+   task_result = SUCCESS;
} else {
task_result = FAILED;
dev_err(hba-pdev-dev,
@@ -1556,7 +1558,7 @@ ufshcd_issue_tm_cmd(struct ufs_hba *hba,
goto out;
}
clear_bit(free_slot, hba-tm_condition);
-   return ufshcd_task_req_compl(hba, free_slot);
+   err = ufshcd_task_req_compl(hba, free_slot);
 out:
return err;
 }
@@ -1580,7 +1582,7 @@ static int ufshcd_device_reset(struct scsi_cmnd *cmd)
tag = cmd-request-tag;
 
err = ufshcd_issue_tm_cmd(hba, hba-lrb[tag], UFS_LOGICAL_RESET);
-   if (err)
+   if (err == FAILED)
goto out;
 
for (pos = 0; pos  hba-nutrs; pos++) {
@@ -1620,7 +1622,7 @@ static int ufshcd_host_reset(struct scsi_cmnd *cmd)
if (hba-ufshcd_state == UFSHCD_STATE_RESET)
return SUCCESS;
 
-   return (ufshcd_do_reset(hba) == SUCCESS) ? SUCCESS : FAILED;
+   return ufshcd_do_reset(hba);
 }
 
 /**
@@ -1652,7 +1654,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
spin_unlock_irqrestore(host-host_lock, flags);
 
err = ufshcd_issue_tm_cmd(hba, hba-lrb[tag], UFS_ABORT_TASK);
-   if (err)
+   if (err == FAILED)
goto out;
 
scsi_dma_unmap(cmd);
-- 
1.7.0.4

--
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 RESUBMIT 0/3] remove unnecessary read of PCI_CAP_ID_EXP

2012-07-10 Thread Jon Mason
This is a resubmission of 3 of 19 patches from ~1 year ago.  The rest were
integrated by the other subsystem maintainers at the time.  I believe the
hiccup was some confusion as to whether this would cause an issue on PPC
(http://www.spinics.net/lists/linux-scsi/msg53079.html).  However, this was
later refuted (https://patchwork.kernel.org/patch/937012/) and was ack'ed
(http://www.spinics.net/lists/linux-scsi/msg53169.html).

I recently found these collecting dust and would appreciate them being included.

Thanks,
Jon

--
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 RESUBMIT 1/3] qla4xxx: remove unnecessary read of PCI_CAP_ID_EXP

2012-07-10 Thread Jon Mason
The PCIE capability offset is saved during PCI bus walking.  It will
remove an unnecessary search in the PCI configuration space if this
value is referenced instead of reacquiring it.

Signed-off-by: Jon Mason jdma...@kudzu.us
Cc: Ravi Anand ravi.an...@qlogic.com
Cc: Vikas Chaudhary vikas.chaudh...@qlogic.com
Cc: iscsi-dri...@qlogic.com
---
 drivers/scsi/qla4xxx/ql4_nx.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla4xxx/ql4_nx.c b/drivers/scsi/qla4xxx/ql4_nx.c
index 228b670..939d726 100644
--- a/drivers/scsi/qla4xxx/ql4_nx.c
+++ b/drivers/scsi/qla4xxx/ql4_nx.c
@@ -1590,7 +1590,7 @@ qla4_8xxx_start_firmware(struct scsi_qla_host *ha, 
uint32_t image_start)
}
 
/* Negotiated Link width */
-   pcie_cap = pci_find_capability(ha-pdev, PCI_CAP_ID_EXP);
+   pcie_cap = pci_pcie_cap(ha-pdev);
pci_read_config_word(ha-pdev, pcie_cap + PCI_EXP_LNKSTA, lnk);
ha-link_width = (lnk  4)  0x3f;
 
-- 
1.7.9.5

--
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 RESUBMIT 2/3] qla2xxx: remove unnecessary reads of PCI_CAP_ID_EXP

2012-07-10 Thread Jon Mason
The PCIE capability offset is saved during PCI bus walking.  It will
remove an unnecessary search in the PCI configuration space if this
value is referenced instead of reacquiring it.  Also, pci_is_pcie is a
better way of determining if the device is PCIE or not (as it uses the
same saved PCIE capability offset).

Signed-off-by: Jon Mason jdma...@kudzu.us
Cc: Andrew Vasquez andrew.vasq...@qlogic.com
Cc: linux-dri...@qlogic.com
---
 drivers/scsi/qla2xxx/qla_init.c |4 ++--
 drivers/scsi/qla2xxx/qla_nx.c   |4 ++--
 drivers/scsi/qla2xxx/qla_os.c   |4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index ca50847..a44653b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -685,7 +685,7 @@ qla24xx_pci_config(scsi_qla_host_t *vha)
pcix_set_mmrbc(ha-pdev, 2048);
 
/* PCIe -- adjust Maximum Read Request Size (2048). */
-   if (pci_find_capability(ha-pdev, PCI_CAP_ID_EXP))
+   if (pci_is_pcie(ha-pdev))
pcie_set_readrq(ha-pdev, 2048);
 
pci_disable_rom(ha-pdev);
@@ -721,7 +721,7 @@ qla25xx_pci_config(scsi_qla_host_t *vha)
pci_write_config_word(ha-pdev, PCI_COMMAND, w);
 
/* PCIe -- adjust Maximum Read Request Size (2048). */
-   if (pci_find_capability(ha-pdev, PCI_CAP_ID_EXP))
+   if (pci_is_pcie(ha-pdev))
pcie_set_readrq(ha-pdev, 2048);
 
pci_disable_rom(ha-pdev);
diff --git a/drivers/scsi/qla2xxx/qla_nx.c b/drivers/scsi/qla2xxx/qla_nx.c
index caf627b..9ce3a8f 100644
--- a/drivers/scsi/qla2xxx/qla_nx.c
+++ b/drivers/scsi/qla2xxx/qla_nx.c
@@ -1620,7 +1620,7 @@ qla82xx_pci_info_str(struct scsi_qla_host *vha, char *str)
char lwstr[6];
uint16_t lnk;
 
-   pcie_reg = pci_find_capability(ha-pdev, PCI_CAP_ID_EXP);
+   pcie_reg = pci_pcie_cap(ha-pdev);
pci_read_config_word(ha-pdev, pcie_reg + PCI_EXP_LNKSTA, lnk);
ha-link_width = (lnk  4)  0x3f;
 
@@ -2528,7 +2528,7 @@ qla82xx_start_firmware(scsi_qla_host_t *vha)
}
 
/* Negotiated Link width */
-   pcie_cap = pci_find_capability(ha-pdev, PCI_CAP_ID_EXP);
+   pcie_cap = pci_pcie_cap(ha-pdev);
pci_read_config_word(ha-pdev, pcie_cap + PCI_EXP_LNKSTA, lnk);
ha-link_width = (lnk  4)  0x3f;
 
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 6d1d873..fb8cd38 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -482,12 +482,12 @@ qla24xx_pci_info_str(struct scsi_qla_host *vha, char *str)
uint32_t pci_bus;
int pcie_reg;
 
-   pcie_reg = pci_find_capability(ha-pdev, PCI_CAP_ID_EXP);
+   pcie_reg = pci_pcie_cap(ha-pdev);
if (pcie_reg) {
char lwstr[6];
uint16_t pcie_lstat, lspeed, lwidth;
 
-   pcie_reg += 0x12;
+   pcie_reg += PCI_EXP_LNKCAP;
pci_read_config_word(ha-pdev, pcie_reg, pcie_lstat);
lspeed = pcie_lstat  (BIT_0 | BIT_1 | BIT_2 | BIT_3);
lwidth = (pcie_lstat 
-- 
1.7.9.5

--
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 RESUBMIT 3/3] lpfc: remove unnecessary read of PCI_CAP_ID_EXP

2012-07-10 Thread Jon Mason
The PCIE capability offset is saved during PCI bus walking.  It will
remove an unnecessary search in the PCI configuration space if this
value is referenced instead of reacquiring it.  Also, pci_is_pcie is a
better way of determining if the device is PCIE or not (as it uses the
same saved PCIE capability offset).

Signed-off-by: Jon Mason jdma...@kudzu.us
Cc: James Smart james.sm...@emulex.com
---
 drivers/scsi/lpfc/lpfc_init.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 411ed48..f30b3d2 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4253,7 +4253,7 @@ lpfc_enable_pci_dev(struct lpfc_hba *phba)
pci_save_state(pdev);
 
/* PCIe EEH recovery on powerpc platforms needs fundamental reset */
-   if (pci_find_capability(pdev, PCI_CAP_ID_EXP))
+   if (pci_is_pcie(pdev))
pdev-needs_freset = 1;
 
return 0;
-- 
1.7.9.5

--
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: 'Device not ready' issue on mpt2sas since 3.1.10

2012-07-10 Thread Robert Trace
On 07/09/2012 09:51 PM, Robert Trace wrote:
 
 Huh..  I just retested this and I'm seeing really random behavior.

Ok, with a refined test I've been able to reliably reproduce this and I
bisected it back to commit 85ef06d1d252f6a2e73b678591ab71caad4667bb in
Linus' tree (introduced between 3.0 and 3.1):

commit 85ef06d1d252f6a2e73b678591ab71caad4667bb
Author: Tejun Heo t...@kernel.org
Date:   Fri Jul 1 16:17:47 2011 +0200

block: flush MEDIA_CHANGE from drivers on close(2)

Prior to the above commit, sleeping disks will spin up as a result of
I/O sent to them.  With the above commit, they don't spin up and
immediately return an I/O failure.

That's all the further I've gotten so far.  I'll be happy to test any
patches or suggestions.

-- Rob
--
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/4] [SCSI] ufs: Separate PCI glue driver for ufshcd

2012-07-10 Thread vinayak holikatti
On Mon, Jul 2, 2012 at 8:47 PM, Arnd Bergmann a...@arndb.de wrote:
 On Monday 02 July 2012, Vinayak Holikatti wrote:

 This patch separates PCI and core UFS host controller driver.
 In the current implementation PCI specific code is with ufshcd.c.
 To provide way for adding multiple bus glue driver, this patch
 separates PCI layer from ufshcd core. Now ufshcd compiles as separate
 module and ufshcd-pci as separate module.

 Signed-off-by: Vinayak Holikatti vinholika...@gmail.com
 Signed-off-by: Santosh Yaraganavi santos...@gmail.com

 Hi Vinayak,

 This patch looks good at first sight, but it's a little hard to
 review in the form that you are posting.

 I would recommend that you split this patch into two separate
 changesets, where you do all the changes to existing code in the
 first patch, and only move but don't change code in the second one
 that creates the new file.
 Ok, will spilt accordinglly to make it two changesets.

 Arnd
--
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 RESEND 3/3] drivers/scsi/ufs: fix incorrect return value about SUCCESS and FAILED

2012-07-10 Thread Namjae Jeon
Thanks Venkat !

2012/7/11, Venkatraman S svenk...@ti.com:
 From: Namjae Jeon linkinj...@gmail.com

 Currently the UFS host driver has returned incorrect values for SUCCESS
 and FAILED.  Fix it to return the correct value to the upper layer.

 Signed-off-by: Namjae Jeon linkinj...@gmail.com
 Acked-by: Santosh Y santos...@gmail.com
 Signed-off-by: Venkatraman S svenk...@ti.com
 Cc: James Bottomley james.bottom...@hansenpartnership.com
 ---
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/4] [SCSI] ufs: Add Platform glue driver for ufshcd

2012-07-10 Thread vinayak holikatti
On Mon, Jul 2, 2012 at 8:57 PM, Arnd Bergmann a...@arndb.de wrote:
 On Monday 02 July 2012, Vinayak Holikatti wrote:
 +static struct platform_driver ufshcd_pltfrm_driver = {
 +   .probe  = ufshcd_pltfrm_probe,
 +   .remove = __devexit_p(ufshcd_pltfrm_remove),
 +#ifdef CONFIG_PM
 +   .suspend = ufshcd_pltfrm_suspend,
 +   .resume = ufshcd_pltfrm_resume,
 +#endif
 +   .driver = {
 +   .name   = ufshcd,
 +   .owner  = THIS_MODULE,
 +   },
 +};

 Hi Vinayak,

 Please add a device tree match table here to allow the driver to be
 used by modern platforms that only do device tree based hardware
 detection. Just look in other drivers for existing uses of
 of_match_table to be used.

 I'm not sure what the compatible string should be in this case,
 because the it matches a JEDEC specification, not a particular
 vendor's implementation of it. The match table can have multiple
 entries, which is useful if you have multiple implementations
 that are slightly different or don't fully conform to the spec.

 Maybe a list like

 static const struct of_device_id ufs_of_match[] = {
 { .compatible = jedec,ufs-1.1 },
 }

 would be enough for now.
Ok, will implement device tree match table.

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


Re: [PATCH 3/4] [SCSI] ufs: Add AMBA glue driver to ufshcd

2012-07-10 Thread vinayak holikatti
On Mon, Jul 2, 2012 at 8:50 PM, Arnd Bergmann a...@arndb.de wrote:
 On Monday 02 July 2012, Vinayak Holikatti wrote:
 +static struct amba_id ufshcd_amba_ids[] = {
 +   {
 +   /* Fake id for Primecell.*/
 +   .id = 0x00041FF0,
 +   .mask   = 0x000f,
 +   },
 +   { 0, 0 },
 +};

 Hi Vinayak,

 Can you explain where this fake ID comes from? Is this ID actually
 used by any hardware that is around somewhere? If not, I think it
 would be better not to provide an AMBA driver at all, but instead
 use the platform driver from patch 2 for all non-PCI uses.
The fake ID is just a dummy ID. As you say, we will drop the amba driver
for now. When primecell controller comes up, we will have the driver integrated.

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