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

2014-03-12 Thread Michael Schmitz

Finn,

nothings' been merged yet, still pending review from the SCSI team. 
Comments below.




This is a larger version of Michael's patch. It takes care of the 
header
files and comments and it addresses sun3_NCR5380 as well as 
atari_NCR5380.
This means that the initio.h include (!) can be dropped from 
sun3_scsi.h.


Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

Michael, I'm assuming that your patch hasn't been merged already (I 
didn't
find it in any of the likely repos). Please go ahead and add your 
sign-off
on this version if it is satisfactory. I didn't test this patch: I 
presume
that sun3_NCR5380 would need the same abort/reset fixes that 
atari_NCR5380

needed...


diff --git a/drivers/scsi/atari_NCR5380.c 
b/drivers/scsi/atari_NCR5380.c

index 0f3cdbc..e4aaf9a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -2683,11 +2683,11 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
cmd-scsi_done(cmd);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
} else {
 /* local_irq_restore(flags); */
printk(scsi%d: abort of connected command failed!\n, 
HOSTNO);
-   return SCSI_ABORT_ERROR;
+   return FAILED;
}
}
 #endif
@@ -2711,7 +2711,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 * yet... */
tmp-scsi_done(tmp);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}

@@ -2729,7 +2729,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
if (hostdata-connected) {
local_irq_restore(flags);
ABRT_PRINTK(scsi%d: abort failed, command connected.\n, 
HOSTNO);
-   return SCSI_ABORT_SNOOZE;
+   return FAILED;
}

/*
@@ -2764,7 +2764,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
ABRT_PRINTK(scsi%d: aborting disconnected command.\n, 
HOSTNO);

if (NCR5380_select(instance, cmd, (int)cmd-tag))
-   return SCSI_ABORT_BUSY;
+   return FAILED;

ABRT_PRINTK(scsi%d: nexus reestablished.\n, HOSTNO);

@@ -2791,7 +2791,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
tmp-scsi_done(tmp);

falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}
}
@@ -2816,7 +2816,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 */
falcon_release_lock_if_possible(hostdata);

-   return SCSI_ABORT_NOT_RUNNING;
+   return FAILED;
 }


@@ -2825,7 +2825,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  *
  * Purpose : reset the SCSI bus.
  *
- * Returns : SCSI_RESET_WAKEUP
+ * Returns : SUCCESS or FAILURE
  *
  */

@@ -2834,7 +2834,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
SETUP_HOSTDATA(cmd-device-host);
int i;
unsigned long flags;
-#if 1
+#if defined(RESET_RUN_DONE)
Scsi_Cmnd *connected, *disconnected_queue;
 #endif

@@ -2859,7 +2859,14 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
 * through anymore ... */
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);

-#if 1	/* XXX Should now be done by midlevel code, but it's broken XXX 
*/

+   /* MSch 20140115 - looking at the generic NCR5380 driver, all of this
+* should go.
+* Catch-22: if we don't clear all queues, the SCSI driver lock will
+* not be reset by atari_scsi_reset()!


Bugger - typo of mine, meant to say 'released' not 'reset'.


+*/
+
+#if defined(RESET_RUN_DONE)
+   /* XXX Should now be done by midlevel code, but it's broken XXX */
/* XXX see belowXXX */

 	/* MSch: old-style reset: actually abort all command processing here 
*/

@@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
 * the midlevel code that the reset was SUCCESSFUL, and there is no
 * need to 'wake up' the commands by a request_sense
 */
-   return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
+   return SUCCESS;
 #else /* 1 */

 	/* MSch: new-style reset handling: let the mid-level do what it can 
*/

@@ -2963,6 +2970,6 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
local_irq_restore(flags);

 	/* we did no complete reset of all commands, so a wakeup is required 
*/

-   return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;

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

2014-03-12 Thread Michael Schmitz

Bugger - forgot to CC Sammy as well.

My only comment of substance is that the reset handling doesn't need to 
be done the same way as on Atari, as there's no special locking to 
account for.


Cheers,

Michael

Am 11.03.2014 um 21:28 schrieb Geert Uytterhoeven:


CC Sammy

On Tue, Mar 11, 2014 at 9:21 AM, Finn Thain 
fth...@telegraphics.com.au wrote:


This is a larger version of Michael's patch. It takes care of the 
header
files and comments and it addresses sun3_NCR5380 as well as 
atari_NCR5380.
This means that the initio.h include (!) can be dropped from 
sun3_scsi.h.


Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

Michael, I'm assuming that your patch hasn't been merged already (I 
didn't
find it in any of the likely repos). Please go ahead and add your 
sign-off
on this version if it is satisfactory. I didn't test this patch: I 
presume
that sun3_NCR5380 would need the same abort/reset fixes that 
atari_NCR5380

needed...


diff --git a/drivers/scsi/atari_NCR5380.c 
b/drivers/scsi/atari_NCR5380.c

index 0f3cdbc..e4aaf9a 100644
--- a/drivers/scsi/atari_NCR5380.c
+++ b/drivers/scsi/atari_NCR5380.c
@@ -2683,11 +2683,11 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
cmd-scsi_done(cmd);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
} else {
 /* local_irq_restore(flags); */
printk(scsi%d: abort of connected command 
failed!\n, HOSTNO);

-   return SCSI_ABORT_ERROR;
+   return FAILED;
}
}
 #endif
@@ -2711,7 +2711,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 * yet... */
tmp-scsi_done(tmp);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}

@@ -2729,7 +2729,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
if (hostdata-connected) {
local_irq_restore(flags);
ABRT_PRINTK(scsi%d: abort failed, command 
connected.\n, HOSTNO);

-   return SCSI_ABORT_SNOOZE;
+   return FAILED;
}

/*
@@ -2764,7 +2764,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
ABRT_PRINTK(scsi%d: aborting disconnected 
command.\n, HOSTNO);


if (NCR5380_select(instance, cmd, 
(int)cmd-tag))

-   return SCSI_ABORT_BUSY;
+   return FAILED;

ABRT_PRINTK(scsi%d: nexus reestablished.\n, 
HOSTNO);


@@ -2791,7 +2791,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
tmp-scsi_done(tmp);

falcon_release_lock_if_possible(hostdata);

-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}
}
@@ -2816,7 +2816,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 */
falcon_release_lock_if_possible(hostdata);

-   return SCSI_ABORT_NOT_RUNNING;
+   return FAILED;
 }


@@ -2825,7 +2825,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  *
  * Purpose : reset the SCSI bus.
  *
- * Returns : SCSI_RESET_WAKEUP
+ * Returns : SUCCESS or FAILURE
  *
  */

@@ -2834,7 +2834,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
SETUP_HOSTDATA(cmd-device-host);
int i;
unsigned long flags;
-#if 1
+#if defined(RESET_RUN_DONE)
Scsi_Cmnd *connected, *disconnected_queue;
 #endif

@@ -2859,7 +2859,14 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
 * through anymore ... */
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);

-#if 1  /* XXX Should now be done by midlevel code, but it's broken 
XXX */
+   /* MSch 20140115 - looking at the generic NCR5380 driver, all 
of this

+* should go.
+* Catch-22: if we don't clear all queues, the SCSI driver 
lock will

+* not be reset by atari_scsi_reset()!
+*/
+
+#if defined(RESET_RUN_DONE)
+   /* XXX Should now be done by midlevel code, but it's broken 
XXX */
/* XXX see below
XXX */


/* MSch: old-style reset: actually abort all command 
processing here */

@@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *cmd)
 * the midlevel code that the reset was SUCCESSFUL, and there 
is no

 * need to 'wake up' the commands by a request_sense
 */
-   return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
+   return SUCCESS;
 #else /* 1 */

/* MSch: new-style reset handling: let the mid-level do what 
it can */


[Bug 71941] New: LSI SAS2116 does not detect disks

2014-03-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=71941

Bug ID: 71941
   Summary: LSI SAS2116 does not detect disks
   Product: SCSI Drivers
   Version: 2.5
Kernel Version: 3.13.6
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: normal
  Priority: P1
 Component: Other
  Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org
  Reporter: kernel-bugzilla.20.drksha...@spamgourmet.com
Regression: No

The LSI SAS 9201 (chip: LSI SAS2116) device in my system isn't detecting any
connected disks. 

Relevant boot dmesg, with 7 disks attached:
Fusion MPT base driver 3.04.20
Copyright (c) 1999-2008 LSI Corporation
Fusion MPT SAS Host driver 3.04.20
mpt2sas version 16.100.00.00 loaded
scsi9 : Fusion MPT SAS Host
mpt2sas0: 64 BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (24692096 kB)
mpt2sas0: IO-APIC enabled: IRQ 16
mpt2sas0: iomem(0xfbbfc000), mapped(0xc9000838), size(16384)
mpt2sas0: ioport(0xde00), size(256)
mpt2sas0: Allocated physical memory: size(13309 kB)
mpt2sas0: Current Controller Queue Depth(5333), Max Controller Queue
Depth(10392)
mpt2sas0: Scatter Gather Elements per IO(128)
mpt2sas0: LSISAS2116: FWVersion(09.00.00.00), ChipRevision(0x02),
BiosVersion(00.00.00.00)
mpt2sas0: Protocol=(Initiator,Target), Capabilities=(TLR,EEDP,Snapshot
Buffer,Diag Trace Buffer,Task Set Full,NCQ)
mpt2sas0: sending port enable !!
mpt2sas0: host_add: handle(0x0001), sas_addr(0x5000d31000407c1f), phys(16)
mpt2sas0: port enable: SUCCESS

This was as an auto-loaded module. I can remove it,
waiting module removal not supported: please upgrade 
mpt2sas version 16.100.00.00 unloading
mpt2sas0: _base_make_ioc_ready
mpt2sas0: _base_make_ioc_ready: ioc_state(0x2400)
mpt2sas0: sending message unit reset !!
mpt2sas0: _base_wait_for_doorbell_ack: successful count(1), timeout(15)
mpt2sas0: message unit reset: SUCCESS 


And reload with higher logging level (Enabled firmware events and reply with
additional info, handshake and initialization, application using IOCTLS,
host reset and task management logging). Note that this reinsert is with two
ports connected to seven disks total:
setting logging_level(0xa738)
mpt2sas version 16.100.00.00 loaded
scsi11 : Fusion MPT SAS Host
mpt2sas0: mpt2sas_base_attach
mpt2sas0: mpt2sas_base_map_resources
mpt2sas0: 64 BIT PCI BUS DMA ADDRESSING SUPPORTED, total mem (24692096 kB)
mpt2sas0: msix is supported, vector_count(1)
mpt2sas0: IO-APIC enabled: IRQ 16
mpt2sas0: iomem(0xfbbfc000), mapped(0xc900077d8000), size(16384)
mpt2sas0: ioport(0xde00), size(256)
mpt2sas0: _base_get_ioc_facts
mpt2sas0: _base_wait_for_doorbell_int: successful count(1), timeout(5)
mpt2sas0: _base_wait_for_doorbell_ack: successful count(1), timeout(5)
(prev line 3 more times)
mpt2sas0: _base_wait_for_doorbell_int: successful count(0), timeout(5)
mpt2sas0: _base_wait_for_doorbell_int: successful count(1), timeout(5)
(prev line 31 more times)
mpt2sas0: _base_wait_for_doorbell_not_used: successful count(0), timeout(5)
offset:data
[0x00]:03100200
[0x04]:1200
[0x08]:
[0x0c]:
[0x10]:
[0x14]:00010480
[0x18]:22132898
[0x1c]:0001285c
[0x20]:0900
[0x24]:0020
[0x28]:03480004
[0x2c]:00440044
[0x30]:09df0003
[0x34]:0020fff0
[0x38]:008003a0
[0x3c]:0011
mpt2sas0: hba queue depth(10392), max chains per io(128)
mpt2sas0: request frame size(128), reply frame size(128)
mpt2sas0: _base_make_ioc_ready
mpt2sas0: _base_make_ioc_ready: ioc_state(0x1400)
mpt2sas0: _base_get_port_facts
mpt2sas0: _base_wait_for_doorbell_int: successful count(1), timeout(5)
(prev line 4 more times)
mpt2sas0: _base_wait_for_doorbell_int: successful count(0), timeout(5)
mpt2sas0: _base_wait_for_doorbell_int: successful count(1), timeout(5)
(prev line 13 more times)
mpt2sas0: _base_wait_for_doorbell_not_used: successful count(0), timeout(5)
offset:data
[0x00]:0507
[0x04]:
[0x08]:
[0x0c]:
[0x10]:
[0x14]:3000
[0x18]:020e
mpt2sas0: _base_allocate_memory_pools
mpt2sas0: scatter gather: sge_in_main_msg(1), sge_per_chain(9),
sge_per_io(128), chains_per_io(15)
mpt2sas0: scsi host: can_queue depth (5333)
mpt2sas0: request pool(0x8800d860): depth(10392), frame_size(128),
pool_size(1299 kB)
mpt2sas0: request pool: dma(0xd860)
mpt2sas0: scsiio(0x8800d860): depth(5333)
mpt2sas0: chain pool depth(79995), frame_size(128), pool_size( kB)
mpt2sas0: hi_priority(0x8800d86a6b00): depth(2527), start smid(5334)
mpt2sas0: internal(0x8800d86f5a80): depth(2532), start smid(7861)
mpt2sas0: sense pool(0x8805fed8): depth(5333), element_size(96),
pool_size(499 kB)
mpt2sas0: sense_dma(0x5fed8)
mpt2sas0: reply pool(0x8805ff40): depth(10456), frame_size(128),

Re: [PATCH 3/5] Add EVPD page 0x83 to sysfs

2014-03-12 Thread h...@infradead.org
On Mon, Mar 10, 2014 at 09:52:03PM +0100, Hannes Reinecke wrote:
 Yes, I thought of that, too.
 I thought to remember that binary attributes are reserved for
 firmware/hardware-dependent interfaces.

That's what we're dealing with here, aren't we?

 What should happen with the first patch in the series, then?
 When moving to a binary attribute the first patch isn't required
 anymore; should I drop it or send as a separate patch?

To me it seems useful even without the rest.

--
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/2] scsi: explicitly release bidi buffers

2014-03-12 Thread Christoph Hellwig
Instead of trying to guess when we have a BIDI buffer in scsi_release_buffers
add a function to explicitly free the BIDI ressoures in the one place that
handles them.  This avoids needing a special __scsi_release_buffers for the
case where we already have freed the request as well.

Signed-off-by: Christoph Hellwig h...@lst.de

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index debe30a..3012700 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -511,8 +511,6 @@ void scsi_run_host_queues(struct Scsi_Host *shost)
scsi_run_queue(sdev-request_queue);
 }
 
-static void __scsi_release_buffers(struct scsi_cmnd *, int);
-
 /*
  * Function:scsi_end_request()
  *
@@ -568,7 +566,7 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd 
*cmd, int error,
 * This will goose the queue request function at the end, so we don't
 * need to worry about launching another command.
 */
-   __scsi_release_buffers(cmd, 0);
+   scsi_release_buffers(cmd);
scsi_next_command(cmd);
return NULL;
 }
@@ -624,30 +622,10 @@ static void scsi_free_sgtable(struct scsi_data_buffer 
*sdb)
__sg_free_table(sdb-table, SCSI_MAX_SG_SEGMENTS, scsi_sg_free);
 }
 
-static void __scsi_release_buffers(struct scsi_cmnd *cmd, int do_bidi_check)
-{
-
-   if (cmd-sdb.table.nents)
-   scsi_free_sgtable(cmd-sdb);
-
-   memset(cmd-sdb, 0, sizeof(cmd-sdb));
-
-   if (do_bidi_check  scsi_bidi_cmnd(cmd)) {
-   struct scsi_data_buffer *bidi_sdb =
-   cmd-request-next_rq-special;
-   scsi_free_sgtable(bidi_sdb);
-   kmem_cache_free(scsi_sdb_cache, bidi_sdb);
-   cmd-request-next_rq-special = NULL;
-   }
-
-   if (scsi_prot_sg_count(cmd))
-   scsi_free_sgtable(cmd-prot_sdb);
-}
-
 /*
  * Function:scsi_release_buffers()
  *
- * Purpose: Completion processing for block device I/O requests.
+ * Purpose: Free resources allocate for a scsi_command.
  *
  * Arguments:   cmd- command that we are bailing.
  *
@@ -658,15 +636,29 @@ static void __scsi_release_buffers(struct scsi_cmnd *cmd, 
int do_bidi_check)
  * Notes:   In the event that an upper level driver rejects a
  * command, we must release resources allocated during
  * the __init_io() function.  Primarily this would involve
- * the scatter-gather table, and potentially any bounce
- * buffers.
+ * the scatter-gather table.
  */
 void scsi_release_buffers(struct scsi_cmnd *cmd)
 {
-   __scsi_release_buffers(cmd, 1);
+   if (cmd-sdb.table.nents)
+   scsi_free_sgtable(cmd-sdb);
+
+   memset(cmd-sdb, 0, sizeof(cmd-sdb));
+
+   if (scsi_prot_sg_count(cmd))
+   scsi_free_sgtable(cmd-prot_sdb);
 }
 EXPORT_SYMBOL(scsi_release_buffers);
 
+static void scsi_release_bidi_buffers(struct scsi_cmnd *cmd)
+{
+   struct scsi_data_buffer *bidi_sdb = cmd-request-next_rq-special;
+
+   scsi_free_sgtable(bidi_sdb);
+   kmem_cache_free(scsi_sdb_cache, bidi_sdb);
+   cmd-request-next_rq-special = NULL;
+}
+
 /**
  * __scsi_error_from_host_byte - translate SCSI error code into errno
  * @cmd:   SCSI command (unused)
@@ -799,6 +791,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int 
good_bytes)
req-next_rq-resid_len = scsi_in(cmd)-resid;
 
scsi_release_buffers(cmd);
+   scsi_release_bidi_buffers(cmd);
blk_end_request_all(req, 0);
 
scsi_next_command(cmd);
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2014-03-12 Thread Finn Thain

This is a larger version of Michael's patch. It takes care of the header 
files and comments and it addresses sun3_NCR5380 as well as atari_NCR5380. 
This means that the initio.h include (!) can be dropped from sun3_scsi.h.

Signed-off-by: Finn Thain fth...@telegraphics.com.au

---

This version defines RESET_RUN_DONE in sun3_scsi.c, to avoid changing 
driver behaviour whilst trying to keep sun3_NCR5380.c in sync with 
atari_NCR5380.c (from which it was originally copied).


Index: linux-m68k/drivers/scsi/atari_NCR5380.c
===
--- linux-m68k.orig/drivers/scsi/atari_NCR5380.c2014-03-13 
01:12:33.0 +1100
+++ linux-m68k/drivers/scsi/atari_NCR5380.c 2014-03-13 01:13:55.0 
+1100
@@ -2683,11 +2683,11 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
cmd-scsi_done(cmd);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
} else {
 /* local_irq_restore(flags); */
printk(scsi%d: abort of connected command failed!\n, 
HOSTNO);
-   return SCSI_ABORT_ERROR;
+   return FAILED;
}
}
 #endif
@@ -2711,7 +2711,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 * yet... */
tmp-scsi_done(tmp);
falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}
 
@@ -2729,7 +2729,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
if (hostdata-connected) {
local_irq_restore(flags);
ABRT_PRINTK(scsi%d: abort failed, command connected.\n, 
HOSTNO);
-   return SCSI_ABORT_SNOOZE;
+   return FAILED;
}
 
/*
@@ -2764,7 +2764,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
ABRT_PRINTK(scsi%d: aborting disconnected command.\n, 
HOSTNO);
 
if (NCR5380_select(instance, cmd, (int)cmd-tag))
-   return SCSI_ABORT_BUSY;
+   return FAILED;
 
ABRT_PRINTK(scsi%d: nexus reestablished.\n, HOSTNO);
 
@@ -2791,7 +2791,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
local_irq_restore(flags);
tmp-scsi_done(tmp);

falcon_release_lock_if_possible(hostdata);
-   return SCSI_ABORT_SUCCESS;
+   return SUCCESS;
}
}
}
@@ -2816,7 +2816,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
 */
falcon_release_lock_if_possible(hostdata);
 
-   return SCSI_ABORT_NOT_RUNNING;
+   return FAILED;
 }
 
 
@@ -2825,7 +2825,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd)
  *
  * Purpose : reset the SCSI bus.
  *
- * Returns : SCSI_RESET_WAKEUP
+ * Returns : SUCCESS or FAILURE
  *
  */
 
@@ -2834,7 +2834,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
SETUP_HOSTDATA(cmd-device-host);
int i;
unsigned long flags;
-#if 1
+#if defined(RESET_RUN_DONE)
Scsi_Cmnd *connected, *disconnected_queue;
 #endif
 
@@ -2859,7 +2859,14 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
 * through anymore ... */
(void)NCR5380_read(RESET_PARITY_INTERRUPT_REG);
 
-#if 1  /* XXX Should now be done by midlevel code, but it's broken XXX */
+   /* MSch 20140115 - looking at the generic NCR5380 driver, all of this
+* should go.
+* Catch-22: if we don't clear all queues, the SCSI driver lock will
+* not be released by atari_scsi_reset()!
+*/
+
+#if defined(RESET_RUN_DONE)
+   /* XXX Should now be done by midlevel code, but it's broken XXX */
/* XXX see belowXXX */
 
/* MSch: old-style reset: actually abort all command processing here */
@@ -2915,7 +2922,7 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
 * the midlevel code that the reset was SUCCESSFUL, and there is no
 * need to 'wake up' the commands by a request_sense
 */
-   return SCSI_RESET_SUCCESS | SCSI_RESET_BUS_RESET;
+   return SUCCESS;
 #else /* 1 */
 
/* MSch: new-style reset handling: let the mid-level do what it can */
@@ -2963,6 +2970,6 @@ static int NCR5380_bus_reset(Scsi_Cmnd *
local_irq_restore(flags);
 
/* we did no complete reset of all commands, so a wakeup is required */
-   return SCSI_RESET_WAKEUP | SCSI_RESET_BUS_RESET;
+   return SUCCESS;
 #endif /* 1 */
 }
Index: linux-m68k/drivers/scsi/atari_scsi.c

Re: [PATCH v15 3/3] arm64: Add APM X-Gene SoC AHCI SATA host controller DTS entries

2014-03-12 Thread Loc Ho
Hi,

 Kishon didn't applied the PHY DTS patch. Did you first apply the PHY
 DTS patch? We agreed that you will first pull in the PHY DTS as well
 as the host controller patches. I don't see any reason why it wouldn't
 apply if both DTS is applied. I will pull libata/for-3.15 and check
 out.

 Can you please repost patches to apply on top of the current
 libata/for-3.15?


I posted v16 yetersday with the PHY DTS merged into the SATA host patches.

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


blk_iopoll_enabled

2014-03-12 Thread Sagi Grimberg

Hey Jens,

So I'm looking at blk_iopoll for iSER  SRP and I have one gap I would 
like to get your input on.


In blk-iopoll.c I see:
int blk_iopoll_enabled = 1;
EXPORT_SYMBOL(blk_iopoll_enabled);

This is set to 1 and exported for everyone to condition and *modify* it.
The documentation says the user must check this when using blk_iopoll.

My question is why? it should always be true shouldn't it?
Moreover, isn't it better to protect it using a get() function of it?
can't someone set it to 0 and shutdown the lights on everyone else?

Thanks,

Sagi.
--
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 v16 3/4] ata: Add APM X-Gene SoC AHCI SATA host controller driver

2014-03-12 Thread Bartlomiej Zolnierkiewicz

Hi,

Thanks for updating this patch, there are still some issue left though
(please see below).

On Tuesday, March 11, 2014 04:11:34 PM Loc Ho wrote:
 This patch adds support for the APM X-Gene SoC AHCI SATA host controller
 driver. It requires the corresponding APM X-Gene SoC PHY driver. This
 initial version only supports Gen3 speed.
 
 Signed-off-by: Loc Ho l...@apm.com
 Signed-off-by: Tuan Phan tp...@apm.com
 Signed-off-by: Suman Tripathi stripa...@apm.com
 ---
  drivers/ata/Kconfig  |7 +
  drivers/ata/Makefile |1 +
  drivers/ata/ahci_xgene.c |  490 
 ++
  3 files changed, 498 insertions(+), 0 deletions(-)
  create mode 100644 drivers/ata/ahci_xgene.c
 
 diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
 index 93fc2f0..9de4ca5 100644
 --- a/drivers/ata/Kconfig
 +++ b/drivers/ata/Kconfig
 @@ -115,6 +115,13 @@ config AHCI_SUNXI
  
 If unsure, say N.
  
 +config AHCI_XGENE
 + tristate APM X-Gene 6.0Gbps AHCI SATA host controller support
 + depends on SATA_AHCI_PLATFORM  (ARM64 || COMPILE_TEST)
 + select PHY_XGENE
 + help
 +  This option enables support for APM X-Gene SoC SATA host controller.
 +
  config SATA_FSL
   tristate Freescale 3.0Gbps SATA support
   depends on FSL_SOC
 diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
 index 246050b..72b423b 100644
 --- a/drivers/ata/Makefile
 +++ b/drivers/ata/Makefile
 @@ -12,6 +12,7 @@ obj-$(CONFIG_SATA_DWC)  += sata_dwc_460ex.o
  obj-$(CONFIG_SATA_HIGHBANK)  += sata_highbank.o libahci.o
  obj-$(CONFIG_AHCI_IMX)   += ahci_imx.o
  obj-$(CONFIG_AHCI_SUNXI) += ahci_sunxi.o
 +obj-$(CONFIG_AHCI_XGENE) += ahci_xgene.o
  
  # SFF w/ custom DMA
  obj-$(CONFIG_PDC_ADMA)   += pdc_adma.o
 diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
 new file mode 100644
 index 000..df37c78
 --- /dev/null
 +++ b/drivers/ata/ahci_xgene.c

[...]

 +static struct ata_port_operations xgene_ahci_ops = {
 + .inherits = ahci_ops,
 + .hardreset = xgene_ahci_hardreset,
 + .read_id = xgene_ahci_read_id,
 +};

[...]

 +static int xgene_ahci_probe(struct platform_device *pdev)
 +{
 + struct device *dev = pdev-dev;
 + struct ahci_host_priv *hpriv;
 + struct xgene_ahci_context *ctx;
 + struct resource *res;
 + int rc;
 +
 + hpriv = ahci_platform_get_resources(pdev);
 + if (IS_ERR(hpriv))
 + return PTR_ERR(hpriv);
 +
 + ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
 + if (!ctx) {
 + dev_err(dev, can't allocate host context\n);
 + return -ENOMEM;
 + }
 + hpriv-plat_data = ctx;
 + ctx-hpriv = hpriv;
 + ctx-dev = dev;
 +
 + res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
 + if (!res) {
 + dev_err(dev, no csr space\n);
 + return -EINVAL;
 + }
 +
 + /*
 +  * Can't use devm_ioremap_resource due to overlapping region.
 +  * 0x. - host core
 +  * 0x.7000 - Mux (if applicable)
 +  * 0x.A000 - PHY indirect access
 +  * 0x.C000 - Clock
 +  * 0x.D000 - RAM shutdown removal
 +  * As we map the entire region as one, it overlaps with the PHY driver.
 +  */
 + ctx-csr_base = devm_ioremap(dev, res-start, resource_size(res));
 + if (!ctx-csr_base) {
 + dev_err(dev, can't map %pR\n, res);
 + return -ENOMEM;
 + }
 +
 + dev_dbg(dev, VAddr 0x%p Mmio VAddr 0x%p\n, ctx-csr_base,
 + hpriv-mmio);
 +
 + /* Select ATA */
 + if (of_device_is_compatible(pdev-dev.of_node,
 + XGENE_AHCI_SGMII_DTS)) {
 + if (xgene_ahci_mux_select(ctx)) {
 + dev_err(dev, SATA mux selection failed\n);
 + return -ENODEV;
 + }
 + }
 +
 + /* Due to errata, HW requires full toggle transition */
 + rc = ahci_platform_enable_clks(hpriv);
 + if (rc)
 + goto disable_resources;
 + ahci_platform_disable_clks(hpriv);
 +
 + rc = ahci_platform_enable_resources(hpriv);
 + if (rc)
 + goto disable_resources;
 +
 + /* Configure the host controller */
 + xgene_ahci_hw_init(hpriv);
 +
 + /* Setup DMA mask - 32 for 32-bit system and 64 for 64-bit system */
 + rc = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(8*sizeof(void *)));
 + if (rc) {
 + dev_err(dev, Unable to set dma mask\n);
 + phy_exit(hpriv-phy);
 + goto disable_resources;

Since the code has been switched to use generic ahci_platform -phy
support phy_exit() is now handled by ahci_platform_disable_resources()
and the direct call should be removed.

 + }
 +
 + rc = ahci_platform_init_host(pdev, hpriv, xgene_ahci_port_info, 0, 0);
 + if (rc) {
 + phy_exit(hpriv-phy);

ditto

 + goto disable_resources;
 + }
 +
 + dev_dbg(dev, X-Gene SATA host controller 

Re: [PATCH 5/6] target: Allocate se_luns only when used

2014-03-12 Thread Nicholas A. Bellinger
On Fri, 2014-03-07 at 10:22 -0800, Christoph Hellwig wrote:
 On Fri, Mar 07, 2014 at 10:12:09AM -0800, Andy Grover wrote:
  I can't see how the synchronization can work without refcounting the lun
  structure.  The lock just protectes the assignment, but you free it
  right after.  What happens to how jsut dereferenced it under the lock
  but then uses it outside (e.g. core_dev_add_initiator_node_lun_acl).
  
  Well you're right, but this is one instance of a larger lio
  locking/refcounting hairball. This will be addressed in a separate
  patch series.
 
 I don't think that's true. Before your series we might be accessing a
 lun structure that was marked as not active just before, but now the
 race becomes a genuine use after free.
 

FYI, since v3.13 code se_lun is using percpu refcounting with commit
5277797d..

--nab

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


[Bug 71981] New: Writing session to CD does not update some important cached information

2014-03-12 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=71981

Bug ID: 71981
   Summary: Writing session to CD does not update some important
cached information
   Product: SCSI Drivers
   Version: 2.5
Kernel Version: 3.13.5-101
  Hardware: All
OS: Linux
  Tree: Mainline
Status: NEW
  Severity: low
  Priority: P1
 Component: Other
  Assignee: scsi_drivers-ot...@kernel-bugs.osdl.org
  Reporter: wor...@alum.mit.edu
Regression: No

(This is based on the bug report
https://bugzilla.redhat.com/show_bug.cgi?id=918200)

When I repartition a disk, when I exit the partitioning tool, it has
some method of ordering the kernel to re-read the partition table.
Thus, after repartitioning, the partitions I've created/changed are
available for use.

But when I burn a CD, when the CD-burning tool is done, it does not
seem to be able to tell the kernel about the data track that now
exists.  (Or so the people at bugzilla.redhat.com say.)  To gain
access to the new track, the CD has to be ejected and reloaded.

It seems to me that this is a deficiency that shouldn't be too hard to
fix.
--
Here is a detailed example of the problem:

# # Determine version information.
# uname -a
Linux hobgoblin.ariadne.com 3.13.5-101.fc19.x86_64 #1 SMP Tue Feb 25 21:25:32
UTC 2014 x86_64 x86_64 x86_64 GNU/Linux # cat /etc/redhat-release
Fedora release 19 (Schrödinger’s Cat)
# rpm -qa | grep cdr
libcdr-0.0.14-1.fc19.x86_64
cdrdao-1.2.3-19.fc19.x86_64
# # Verify that the file contains a valid ISO filesystem.
# mount -o loop ~worley/temp/time-warp-iso /mnt/temp
mount: /dev/loop0 is write-protected, mounting read-only
# ls /mnt/temp
COMMIT_EDITMSGORIG_HEAD  config~index  objects   refs
FETCH_HEADbranches   descriptioninfo   packed-refs
HEADconfig   hookslogs   qgit_cache.dat
# umount /mnt/temp
# # Burn the filesystem onto a new CD-R.
# wodim dev=/dev/sr0 -multi speed=32 fs=32m -v -data ~worley/temp/time-warp-iso
wodim: No write mode specified.
wodim: Assuming -tao mode.
wodim: Future versions of wodim may have different drive dependent defaults.
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.27
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type: Removable CD-ROM
Version: 5
Response Format: 2
Capabilities   : 
Vendor_info: 'TSSTcorp'
Identification : 'DVD+-RW TS-U633A'
Revision   : 'D300'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
[...]
Track 01:  625 of  625 MB written (fifo 100%) [buf 100%]  25.2x.
Track 01: Total bytes read/written: 656142336/656142336 (320382 sectors).
Writing  time:  255.813s
Average write speed  17.1x.
Min drive buffer fill was 99%
Fixating...
Fixating time:   43.895s
BURN-Free was never needed.
wodim: fifo had 10335 puts and 10335 gets.
wodim: fifo was 0 times empty and 9573 times full, min fill was 97%.
# # Attempt to mount the CD-R immediately after burning it.
# mount /dev/sr0 /mnt/temp
mount: /dev/sr0 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/sr0,
   missing codepage or helper program, or other error

   In some cases useful info is found in syslog - try
   dmesg | tail or so.
# dmesg | tail
[99045.625479] i801_smbus :00:1f.3: using default PCI settings
[99045.649439] dell_wmi: Received unknown WMI event (0x11)
[100784.941616] loop: module loaded
[100785.165164] ISO 9660 Extensions: Microsoft Joliet Level 3
[100785.222074] ISO 9660 Extensions: RRIP_1991A
[100785.07] SELinux: initialized (dev loop0, type iso9660), uses
genfs_contexts
[100931.369609] fuse init (API version 7.22)
[100931.711371] SELinux: initialized (dev fuse, type fuse), uses genfs_contexts
[100932.052892] SELinux: initialized (dev fusectl, type fusectl), uses
genfs_contexts
[101215.067563] isofs_fill_super: bread failed, dev=sr0, iso_blknum=16,
block=16
# # Eject and reload the CD-R and then try to mount it.
# eject /dev/sr0
# mount /dev/sr0 /mnt/temp
mount: /dev/sr0 is write-protected, mounting read-only
# ll /mnt/temp
total 2493
-r--r--r--. 1 root root  34 Mar  8 03:45 COMMIT_EDITMSG
-r--r--r--. 1 root root  87 May 27  2013 FETCH_HEAD
-r--r--r--. 1 root root  26 Jun 12  2013 HEAD
-r--r--r--. 1 root root  41 Mar  8 02:45 ORIG_HEAD
dr-xr-xr-x. 2 root root2048 May 11  2013 branches
-r--r--r--. 1 root root 234 Mar  6 12:55 config
-r--r--r--. 1 root root 233 Feb 26 14:34 config~
-r--r--r--. 1 root root  73 May 11  2013 description
dr-xr-xr-x. 2 root root2048 May 11  2013 hooks
-r--r--r--. 1 root root 2350328 Mar  8 02:45 index
dr-xr-xr-x. 2 root root2048 Mar  8 02:54 info
dr-xr-xr-x. 3 root root2048 May 22  2013 logs
dr-xr-xr-x. 4 root root2048 Mar  8 02:54 objects
-r--r--r--. 1 root 

Re: [PATCH v16 3/4] ata: Add APM X-Gene SoC AHCI SATA host controller driver

2014-03-12 Thread Loc Ho
Hi,

 +MODULE_DEVICE_TABLE(of, xgene_ahci_of_match);
 +
 +static struct platform_driver xgene_ahci_driver = {
 + .probe = xgene_ahci_probe,
 + .remove = ata_platform_remove_one,

 It is good to use ata_platform_remove_one() here but some code still needs
 to callback ahci_platform_disable_resources() before the driver is removed
 completely.  The way other drivers do it is to define custom -host_stop
 method and add it to port ops (xgene_ahci_ops in this case).  For X-Gene
 AHCI driver -host_stop function can be quite simple and look like this:

 static void xgene_ahci_host_stop(struct ata_host *host)
 {
 struct ahci_host_priv *hpriv = host-private_data;

 ahci_platform_disable_resources(hpriv);
 }

Will do.


 + .driver = {
 + .name = xgene-ahci,
 + .owner = THIS_MODULE,
 + .of_match_table = xgene_ahci_of_match,
 + },

 Power Management support is missing for this driver.  If your platform
 doesn't support Suspend to RAM yet it would be good to add a comment
 about this explaining the lack of PM.  Otherwise it should be fixed (you
 can take a look at ahci_imx.c and ahci_sunxi.c for examples).

In order to support PM, I will need an other errata fix in libachi.c.
For now PM, will NOT be support.


 Otherwise the driver looks good to me and (FWIW) you can add:

 Reviewed-by: Bartlomiej Zolnierkiewicz b.zolnier...@samsung.com

 Once the aforementioned issues are fixed.

I will post another version. If you ack'ed that version, Tejun can add
you to the Reviewed-by list.

-Loc
--
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 v17 0/4] ata: Add APM X-Gene SoC AHCI SATA host controller support

2014-03-12 Thread Loc Ho
This patch adds support for the APM X-Gene SoC AHCI SATA host controller. In
order for the host controller to work, the corresponding PHY driver
musts also be available. Currently, only Gen3 disk is supported with this
initial version.

v17:
 * Add comment on no support for PM currently
 * Add xgene_ahci_host_stop function to support stopping the controller
 * Remove call to phy_exit as not necessary with new ahci_platform code

v16:
 * Rebase to libata-for-3.15
 * Pull in the PHY DTS patch as the host controller DTS patch depends on it

v15:
 * Rebase to libata next branch
 * Remove field plat_data and PHY from context structure
 * Fix comment on function xgene_ahci_read_id as well as using bit mask to
   clear DEVSLP bit
 * Remove function xgene_ahci_force_phy_rdy and xgene_ahci_phy_restart as not
   required since Gen1/Gen2 support remove for this initial version
 * Update function xgene_ahci_do_hardreset comment
 * Remove Gen1/Gen2 support from function xgene_ahci_do_hardreset
 * Change int to u32 for variable portcmd_saved in function
   xgene_ahci_hardreset
 * Change variable hplat_data to ctx in function xgene_ahci_probe
 * Remove PHY call and using ahci_platform_enable_resource instead
 * Add ahci_patlform_remove_one to driver function .remove
 * Change phy-name to sata-phy

v14:
 * Remove the shutdown already check and replace the while loop check with
   msleep in function xgene_ahci_init_memram

v13:
 * Add fully-winged style comment for function xgene_ahci_read_id and
   xgene_ahci_do_hardrest
 * Minor comments update for function xgene_ahci_read_id,
   xgene_ahci_do_hardrest, and xgene_ahci_hardreset
 * NOTE: There is no functional code change.

v12:
 * Remove function xgene_ahci_get_channel and use the ata_port field port_no
 * Update comment for function xgene_ahci_read_id to function comment style
   '/**'
 * Update comment for multiple lines to fully-winged style

v11:
 * Drop the export functions requirement with libachi
 * Change CONFIG_SATA_XGENE to CONFIG_AHCI_XGENE
 * Rename file sata_xgene.c to ahci_xgene.c
 * Convert to use Hans De Geode version 5 ahci_platform code re-factor changes
   to reduce code duplication. For extra context, use plat_data to store our
   context. The probe function follows the ahci_sunxi implementation. A number
   of code fragments update to reflect this change.
 * Update comment for function xgene_ahci_read_id
 * Minor code move around in function xgene_ahci_do_hardreset and use
   ATA_BUSY instead 0x80
 * Fix hardreset to use start_engine function pointer as required due to newer
   kernel rebased
 * Fix the set DMA mask for 32-bit as well

v10:
 * Update binding documentation

v9:
 * Remove ACPI/EFI include files
 * Remove the IO flush support, interrupt routine, and DTS resources
 * Remove function xgene_rd, xgene_wr, and xgene_wr_flush
 * Remove PMP support (function xgene_ahci_qc_issue, xgene_ahci_qc_prep,
   xgene_ahci_qc_fill_rtf, xgene_ahci_softreset, and xgene_ahci_do_softreset)
 * Rename function xgene_ahci_enable_phy to xgene_ahci_force_phy_rdy
 * Clean up hardreset functions
 * Require v7 of the PHY driver

v8:
 * Remove _ADDR from defines
 * Remove define MSTAWAUX_COHERENT_BYPASS_SET and
   STARAUX_COHERENT_BYPASS_SET and use direct coding
 * Remove the un-necessary check for DTS boot with built in ACPI table
 * Switch to use dma_set_mask_and_coherent for setting DMA mask
 * Remove ACPI table matching code
 * Update clock-names for sata01clk, sata23clk, and sata45clk

v7:
 * Update the clock code by toggle the clock
 * Update the DTS clock mask values due to the clock spilt between host and
   v5 of the PHY drivers

v6:
 * Update binding documentation
 * Change select PHY_XGENE_SATA to PHY_XGENE
 * Add ULL to constants
 * Change indentation and comments
 * Clean up the probe functions a bit more
 * Remove xgene_ahci_remove function
 * Add the flush register to DTS
 * Remove the interrupt-parent from DTS

v5:
 * Sync up to v3 of the PHY driver
 * Remove MSLIM wrapper functions
 * Change the memory shutdown loop to use usleep_range
 * Use devm_ioremap_resource instead devm_ioremap
 * Remove suspend/resume functions as not needed

v4:
 * Remove the ID property in DT
 * Remove the temporary PHY direct function call and use PHY function
 * Change printk to pr_debug
 * Move the IOB flush addresses into the DT
 * Remove the parameters retrieval function as no longer needed
 * Remove the header file as no longer needed
 * Require v2 patch of the SATA PHY driver. Require slightly modification
   in the Kconfig as it is moved to folder driver/phy and use Kconfig
   PHY_XGENE_SATA instead SATA_XGENE_PHY.

v3:
 * Move out the SATA PHY to another driver
 * Remove the clock-cells entry from DTS
 * Remove debug wrapper
 * Remove delay functions wrapper
 * Clean up resource and IRQ query
 * Remove query clock name
 * Switch to use dma_set_mask/dma_coherent_mask
 * Remove un-necessary devm_kfree
 * Update GPL license header to v2
 * Spilt up function 

[PATCH v17 1/4] arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries

2014-03-12 Thread Loc Ho
This patch adds the DTS entries for the APM X-Gene SoC 15Gbps Multi-purpose
PHY driver. The PHY for SATA controller 2 and 3 are enabled by default.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Tuan Phan tp...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---
 arch/arm64/boot/dts/apm-storm.dtsi |   75 
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/arch/arm64/boot/dts/apm-storm.dtsi 
b/arch/arm64/boot/dts/apm-storm.dtsi
index d37d736..c78ddcf 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -176,6 +176,51 @@
reg-names = csr-reg;
clock-output-names = eth8clk;
};
+
+   sataphy1clk: sataphy1clk@1f21c000 {
+   compatible = apm,xgene-device-clock;
+   #clock-cells = 1;
+   clocks = socplldiv2 0;
+   clock-names = socplldiv2;
+   reg = 0x0 0x1f21c000 0x0 0x1000;
+   reg-names = csr-reg;
+   clock-output-names = sataphy1clk;
+   status = disabled;
+   csr-offset = 0x4;
+   csr-mask = 0x00;
+   enable-offset = 0x0;
+   enable-mask = 0x06;
+   };
+
+   sataphy2clk: sataphy1clk@1f22c000 {
+   compatible = apm,xgene-device-clock;
+   #clock-cells = 1;
+   clocks = socplldiv2 0;
+   clock-names = socplldiv2;
+   reg = 0x0 0x1f22c000 0x0 0x1000;
+   reg-names = csr-reg;
+   clock-output-names = sataphy2clk;
+   status = ok;
+   csr-offset = 0x4;
+   csr-mask = 0x3a;
+   enable-offset = 0x0;
+   enable-mask = 0x06;
+   };
+
+   sataphy3clk: sataphy1clk@1f23c000 {
+   compatible = apm,xgene-device-clock;
+   #clock-cells = 1;
+   clocks = socplldiv2 0;
+   clock-names = socplldiv2;
+   reg = 0x0 0x1f23c000 0x0 0x1000;
+   reg-names = csr-reg;
+   clock-output-names = sataphy3clk;
+   status = ok;
+   csr-offset = 0x4;
+   csr-mask = 0x3a;
+   enable-offset = 0x0;
+   enable-mask = 0x06;
+   };
};
 
serial0: serial@1c02 {
@@ -187,5 +232,35 @@
interrupt-parent = gic;
interrupts = 0x0 0x4c 0x4;
};
+
+   phy1: phy@1f21a000 {
+   compatible = apm,xgene-phy;
+   reg = 0x0 0x1f21a000 0x0 0x100;
+   #phy-cells = 1;
+   clocks = sataphy1clk 0;
+   status = disabled;
+   apm,tx-boost-gain = 30 30 30 30 30 30;
+   apm,tx-eye-tuning = 2 10 10 2 10 10;
+   };
+
+   phy2: phy@1f22a000 {
+   compatible = apm,xgene-phy;
+   reg = 0x0 0x1f22a000 0x0 0x100;
+   #phy-cells = 1;
+   clocks = sataphy2clk 0;
+   status = ok;
+   apm,tx-boost-gain = 30 30 30 30 30 30;
+   apm,tx-eye-tuning = 1 10 10 2 10 10;
+   };
+
+   phy3: phy@1f23a000 {
+   compatible = apm,xgene-phy;
+   reg = 0x0 0x1f23a000 0x0 0x100;
+   #phy-cells = 1;
+   clocks = sataphy3clk 0;
+   status = ok;
+   apm,tx-boost-gain = 31 31 31 31 31 31;
+   apm,tx-eye-tuning = 2 10 10 2 10 10;
+   };
};
 };
-- 
1.5.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 v17 2/4] Documentation: Add documentation for the APM X-Gene SoC SATA host controller DTS binding

2014-03-12 Thread Loc Ho
This patch adds documentation for the APM X-Gene SoC SATA host controller DTS
binding.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Tuan Phan tp...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---
 .../devicetree/bindings/ata/apm-xgene.txt  |   70 
 1 files changed, 70 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ata/apm-xgene.txt

diff --git a/Documentation/devicetree/bindings/ata/apm-xgene.txt 
b/Documentation/devicetree/bindings/ata/apm-xgene.txt
new file mode 100644
index 000..633eb3b
--- /dev/null
+++ b/Documentation/devicetree/bindings/ata/apm-xgene.txt
@@ -0,0 +1,70 @@
+* APM X-Gene 6.0 Gb/s SATA host controller nodes
+
+SATA host controller nodes are defined to describe on-chip Serial ATA
+controllers. Each SATA controller (pair of ports) have its own node.
+
+Required properties:
+- compatible   : Shall contain:
+  * apm,xgene-ahci-sgmii if mux'ed with SGMII
+  * apm,xgene-ahci-pcie if mux'ed with PCIe
+- reg  : First memory resource shall be the AHCI memory
+ resource.
+ Second memory resource shall be the host controller
+ memory resource.
+- interrupts   : Interrupt-specifier for SATA host controller IRQ.
+- clocks   : Reference to the clock entry.
+- phys : A list of phandles + phy-specifiers, one for each
+ entry in phy-names.
+- phy-names: Should contain:
+  * sata-6g for the SATA 6.0Gbps PHY
+
+Optional properties:
+- status   : Shall be ok if enabled or disabled if disabled.
+ Default is ok.
+- interrupt-parent : Interrupt controller.
+
+Example:
+   sataclk: sataclk {
+   compatible = fixed-clock;
+   #clock-cells = 1;
+   clock-frequency = 1;
+   clock-output-names = sataclk;
+   };
+
+   phy2: phy@1f22a000 {
+   compatible = apm,xgene-phy;
+   reg = 0x0 0x1f22a000 0x0 0x100,
+ 0x0 0x1f22c000 0x0 0x100;
+   #phy-cells = 1;
+   };
+
+   phy3: phy@1f23a000 {
+   compatible = apm,xgene-phy;
+   reg = 0x0 0x1f23a000 0x0 0x100,
+ 0x0 0x1f23c000 0x0 0x100;
+   #phy-cells = 1;
+   };
+
+   sata2: sata@1a40 {
+   compatible = apm,xgene-ahci-sgmii;
+   reg = 0x0 0x1a40 0x0 0x1000,
+ 0x0 0x1f22 0x0 0x1;
+   interrupt-parent = gic;
+   interrupts = 0x0 0x87 0x4;
+   status = ok;
+   clocks = sataclk 0;
+   phys = phy2 0;
+   phy-names = sata-6g;
+   };
+
+   sata3: sata@1a80 {
+   compatible = apm,xgene-ahci-pcie;
+   reg = 0x0 0x1a80 0x0 0x1000,
+ 0x0 0x1f23 0x0 0x1;
+   interrupt-parent = gic;
+   interrupts = 0x0 0x88 0x4;
+   status = ok;
+   clocks = sataclk 0;
+   phys = phy3 0;
+   phy-names = sata-6g;
+   };
-- 
1.5.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 v17 4/4] arm64: Add APM X-Gene SoC AHCI SATA host controller DTS entries

2014-03-12 Thread Loc Ho
This patch adds APM X-Gene SoC AHCI SATA host controller DTS entries.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Tuan Phan tp...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---
 arch/arm64/boot/dts/apm-storm.dtsi |   75 
 1 files changed, 75 insertions(+), 0 deletions(-)

diff --git a/arch/arm64/boot/dts/apm-storm.dtsi 
b/arch/arm64/boot/dts/apm-storm.dtsi
index c78ddcf..2a03e96 100644
--- a/arch/arm64/boot/dts/apm-storm.dtsi
+++ b/arch/arm64/boot/dts/apm-storm.dtsi
@@ -221,6 +221,48 @@
enable-offset = 0x0;
enable-mask = 0x06;
};
+
+   sata01clk: sata01clk@1f21c000 {
+   compatible = apm,xgene-device-clock;
+   #clock-cells = 1;
+   clocks = socplldiv2 0;
+   clock-names = socplldiv2;
+   reg = 0x0 0x1f21c000 0x0 0x1000;
+   reg-names = csr-reg;
+   clock-output-names = sata01clk;
+   csr-offset = 0x4;
+   csr-mask = 0x05;
+   enable-offset = 0x0;
+   enable-mask = 0x39;
+   };
+
+   sata23clk: sata23clk@1f22c000 {
+   compatible = apm,xgene-device-clock;
+   #clock-cells = 1;
+   clocks = socplldiv2 0;
+   clock-names = socplldiv2;
+   reg = 0x0 0x1f22c000 0x0 0x1000;
+   reg-names = csr-reg;
+   clock-output-names = sata23clk;
+   csr-offset = 0x4;
+   csr-mask = 0x05;
+   enable-offset = 0x0;
+   enable-mask = 0x39;
+   };
+
+   sata45clk: sata45clk@1f23c000 {
+   compatible = apm,xgene-device-clock;
+   #clock-cells = 1;
+   clocks = socplldiv2 0;
+   clock-names = socplldiv2;
+   reg = 0x0 0x1f23c000 0x0 0x1000;
+   reg-names = csr-reg;
+   clock-output-names = sata45clk;
+   csr-offset = 0x4;
+   csr-mask = 0x05;
+   enable-offset = 0x0;
+   enable-mask = 0x39;
+   };
};
 
serial0: serial@1c02 {
@@ -262,5 +304,38 @@
apm,tx-boost-gain = 31 31 31 31 31 31;
apm,tx-eye-tuning = 2 10 10 2 10 10;
};
+
+   sata1: sata@1a00 {
+   compatible = apm,xgene-ahci-sgmii;
+   reg = 0x0 0x1a00 0x0 0x1000,
+ 0x0 0x1f21 0x0 0x1;
+   interrupts = 0x0 0x86 0x4;
+   status = disabled;
+   clocks = sata01clk 0;
+   phys = phy1 0;
+   phy-names = sata-phy;
+   };
+
+   sata2: sata@1a40 {
+   compatible = apm,xgene-ahci-sgmii;
+   reg = 0x0 0x1a40 0x0 0x1000,
+ 0x0 0x1f22 0x0 0x1;
+   interrupts = 0x0 0x87 0x4;
+   status = ok;
+   clocks = sata23clk 0;
+   phys = phy2 0;
+   phy-names = sata-phy;
+   };
+
+   sata3: sata@1a80 {
+   compatible = apm,xgene-ahci-pcie;
+   reg = 0x0 0x1a80 0x0 0x1000,
+ 0x0 0x1f23 0x0 0x1;
+   interrupts = 0x0 0x88 0x4;
+   status = ok;
+   clocks = sata45clk 0;
+   phys = phy3 0;
+   phy-names = sata-phy;
+   };
};
 };
-- 
1.5.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 v17 3/4] ata: Add APM X-Gene SoC AHCI SATA host controller driver

2014-03-12 Thread Loc Ho
This patch adds support for the APM X-Gene SoC AHCI SATA host controller
driver. It requires the corresponding APM X-Gene SoC PHY driver. This
initial version only supports Gen3 speed.

Signed-off-by: Loc Ho l...@apm.com
Signed-off-by: Tuan Phan tp...@apm.com
Signed-off-by: Suman Tripathi stripa...@apm.com
---
 drivers/ata/Kconfig  |7 +
 drivers/ata/Makefile |1 +
 drivers/ata/ahci_xgene.c |  497 ++
 3 files changed, 505 insertions(+), 0 deletions(-)
 create mode 100644 drivers/ata/ahci_xgene.c

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 93fc2f0..9de4ca5 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -115,6 +115,13 @@ config AHCI_SUNXI
 
  If unsure, say N.
 
+config AHCI_XGENE
+   tristate APM X-Gene 6.0Gbps AHCI SATA host controller support
+   depends on SATA_AHCI_PLATFORM  (ARM64 || COMPILE_TEST)
+   select PHY_XGENE
+   help
+This option enables support for APM X-Gene SoC SATA host controller.
+
 config SATA_FSL
tristate Freescale 3.0Gbps SATA support
depends on FSL_SOC
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index 246050b..72b423b 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_SATA_DWC)+= sata_dwc_460ex.o
 obj-$(CONFIG_SATA_HIGHBANK)+= sata_highbank.o libahci.o
 obj-$(CONFIG_AHCI_IMX) += ahci_imx.o
 obj-$(CONFIG_AHCI_SUNXI)   += ahci_sunxi.o
+obj-$(CONFIG_AHCI_XGENE)   += ahci_xgene.o
 
 # SFF w/ custom DMA
 obj-$(CONFIG_PDC_ADMA) += pdc_adma.o
diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c
new file mode 100644
index 000..e0e637a
--- /dev/null
+++ b/drivers/ata/ahci_xgene.c
@@ -0,0 +1,497 @@
+/*
+ * AppliedMicro X-Gene SoC SATA Host Controller Driver
+ *
+ * Copyright (c) 2014, Applied Micro Circuits Corporation
+ * Author: Loc Ho l...@apm.com
+ * Tuan Phan tp...@apm.com
+ * Suman Tripathi stripa...@apm.com
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ * NOTE: PM support is not currently available.
+ *
+ */
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/ahci_platform.h
+#include linux/of_address.h
+#include linux/of_irq.h
+#include linux/phy/phy.h
+#include ahci.h
+
+/* Controller who PHY shared with SGMII Ethernet PHY */
+#define XGENE_AHCI_SGMII_DTS   apm,xgene-ahci-sgmii
+
+/* Controller who PHY (internal reference clock macro) shared with PCIe */
+#define XGENE_AHCI_PCIE_DTSapm,xgene-ahci-pcie
+
+/* Max # of disk per a controller */
+#define MAX_AHCI_CHN_PERCTR2
+
+#define SATA_ENET_MUX_OFFSET   0x7000
+#define SATA_DIAG_OFFSET   0xD000
+#define SATA_GLB_OFFSET0xD850
+#define SATA_SHIM_OFFSET   0xE000
+#define SATA_MASTER_OFFSET 0xF000
+#define SATA_PORT0_OFFSET  0x0100
+#define SATA_PORT1_OFFSET  0x0180
+
+/* MUX CSR */
+#define SATA_ENET_CONFIG_REG   0x
+#define  CFG_SATA_ENET_SELECT_MASK 0x0001
+
+/* SATA host controller CSR */
+#define SLVRDERRATTRIBUTES 0x
+#define SLVWRERRATTRIBUTES 0x0004
+#define MSTRDERRATTRIBUTES 0x0008
+#define MSTWRERRATTRIBUTES 0x000c
+#define BUSCTLREG  0x0014
+#define IOFMSTRWAUX0x0018
+#define INTSTATUSMASK  0x002c
+#define ERRINTSTATUS   0x0030
+#define ERRINTSTATUSMASK   0x0034
+
+/* SATA host AHCI CSR */
+#define PORTCFG0x00a4
+#define  PORTADDR_SET(dst, src) \
+   (((dst)  ~0x003f) | (((u32)(src))  0x003f))
+#define PORTPHY1CFG0x00a8
+#define PORTPHY1CFG_FRCPHYRDY_SET(dst, src) \
+   (((dst)  ~0x0010) | (((u32)(src)  0x14)  0x0010))
+#define PORTPHY2CFG0x00ac
+#define PORTPHY3CFG0x00b0
+#define PORTPHY4CFG0x00b4
+#define PORTPHY5CFG0x00b8
+#define SCTL0  0x012C
+#define PORTPHY5CFG_RTCHG_SET(dst, src) \
+   (((dst)  ~0xfff0) | (((u32)(src)  0x14)  0xfff0))
+#define 

[PATCH RESEND 1/7] ipr: Remove extended delay bit on GSCSI reads/writes ops

2014-03-12 Thread wenxiong
This patch removes extended delay bit on GSCSI reads/writes ops, the
performance will be significanly better.

Signed-off-by: Wen Xiong wenxi...@linux.vnet.ibm.com

---
 drivers/scsi/ipr.c |6 +-
 drivers/scsi/ipr.h |1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2014-03-11 17:11:04.487766647 -0500
+++ b/drivers/scsi/ipr.c2014-03-11 17:12:07.218702192 -0500
@@ -1143,6 +1143,7 @@ static void ipr_init_res_entry(struct ip
res-add_to_ml = 0;
res-del_from_ml = 0;
res-resetting_device = 0;
+   res-reset_occurred = 0;
res-sdev = NULL;
res-sata_port = NULL;
 
@@ -5015,6 +5016,7 @@ static int __ipr_eh_dev_reset(struct scs
} else
rc = ipr_device_reset(ioa_cfg, res);
res-resetting_device = 0;
+   res-reset_occurred = 1;
 
LEAVE;
return rc ? FAILED : SUCCESS;
@@ -6183,8 +6185,10 @@ static int ipr_queuecommand(struct Scsi_
ioarcb-cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_ULEN_CHK;
 
ioarcb-cmd_pkt.flags_hi |= IPR_FLAGS_HI_NO_LINK_DESC;
-   if (ipr_is_gscsi(res))
+   if (ipr_is_gscsi(res)  res-reset_occurred) {
+   res-reset_occurred = 0;
ioarcb-cmd_pkt.flags_lo |= 
IPR_FLAGS_LO_DELAY_AFTER_RST;
+   }
ioarcb-cmd_pkt.flags_lo |= IPR_FLAGS_LO_ALIGNED_BFR;
ioarcb-cmd_pkt.flags_lo |= ipr_get_task_attributes(scsi_cmd);
}
Index: b/drivers/scsi/ipr.h
===
--- a/drivers/scsi/ipr.h2014-03-11 17:10:58.577766209 -0500
+++ b/drivers/scsi/ipr.h2014-03-11 17:12:07.218702192 -0500
@@ -1252,6 +1252,7 @@ struct ipr_resource_entry {
u8 add_to_ml:1;
u8 del_from_ml:1;
u8 resetting_device:1;
+   u8 reset_occurred:1;
 
u32 bus;/* AKA channel */
u32 target; /* AKA id */

-- 
--
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/7] New CCINs and several patches for new improvement

2014-03-12 Thread wenxiong
Hi James,

I re-submitted the following patches for ipr device driver. I have re-tested
these patches with our latest adapters.

These patches are:

(1)Remove extended delay bit on GSCSI reads/writes ops.
(2)Add new device id to support Z06 LTD new adapter.
(3)Handle early EEH.
Above 3 patches were submitted on 1/21.

(4)Get rid of superfluous call to pci_disable_msi/msix()
(5)Use pci_enable_msi_range()/pci_enable_msix_range()
Above 2 patches were submiited by Alexander Gordeev

(6)Format HACM overlay ID 0x21.
(7)Add new device id to support Grand Canyon adapters.
Above patches were submitted on 2/15/2014

Let me know if you have questions about this.

Thanks for your help!
Wendy
-- 
--
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 5/7] ipr: Use pci_enable_msi_range() and pci_enable_msix_range()

2014-03-12 Thread wenxiong
From: Alexander Gordeev agord...@redhat.com

As result deprecation of MSI-X/MSI enablement functions
pci_enable_msix() and pci_enable_msi_block() all drivers
using these two interfaces need to be updated to use the
new pci_enable_msi_range() and pci_enable_msix_range()
interfaces.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Brian King brk...@linux.vnet.ibm.com
---
 drivers/scsi/ipr.c |   47 ++-
 1 file changed, 18 insertions(+), 29 deletions(-)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2014-03-11 17:18:06.709957199 -0500
+++ b/drivers/scsi/ipr.c2014-03-11 17:18:20.169018184 -0500
@@ -9317,51 +9317,40 @@ static void ipr_wait_for_pci_err_recover
 static int ipr_enable_msix(struct ipr_ioa_cfg *ioa_cfg)
 {
struct msix_entry entries[IPR_MAX_MSIX_VECTORS];
-   int i, err, vectors;
+   int i, vectors;
 
for (i = 0; i  ARRAY_SIZE(entries); ++i)
entries[i].entry = i;
 
-   vectors = ipr_number_of_msix;
-
-   while ((err = pci_enable_msix(ioa_cfg-pdev, entries, vectors))  0)
-   vectors = err;
-
-   if (err  0) {
+   vectors = pci_enable_msix_range(ioa_cfg-pdev,
+   entries, 1, ipr_number_of_msix);
+   if (vectors  0) {
ipr_wait_for_pci_err_recovery(ioa_cfg);
-   return err;
+   return vectors;
}
 
-   if (!err) {
-   for (i = 0; i  vectors; i++)
-   ioa_cfg-vectors_info[i].vec = entries[i].vector;
-   ioa_cfg-nvectors = vectors;
-   }
+   for (i = 0; i  vectors; i++)
+   ioa_cfg-vectors_info[i].vec = entries[i].vector;
+   ioa_cfg-nvectors = vectors;
 
-   return err;
+   return 0;
 }
 
 static int ipr_enable_msi(struct ipr_ioa_cfg *ioa_cfg)
 {
-   int i, err, vectors;
+   int i, vectors;
 
-   vectors = ipr_number_of_msix;
-
-   while ((err = pci_enable_msi_block(ioa_cfg-pdev, vectors))  0)
-   vectors = err;
-
-   if (err  0) {
+   vectors = pci_enable_msi_range(ioa_cfg-pdev, 1, ipr_number_of_msix);
+   if (vectors  0) {
ipr_wait_for_pci_err_recovery(ioa_cfg);
-   return err;
+   return vectors;
}
 
-   if (!err) {
-   for (i = 0; i  vectors; i++)
-   ioa_cfg-vectors_info[i].vec = ioa_cfg-pdev-irq + i;
-   ioa_cfg-nvectors = vectors;
-   }
+   for (i = 0; i  vectors; i++)
+   ioa_cfg-vectors_info[i].vec = ioa_cfg-pdev-irq + i;
+   ioa_cfg-nvectors = vectors;
 
-   return err;
+   return 0;
 }
 
 static void name_msi_vectors(struct ipr_ioa_cfg *ioa_cfg)
@@ -9426,7 +9415,7 @@ static irqreturn_t ipr_test_intr(int irq
  * ipr_test_msi - Test for Message Signaled Interrupt (MSI) support.
  * @pdev:  PCI device struct
  *
- * Description: The return value from pci_enable_msi() can not always be
+ * Description: The return value from pci_enable_msi_range() can not always be
  * trusted.  This routine sets up and initiates a test interrupt to determine
  * if the interrupt is received via the ipr_test_intr() service routine.
  * If the tests fails, the driver will fall back to LSI.

-- 
--
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 4/7] ipr: Get rid of superfluous call to pci_disbale_msi/msix()

2014-03-12 Thread wenxiong
From: Alexander Gordeev agord...@redhat.com

There is no need to call pci_disable_msi() or pci_disable_msix()
in case the call to pci_enable_msi() or pci_enable_msix() failed.

Signed-off-by: Alexander Gordeev agord...@redhat.com
Acked-by: Brian King brk...@linux.vnet.ibm.com
---
 drivers/scsi/ipr.c |2 --
 1 file changed, 2 deletions(-)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2014-03-11 17:16:08.849955755 -0500
+++ b/drivers/scsi/ipr.c2014-03-11 17:18:06.709957199 -0500
@@ -9329,7 +9329,6 @@ static int ipr_enable_msix(struct ipr_io
 
if (err  0) {
ipr_wait_for_pci_err_recovery(ioa_cfg);
-   pci_disable_msix(ioa_cfg-pdev);
return err;
}
 
@@ -9353,7 +9352,6 @@ static int ipr_enable_msi(struct ipr_ioa
 
if (err  0) {
ipr_wait_for_pci_err_recovery(ioa_cfg);
-   pci_disable_msi(ioa_cfg-pdev);
return err;
}
 

-- 
--
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/7] ipr: Handle early EEH

2014-03-12 Thread wenxiong
From:  Brian King brk...@linux.vnet.ibm.com

If, when the ipr driver loads, the adapter is in an EEH error state,
it will currently oops and not be able to recover, as it attempts
to access memory that has not yet been allocated. We've seen this
occur in some kexec scenarios. The following patch fixes the oops
and also allows the driver to recover from these probe time EEH errors.

Signed-off-by: Brian King brk...@linux.vnet.ibm.com
---

 drivers/scsi/ipr.c |  265 +++--
 drivers/scsi/ipr.h |3 
 2 files changed, 179 insertions(+), 89 deletions(-)

Index: b/drivers/scsi/ipr.h
===
--- a/drivers/scsi/ipr.h2014-03-11 17:13:10.759012001 -0500
+++ b/drivers/scsi/ipr.h2014-03-11 17:13:24.279949356 -0500
@@ -231,6 +231,7 @@
 #define IPR_WAIT_FOR_RESET_TIMEOUT (2 * HZ)
 #define IPR_CHECK_FOR_RESET_TIMEOUT(HZ / 10)
 #define IPR_WAIT_FOR_BIST_TIMEOUT  (2 * HZ)
+#define IPR_PCI_ERROR_RECOVERY_TIMEOUT (120 * HZ)
 #define IPR_PCI_RESET_TIMEOUT  (HZ / 2)
 #define IPR_SIS32_DUMP_TIMEOUT (15 * HZ)
 #define IPR_SIS64_DUMP_TIMEOUT (40 * HZ)
@@ -1443,6 +1444,7 @@ struct ipr_ioa_cfg {
u8 dump_timeout:1;
u8 cfg_locked:1;
u8 clear_isr:1;
+   u8 probe_done:1;
 
u8 revid;
 
@@ -1521,6 +1523,7 @@ struct ipr_ioa_cfg {
 
wait_queue_head_t reset_wait_q;
wait_queue_head_t msi_wait_q;
+   wait_queue_head_t eeh_wait_q;
 
struct ipr_dump *dump;
enum ipr_sdt_state sdt_state;
Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2014-03-11 17:13:10.759012001 -0500
+++ b/drivers/scsi/ipr.c2014-03-11 17:13:24.279949356 -0500
@@ -8645,6 +8645,25 @@ static int ipr_reset_freeze(struct ipr_c
 }
 
 /**
+ * ipr_pci_mmio_enabled - Called when MMIO has been re-enabled
+ * @pdev:  PCI device struct
+ *
+ * Description: This routine is called to tell us that the MMIO
+ * access to the IOA has been restored
+ */
+static pci_ers_result_t ipr_pci_mmio_enabled(struct pci_dev *pdev)
+{
+   unsigned long flags = 0;
+   struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
+
+   spin_lock_irqsave(ioa_cfg-host-host_lock, flags);
+   if (!ioa_cfg-probe_done)
+   pci_save_state(pdev);
+   spin_unlock_irqrestore(ioa_cfg-host-host_lock, flags);
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
  * ipr_pci_frozen - Called when slot has experienced a PCI bus error.
  * @pdev:  PCI device struct
  *
@@ -8658,7 +8677,8 @@ static void ipr_pci_frozen(struct pci_de
struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
 
spin_lock_irqsave(ioa_cfg-host-host_lock, flags);
-   _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_freeze, IPR_SHUTDOWN_NONE);
+   if (ioa_cfg-probe_done)
+   _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_freeze, 
IPR_SHUTDOWN_NONE);
spin_unlock_irqrestore(ioa_cfg-host-host_lock, flags);
 }
 
@@ -8676,11 +8696,14 @@ static pci_ers_result_t ipr_pci_slot_res
struct ipr_ioa_cfg *ioa_cfg = pci_get_drvdata(pdev);
 
spin_lock_irqsave(ioa_cfg-host-host_lock, flags);
-   if (ioa_cfg-needs_warm_reset)
-   ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
-   else
-   _ipr_initiate_ioa_reset(ioa_cfg, ipr_reset_restore_cfg_space,
-   IPR_SHUTDOWN_NONE);
+   if (ioa_cfg-probe_done) {
+   if (ioa_cfg-needs_warm_reset)
+   ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+   else
+   _ipr_initiate_ioa_reset(ioa_cfg, 
ipr_reset_restore_cfg_space,
+   IPR_SHUTDOWN_NONE);
+   } else
+   wake_up_all(ioa_cfg-eeh_wait_q);
spin_unlock_irqrestore(ioa_cfg-host-host_lock, flags);
return PCI_ERS_RESULT_RECOVERED;
 }
@@ -8699,17 +8722,20 @@ static void ipr_pci_perm_failure(struct 
int i;
 
spin_lock_irqsave(ioa_cfg-host-host_lock, flags);
-   if (ioa_cfg-sdt_state == WAIT_FOR_DUMP)
-   ioa_cfg-sdt_state = ABORT_DUMP;
-   ioa_cfg-reset_retries = IPR_NUM_RESET_RELOAD_RETRIES - 1;
-   ioa_cfg-in_ioa_bringdown = 1;
-   for (i = 0; i  ioa_cfg-hrrq_num; i++) {
-   spin_lock(ioa_cfg-hrrq[i]._lock);
-   ioa_cfg-hrrq[i].allow_cmds = 0;
-   spin_unlock(ioa_cfg-hrrq[i]._lock);
-   }
-   wmb();
-   ipr_initiate_ioa_reset(ioa_cfg, IPR_SHUTDOWN_NONE);
+   if (ioa_cfg-probe_done) {
+   if (ioa_cfg-sdt_state == WAIT_FOR_DUMP)
+   ioa_cfg-sdt_state = ABORT_DUMP;
+   ioa_cfg-reset_retries = IPR_NUM_RESET_RELOAD_RETRIES - 1;
+   ioa_cfg-in_ioa_bringdown = 1;
+   for (i 

[PATCH RESEND 7/7] ipr: Add new CCIN definition for Grand Canyon support

2014-03-12 Thread wenxiong
Add the appropriate definition and table entry for new hardware support.

Signed-off-by: Wen Xiong wenxi...@linux.vnet.ibm.com

---
 drivers/scsi/ipr.c |6 ++
 drivers/scsi/ipr.h |3 +++
 2 files changed, 9 insertions(+)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2014-03-11 17:20:48.289943030 -0500
+++ b/drivers/scsi/ipr.c2014-03-11 17:21:01.018707528 -0500
@@ -10123,6 +10123,12 @@ static struct pci_device_id ipr_pci_tabl
PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57EF, 0, 0, 0 },
{ PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROCODILE,
PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_57F0, 0, 0, 0 },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROCODILE,
+   PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2CCA, 0, 0, 0 },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROCODILE,
+   PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2CD2, 0, 0, 0 },
+   { PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CROCODILE,
+   PCI_VENDOR_ID_IBM, IPR_SUBS_DEV_ID_2CCD, 0, 0, 0 },
{ }
 };
 MODULE_DEVICE_TABLE(pci, ipr_pci_table);
Index: b/drivers/scsi/ipr.h
===
--- a/drivers/scsi/ipr.h2014-03-11 17:20:48.289943030 -0500
+++ b/drivers/scsi/ipr.h2014-03-11 17:21:01.018707528 -0500
@@ -108,6 +108,9 @@
 #define IPR_SUBS_DEV_ID_57EE0x049A
 #define IPR_SUBS_DEV_ID_57EF0x049B
 #define IPR_SUBS_DEV_ID_57F00x049C
+#define IPR_SUBS_DEV_ID_2CCA   0x04C7
+#define IPR_SUBS_DEV_ID_2CD2   0x04C8
+#define IPR_SUBS_DEV_ID_2CCD   0x04C9
 #define IPR_NAME   ipr
 
 /*

-- 
--
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 6/7] ipr: Format HCAM overlay ID 0x21

2014-03-12 Thread wenxiong
This patch adds formatting error overlay 0x21 to improve debug capabilities.

Signed-off-by: Wen Xiong wenxi...@linux.vnet.ibm.com

---
 drivers/scsi/ipr.c |   39 +++
 drivers/scsi/ipr.h |   14 ++
 2 files changed, 53 insertions(+)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2014-03-11 17:18:20.169018184 -0500
+++ b/drivers/scsi/ipr.c2014-03-11 17:20:48.289943030 -0500
@@ -2368,6 +2368,42 @@ static void ipr_log_generic_error(struct
 }
 
 /**
+ * ipr_log_sis64_device_error - Log a cache error.
+ * @ioa_cfg:   ioa config struct
+ * @hostrcb:   hostrcb struct
+ *
+ * Return value:
+ * none
+ **/
+static void ipr_log_sis64_device_error(struct ipr_ioa_cfg *ioa_cfg,
+struct ipr_hostrcb *hostrcb)
+{
+   struct ipr_hostrcb_type_21_error *error;
+   char buffer[IPR_MAX_RES_PATH_LENGTH];
+
+   error = hostrcb-hcam.u.error64.u.type_21_error;
+
+   ipr_err(-Failing Device Information-\n);
+   ipr_err(World Wide Unique ID: %08X%08X%08X%08X\n,
+   be32_to_cpu(error-wwn[0]), be32_to_cpu(error-wwn[1]),
+be32_to_cpu(error-wwn[2]), be32_to_cpu(error-wwn[3]));
+   ipr_err(Device Resource Path: %s\n,
+   __ipr_format_res_path(error-res_path,
+ buffer, sizeof(buffer)));
+   error-primary_problem_desc[sizeof(error-primary_problem_desc) - 1] = 
'\0';
+   error-second_problem_desc[sizeof(error-second_problem_desc) - 1] = 
'\0';
+   ipr_err(Primary Problem Description: %s\n, 
error-primary_problem_desc);
+   ipr_err(Secondary Problem Description:  %s\n, 
error-second_problem_desc);
+   ipr_err(SCSI Sense Data: \n);
+   ipr_log_hex_data(ioa_cfg, error-sense_data, sizeof(error-sense_data));
+   ipr_err(SCSI Command Descriptor Block: \n);
+   ipr_log_hex_data(ioa_cfg, error-cdb, sizeof(error-cdb));
+
+   ipr_err(Additional IOA Data: \n);
+   ipr_log_hex_data(ioa_cfg, error-ioa_data, 
be32_to_cpu(error-length_of_error));
+}
+
+/**
  * ipr_get_error - Find the specfied IOASC in the ipr_error_table.
  * @ioasc: IOASC
  *
@@ -2468,6 +2504,9 @@ static void ipr_handle_log_data(struct i
case IPR_HOST_RCB_OVERLAY_ID_20:
ipr_log_fabric_error(ioa_cfg, hostrcb);
break;
+   case IPR_HOST_RCB_OVERLAY_ID_21:
+   ipr_log_sis64_device_error(ioa_cfg, hostrcb);
+   break;
case IPR_HOST_RCB_OVERLAY_ID_23:
ipr_log_sis64_config_error(ioa_cfg, hostrcb);
break;
Index: b/drivers/scsi/ipr.h
===
--- a/drivers/scsi/ipr.h2014-03-11 17:13:24.279949356 -0500
+++ b/drivers/scsi/ipr.h2014-03-11 17:20:48.289943030 -0500
@@ -899,6 +899,18 @@ struct ipr_hostrcb_type_01_error {
__be32 ioa_data[236];
 }__attribute__((packed, aligned (4)));
 
+struct ipr_hostrcb_type_21_error {
+   __be32 wwn[4];
+   u8 res_path[8];
+   u8 primary_problem_desc[32];
+   u8 second_problem_desc[32];
+   __be32 sense_data[8];
+   __be32 cdb[4];
+   __be32 residual_trans_length;
+   __be32 length_of_error;
+   __be32 ioa_data[236];
+}__attribute__((packed, aligned (4)));
+
 struct ipr_hostrcb_type_02_error {
struct ipr_vpd ioa_vpd;
struct ipr_vpd cfc_vpd;
@@ -1128,6 +1140,7 @@ struct ipr_hostrcb64_error {
struct ipr_hostrcb_type_ff_error type_ff_error;
struct ipr_hostrcb_type_12_error type_12_error;
struct ipr_hostrcb_type_17_error type_17_error;
+   struct ipr_hostrcb_type_21_error type_21_error;
struct ipr_hostrcb_type_23_error type_23_error;
struct ipr_hostrcb_type_24_error type_24_error;
struct ipr_hostrcb_type_30_error type_30_error;
@@ -1171,6 +1184,7 @@ struct ipr_hcam {
 #define IPR_HOST_RCB_OVERLAY_ID_16 0x16
 #define IPR_HOST_RCB_OVERLAY_ID_17 0x17
 #define IPR_HOST_RCB_OVERLAY_ID_20 0x20
+#define IPR_HOST_RCB_OVERLAY_ID_21 0x21
 #define IPR_HOST_RCB_OVERLAY_ID_23 0x23
 #define IPR_HOST_RCB_OVERLAY_ID_24 0x24
 #define IPR_HOST_RCB_OVERLAY_ID_26 0x26

-- 
--
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/5] scsi: Return VPD page length in scsi_vpd_inquiry()

2014-03-12 Thread Muthukumar R
On Mon, Mar 10, 2014 at 7:28 AM, Hannes Reinecke h...@suse.de wrote:
 We should be returning the number of bytes of the
 requested VPD page in scsi_vpd_inquiry.
 This makes it easier for the caller to verify the
 required space.

 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
  drivers/scsi/scsi.c | 17 ++---
  1 file changed, 10 insertions(+), 7 deletions(-)

 diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
 index d8afec8..ecaeff1 100644
 --- a/drivers/scsi/scsi.c
 +++ b/drivers/scsi/scsi.c
 @@ -954,7 +954,7 @@ EXPORT_SYMBOL(scsi_track_queue_full);
   * This is an internal helper function.  You probably want to use
   * scsi_get_vpd_page instead.
   *
 - * Returns 0 on success or a negative error number.
 + * Returns size of the vpg page on success or a negative error number.
   */
Typo:  ^^^

 Should be: vpd page


  static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
 u8 page, unsigned len)
 @@ -962,6 +962,9 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, 
 unsigned char *buffer,
 int result;
 unsigned char cmd[16];

 +   if (len  4)
 +   return -EINVAL;
 +
 cmd[0] = INQUIRY;
 cmd[1] = 1; /* EVPD */
 cmd[2] = page;
 @@ -982,7 +985,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, 
 unsigned char *buffer,
 if (buffer[1] != page)
 return -EIO;

 -   return 0;
 +   return get_unaligned_be16(buffer[2]) + 4;
  }

  /**
 @@ -1009,18 +1012,18 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 
 page, unsigned char *buf,

 /* Ask for all the pages supported by this device */
 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
 -   if (result)
 +   if (result  4)
 goto fail;


You mean:

if (result  0)
   goto fail;



 /* If the user actually wanted this page, we can skip the rest */
 if (page == 0)
 return 0;

 -   for (i = 0; i  min((int)buf[3], buf_len - 4); i++)
 -   if (buf[i + 4] == page)
 +   for (i = 4; i  min(result, buf_len); i++)
 +   if (buf[i] == page)
 goto found;

 -   if (i  buf[3]  i = buf_len - 4)
 +   if (i  result  i = buf_len)
 /* ran off the end of the buffer, give us benefit of doubt */
 goto found;
 /* The device claims it doesn't support the requested page */
 @@ -1028,7 +1031,7 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 
 page, unsigned char *buf,

   found:
 result = scsi_vpd_inquiry(sdev, buf, page, buf_len);
 -   if (result)
 +   if (result  0)
 goto fail;

 return 0;
 --
 1.7.12.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
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Scsi: lpfc: lpfc_init: Remove useless casting value

2014-03-12 Thread Matei Oprea
Remove useless casting value returned by k[cmz]alloc
to (struct lpfc_sli_ring *).

Found using coccinelle

Signed-off-by: Matei Oprea e...@opreamatei.ro
Cc: ROSEdu Kernel Community fire...@lists.rosedu.org
---
 drivers/scsi/lpfc/lpfc_init.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 68c94cc..47d2c20 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -4731,8 +4731,7 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
}
 
if (!phba-sli.ring)
-   phba-sli.ring = (struct lpfc_sli_ring *)
-   kzalloc(LPFC_SLI3_MAX_RING *
+   phba-sli.ring = kzalloc(LPFC_SLI3_MAX_RING *
sizeof(struct lpfc_sli_ring), GFP_KERNEL);
if (!phba-sli.ring)
return -ENOMEM;
-- 
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: [PATCH 2/5] scsi: Return VPD page length in scsi_vpd_inquiry()

2014-03-12 Thread Douglas Gilbert

On 14-03-12 10:14 PM, Muthukumar R wrote:

On Mon, Mar 10, 2014 at 7:28 AM, Hannes Reinecke h...@suse.de wrote:

We should be returning the number of bytes of the
requested VPD page in scsi_vpd_inquiry.
This makes it easier for the caller to verify the
required space.

Signed-off-by: Hannes Reinecke h...@suse.de
---
  drivers/scsi/scsi.c | 17 ++---
  1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index d8afec8..ecaeff1 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -954,7 +954,7 @@ EXPORT_SYMBOL(scsi_track_queue_full);
   * This is an internal helper function.  You probably want to use
   * scsi_get_vpd_page instead.
   *
- * Returns 0 on success or a negative error number.
+ * Returns size of the vpg page on success or a negative error number.
   */

Typo:  ^^^

  Should be: vpd page



  static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
 u8 page, unsigned len)
@@ -962,6 +962,9 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, 
unsigned char *buffer,
 int result;
 unsigned char cmd[16];

+   if (len  4)
+   return -EINVAL;
+
 cmd[0] = INQUIRY;
 cmd[1] = 1; /* EVPD */
 cmd[2] = page;
@@ -982,7 +985,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, 
unsigned char *buffer,
 if (buffer[1] != page)
 return -EIO;

-   return 0;
+   return get_unaligned_be16(buffer[2]) + 4;
  }

  /**
@@ -1009,18 +1012,18 @@ int scsi_get_vpd_page(struct scsi_device *sdev, u8 
page, unsigned char *buf,

 /* Ask for all the pages supported by this device */
 result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
-   if (result)
+   if (result  4)
 goto fail;



You mean:

 if (result  0)
goto fail;


I think that he means:
 if (result  4)
  goto fail;

The first 4 bytes of a VPD page are a header with buf[2] and
buf[3] being the length of the following payload. Without
both of them fail is a quite accurate description.

That said, it is hard to get a number between 0 and 3 with:
   return get_unaligned_be16(buffer[2]) + 4;
but if you wanted to take resid into account it is possible.

IMO this snippet is fine.


Doug Gilbert




--
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] Scsi: lpfc: lpfc_init: Remove useless casting value

2014-03-12 Thread Joe Perches
On Wed, 2014-03-12 at 23:20 +0200, Matei Oprea wrote:
 Remove useless casting value returned by k[cmz]alloc
 to (struct lpfc_sli_ring *).
 
 Found using coccinelle

trivial note:

 diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
[]
 @@ -4731,8 +4731,7 @@ lpfc_sli_driver_resource_setup(struct lpfc_hba *phba)
[]
 - phba-sli.ring = (struct lpfc_sli_ring *)
 - kzalloc(LPFC_SLI3_MAX_RING *
 + phba-sli.ring = kzalloc(LPFC_SLI3_MAX_RING *
   sizeof(struct lpfc_sli_ring), GFP_KERNEL);

Using kcalloc would have been even nicer too

phba-sli.ring = kcalloc(LPFC_SLI3_MAX_RING,
 sizeof(struct lpfc_sli_ring),
 GFP_KERNEL);


--
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/5] scsi: Return VPD page length in scsi_vpd_inquiry()

2014-03-12 Thread Muthukumar R
On Wed, Mar 12, 2014 at 2:43 PM, Douglas Gilbert dgilb...@interlog.com wrote:
 On 14-03-12 10:14 PM, Muthukumar R wrote:

 On Mon, Mar 10, 2014 at 7:28 AM, Hannes Reinecke h...@suse.de wrote:

 We should be returning the number of bytes of the
 requested VPD page in scsi_vpd_inquiry.
 This makes it easier for the caller to verify the
 required space.

 Signed-off-by: Hannes Reinecke h...@suse.de
 ---
   drivers/scsi/scsi.c | 17 ++---
   1 file changed, 10 insertions(+), 7 deletions(-)

 diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
 index d8afec8..ecaeff1 100644
 --- a/drivers/scsi/scsi.c
 +++ b/drivers/scsi/scsi.c
 @@ -954,7 +954,7 @@ EXPORT_SYMBOL(scsi_track_queue_full);
* This is an internal helper function.  You probably want to use
* scsi_get_vpd_page instead.
*
 - * Returns 0 on success or a negative error number.
 + * Returns size of the vpg page on success or a negative error number.
*/

 Typo:  ^^^

   Should be: vpd page


   static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char
 *buffer,
  u8 page,
 unsigned len)
 @@ -962,6 +962,9 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev,
 unsigned char *buffer,
  int result;
  unsigned char cmd[16];

 +   if (len  4)
 +   return -EINVAL;
 +
  cmd[0] = INQUIRY;
  cmd[1] = 1; /* EVPD */
  cmd[2] = page;
 @@ -982,7 +985,7 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev,
 unsigned char *buffer,
  if (buffer[1] != page)
  return -EIO;

 -   return 0;
 +   return get_unaligned_be16(buffer[2]) + 4;
   }

   /**
 @@ -1009,18 +1012,18 @@ int scsi_get_vpd_page(struct scsi_device *sdev,
 u8 page, unsigned char *buf,

  /* Ask for all the pages supported by this device */
  result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
 -   if (result)
 +   if (result  4)
  goto fail;



 You mean:

  if (result  0)
 goto fail;


 I think that he means:

  if (result  4)
   goto fail;

 The first 4 bytes of a VPD page are a header with buf[2] and
 buf[3] being the length of the following payload. Without
 both of them fail is a quite accurate description.

 That said, it is hard to get a number between 0 and 3 with:

return get_unaligned_be16(buffer[2]) + 4;
 but if you wanted to take resid into account it is possible.

 IMO this snippet is fine.


I see.. thanks. Comment is slightly misleading but I guess its OK in this case.



 Doug Gilbert




--
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/5] Add EVPD page 0x83 to sysfs

2014-03-12 Thread Martin K. Petersen
 James == James Bottomley jbottom...@parallels.com writes:

James What we do under the covers is up to us.  What's the reason for
James not wanting to do I/O every time?  Getting VPD data isn't a time
James critical operation is it?  so what's the benefit of caching it?

XCopy. Want us to do a VPD page query for every command (~32 megs of
data)?

-- 
Martin K. Petersen  Oracle Linux Engineering
--
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/5] Add EVPD page 0x83 to sysfs

2014-03-12 Thread James Bottomley
On Wed, 2014-03-12 at 21:53 -0400, Martin K. Petersen wrote:
  James == James Bottomley jbottom...@parallels.com writes:
 
 James What we do under the covers is up to us.  What's the reason for
 James not wanting to do I/O every time?  Getting VPD data isn't a time
 James critical operation is it?  so what's the benefit of caching it?
 
 XCopy. Want us to do a VPD page query for every command (~32 megs of
 data)?

Really?  OK, caching it is.

James

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


Re: blk_iopoll_enabled

2014-03-12 Thread Jens Axboe

On 2014-03-12 11:35, Sagi Grimberg wrote:

Hey Jens,

So I'm looking at blk_iopoll for iSER  SRP and I have one gap I would
like to get your input on.

In blk-iopoll.c I see:
int blk_iopoll_enabled = 1;
EXPORT_SYMBOL(blk_iopoll_enabled);

This is set to 1 and exported for everyone to condition and *modify* it.
The documentation says the user must check this when using blk_iopoll.

My question is why? it should always be true shouldn't it?
Moreover, isn't it better to protect it using a get() function of it?
can't someone set it to 0 and shutdown the lights on everyone else?


We can kill it. IIRC, it was mostly used during development to test 
functionality and performance (and wired to a sysfs toggle file).


But... Just because it's exported doesn't mean that random users are 
allowed to just disable it. What's left now is an always-on, so we can 
remove it.


--
Jens Axboe

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


Re: [PATCH v2 00/23] scsi: Use pci_enable_msix_range() instead of pci_enable_msix()

2014-03-12 Thread Bjorn Helgaas
On Mon, Feb 24, 2014 at 09:02:00AM +0100, Alexander Gordeev wrote:
 Hello!
 
 This series is against James Bottomley's SCSI tree [1], but it needs
 commit f7fc32c (PCI/MSI: Add pci_enable_msi_exact() and
 pci_enable_msix_exact()) from from Bjorn Helgaas's PCI tree [2]:
 
 1. git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
 2. git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git pci/msi
 
 Recently pci_enable_msix_exact() function has been accepted to
 the mainline. That is a variation of pci_enable_msix_range() which
 allows a device driver to request a particular number of MSI-Xs.
 
 As result, most of the changes posted in version 1 of this series
 are invalidated and need to use pci_enable_msix_exact() instead of
 originally posted pci_enable_msix_range() usages.
 
 I removed almost all ACKs, since unlike pci_enable_msix_range()
 function which returns the number of MSI-Xs allocated or negative
 errno, pci_enable_msix_exact() returns either zero success code or
 a negative errno. Although this change is simple, it still entails
 an updated error code analysis and would be better reviewed by
 driver maintainers.

Hi James,

I think Alexander sent these to linux-scsi hoping that you would handle
them, but I know it's a hassle because they depend on f7fc32c, which went
in after the merge window.

I'd be glad to review these and apply them through my tree, unless you want
to do it.  I'd like to get these merged in the v3.15 merge window so
Alexander can move on to something else.  I haven't checked for merge
conflicts with scsi.git yet, but I assume they'd be pretty trivial if there
are any.

Bjorn

 Cc: iss_storage...@hp.com
 Cc: intel-linux-...@intel.com
 Cc: supp...@lsi.com
 Cc: dl-mptfusionli...@lsi.com
 Cc: qla2xxx-upstr...@qlogic.com
 Cc: iscsi-dri...@qlogic.com
 Cc: pv-driv...@vmware.com
 Cc: linux-scsi@vger.kernel.org
 Cc: linux-...@vger.kernel.org
 
 Alexander Gordeev (23):
   be2iscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()
   bfa: Do not call pci_enable_msix() after it failed once
   bfa: Cleanup bfad_setup_intr() function
   bfa: Use pci_enable_msix_exact() instead of pci_enable_msix()
   csiostor: Remove superfluous call to pci_disable_msix()
   csiostor: Use pci_enable_msix_range() instead of pci_enable_msix()
   fnic: Use pci_enable_msix_exact() instead of pci_enable_msix()
   hpsa: Fallback to MSI rather than to INTx if MSI-X failed
   hpsa: Use pci_enable_msix_exact() instead of pci_enable_msix()
   isci: Use pci_enable_msix_exact() instead of pci_enable_msix()
   lpfc: Remove superfluous call to pci_disable_msix()
   lpfc: Use pci_enable_msix_range() instead of pci_enable_msix()
   megaraid: Fail resume if MSI-X re-initialization failed
   megaraid: Use pci_enable_msix_range() instead of pci_enable_msix()
   mpt2sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
   mpt3sas: Use pci_enable_msix_exact() instead of pci_enable_msix()
   pm8001: Fix invalid return when request_irq() failed
   pm8001: Use pci_enable_msix_exact() instead of pci_enable_msix()
   pmcraid: Get rid of a redundant assignment
   pmcraid: Use pci_enable_msix_range() instead of pci_enable_msix()
   qla2xxx: Use pci_enable_msix_range() instead of pci_enable_msix()
   qla4xxx: Use pci_enable_msix_exact() instead of pci_enable_msix()
   vmw_pvscsi: Use pci_enable_msix_exact() instead of pci_enable_msix()
 
  drivers/scsi/be2iscsi/be_main.c   |6 +--
  drivers/scsi/bfa/bfad.c   |   62 
 -
  drivers/scsi/csiostor/csio_hw.h   |2 +-
  drivers/scsi/csiostor/csio_isr.c  |   24 ---
  drivers/scsi/fnic/fnic_isr.c  |4 +-
  drivers/scsi/hpsa.c   |   12 +-
  drivers/scsi/isci/init.c  |2 +-
  drivers/scsi/lpfc/lpfc_init.c |   54 -
  drivers/scsi/megaraid/megaraid_sas_base.c |   24 +--
  drivers/scsi/mpt2sas/mpt2sas_base.c   |6 +-
  drivers/scsi/mpt3sas/mpt3sas_base.c   |4 +-
  drivers/scsi/pm8001/pm8001_init.c |   44 +++--
  drivers/scsi/pmcraid.c|   14 +--
  drivers/scsi/qla2xxx/qla_isr.c|   27 +---
  drivers/scsi/qla4xxx/ql4_nx.c |2 +-
  drivers/scsi/vmw_pvscsi.c |2 +-
  16 files changed, 121 insertions(+), 168 deletions(-)
 
 -- 
 1.7.7.6
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
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