History log of /drivers/scsi/ibmvscsi/ibmvfc.c
Revision Date Author Comments
cb52d8970eee65bf2c47d9a91bd4f58b17f595f4 26-Mar-2012 Benjamin Herrenschmidt <benh@kernel.crashing.org> powerpc+sparc/vio: Modernize driver registration

This makes vio_register_driver() get the module owner & name at compile
time like PCI drivers do, and adds a name pointer directly in struct
vio_driver to avoid having to explicitly initialize the embedded
struct device.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: David S. Miller <davem@davemloft.net>
38553564dc1052640515ed86be3ccb76cda6eee7 03-Jun-2011 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix Virtual I/O failover hang

If a Virtual I/O server fails in a dual virtual I/O server multipath
configuration, ensure we delete all remote ports so that path failover
can occur. For a single path configuration, the remote ports will
go into devloss state.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
402c6eec1bd04581c04de758e4efddc020b78f91 09-Dec-2010 Robert Jennings <rcj@linux.vnet.ibm.com> [SCSI] ibmvfc: Improve ibmvfc_async_desc memory layout

By changing field ordering we can avoid a couple of memory holes in
the tables that use the ibmvfc_async_desc structure.

Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
f281233d3eba15fb225d21ae2e228fd4553d824a 16-Nov-2010 Jeff Garzik <jeff@garzik.org> SCSI host lock push-down

Move the mid-layer's ->queuecommand() invocation from being locked
with the host lock to being unlocked to facilitate speeding up the
critical path for drivers who don't need this lock taken anyway.

The patch below presents a simple SCSI host lock push-down as an
equivalent transformation. No locking or other behavior should change
with this patch. All existing bugs and locking orders are preserved.

Additionally, add one parameter to queuecommand,
struct Scsi_Host *
and remove one parameter from queuecommand,
void (*done)(struct scsi_cmnd *)

Scsi_Host* is a convenient pointer that most host drivers need anyway,
and 'done' is redundant to struct scsi_cmnd->scsi_done.

Minimal code disturbance was attempted with this change. Most drivers
needed only two one-line modifications for their host lock push-down.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d24099df9e379b150c164da354b8c6fdafc73257 21-Sep-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Handle Virtual I/O Server reboot

If a Virtual I/O server is rebooted, the client fibre channel sees a
transport event on its CRQ, which causes it to attempt to reconnect
to the CRQ. For a period of time during the VIOS reboot, the client's
attempts to register the CRQ will return H_CLOSED, indicating the server
side is not currently registered. The ibmvfc driver was not handling
this well and was taking the virtual adapter offline. Fix this by
re-enabling our interrupt and waiting for the event on our CRQ
indicating the server is back, at which point we can reconnect.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
a5110f2983bdf931d9819f88505775b16de8b99e 15-Sep-2010 Mike Christie <michaelc@cs.wisc.edu> [SCSI] ibmvfc: prep for fc host dev loss tmo support

This removes the driver's get_host_def_dev_loss_tmo
callback and just has the driver set the dev loss
using the fc class fc_host_dev_loss_tmo macro like is
done for other fc params.

This patch also removes the module dev loss param.
To override the value the fc host sysfs value being
added in the fc class patch can be used instead of the driver
module param.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d99e5f488ae28d9dfccc84435f4fd29bd1fe1b9b 09-Sep-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Log link up/down events

By default, ibmvfc does not log any async events in order
to avoid flooding the log with them. Improve on this by
logging by default events that are not likely to flood the
log, such as link up/down. Having these events in the log
will improve the ability to debug issues with ibmvfc.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
da99e307aa508fba6fbedc3699e7df64e284d2c5 06-Aug-2010 Mike Christie <michaelc@cs.wisc.edu> [SCSI] ibmvfc: do not reset dev_loss_tmo in slave callout

This fixes a bug where the driver was resetting the
rport dev_loss_tmo when devices were added by adding
support for the get_host_def_dev_loss_tmo callout.

Patch has only been compile tested.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d2fab5cf3979c55f802c96616daf96e9e8de1c80 05-Aug-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix terminate_rport_io

The ibmvfc driver was incorrectly obtaining a scsi_target pointer
from an fc_rport. The way it is coded ensures that ibmvfc's
terminate_rport_io handler does absolutely nothing. Fix this up
to iterate through affected devices differently, sending cancel
and abort task set as appropriate. Without this patch,
fast_io_fail_tmo is broken for ibmvfc.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d5da3040d798df4bbb62579b97f8b6b83749da22 05-Aug-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix rport add/delete race resulting in oops

Commit 43c8da907ccc656935d1085701f4db83385d8a59 introduced a race
condition which can occur when adding/deleting rports. There are
two possible threads now that can be deleting rports in the ibmvfc
driver, which can result in list_del being called twice, resulting
in an oops. This patch adds a new state to the ibmvfc_target struct
to indicate the target has been removed from the list and is in
the process of being deleted.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
3f01424c8128af7a69c824176bff195be457d6ac 17-Jun-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add support for fc_block_scsi_eh

Adds support for fc_block_scsi_eh to block the EH handlers if
the target device is in the blocked state to ensure we don't
take devices offline.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
73ee5d8672871bd69077ca71e7208a36bfa6343c 17-Jun-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix soft lockup on resume

This fixes a softlockup seen on resume. During resume, the CRQ
must be reenabled. However, the H_ENABLE_CRQ hcall used to do
this may return H_BUSY or H_LONG_BUSY. When this happens, the
caller is expected to retry later. Normally the H_ENABLE_CRQ
succeeds relatively soon. However, we have seen cases where
this can take long enough to see softlockup warnings.
This patch changes a simple loop, which was causing the
softlockup, to a loop at task level which sleeps between
retries rather than simply spinning.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
2c3c8bea608866d8bd9dcf92657d57fdcac011c5 13-May-2010 Chris Wright <chrisw@sous-sol.org> sysfs: add struct file* to bin_attr callbacks

This allows bin_attr->read,write,mmap callbacks to check file specific data
(such as inode owner) as part of any privilege validation.

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
61c7a080a5a061c976988fd4b844dfb468dda255 14-Apr-2010 Grant Likely <grant.likely@secretlab.ca> of: Always use 'struct device.of_node' to get device node pointer.

The following structure elements duplicate the information in
'struct device.of_node' and so are being eliminated. This patch
makes all readers of these elements use device.of_node instead.

(struct of_device *)->node
(struct dev_archdata *)->prom_node (sparc)
(struct dev_archdata *)->of_node (powerpc & microblaze)

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
daa142d1773dd3a986f02a8a4da929608d24daaa 20-Apr-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Reduce error recovery timeout

If a command times out resulting in EH getting invoked, we wait for the
aborted commands to come back after sending the abort. Shorten
the amount of time we wait for these responses, to ensure we don't
get stuck in EH for several minutes.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
f5832fa2f8dc39adcf3ae348d2d6383163235e79 20-Apr-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix command completion handling

Commands which are completed by the VIOS are placed on a CRQ
in kernel memory for the ibmvfc driver to process. Each CRQ
entry is 16 bytes. The ibmvfc driver reads the first 8 bytes
to check if the entry is valid, then reads the next 8 bytes to get
the handle, which is a pointer the completed command. This fixes
an issue seen on Power 7 where the processor reordered the
loads from memory, resulting in processing command completion
with a stale handle. This could result in command timeouts,
and also early completion of commands.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
5a0e3ad6af8660be21ca98a971cd00f331318c05 24-Mar-2010 Tejun Heo <tj@kernel.org> include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h

percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.

percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.

http://userweb.kernel.org/~tj/misc/slabh-sweep.py

The script does the followings.

* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.

* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.

* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.

The conversion was done in the following steps.

1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.

2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.

3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.

4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.

5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.

6. percpu.h was updated not to include slab.h.

7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).

* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig

8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.

Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.

Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
b0f4d4cf12d0eaa0bd766686bba843fc105b6a60 21-Feb-2010 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add suspend/resume support

Adds support for resuming from suspend for IBM VFC devices. We may have
lost an interrupt over the suspend, so we just kick the interrupt handler
to process anything that is outstanding. We expect to find a transport event
indicating we need to reestablish our CRQ.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
8a78362c4eefc1deddbefe2c7f38aabbc2429d6b 26-Feb-2010 Martin K. Petersen <martin.petersen@oracle.com> block: Consolidate phys_segment and hw_segment limits

Except for SCSI no device drivers distinguish between physical and
hardware segment limits. Consolidate the two into a single segment
limit.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e881a172dac4d9ea3b2a1540041d872963c269bd 16-Oct-2009 Mike Christie <michaelc@cs.wisc.edu> [SCSI] modify change_queue_depth to take in reason why it is being called

This patch modifies scsi_host_template->change_queue_depth so that
it takes an argument indicating why it is being called. This will be
used so that if a LLD needs to do some extra processing when
handling queue fulls or later ramp ups, it can do so.

This is a simple port of the drivers setting a change_queue_depth
callback. In the patch I just have these LLDs adjust the queue depth
if the user was requesting it.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>

[Vasu.Dev: v2
Also converted pmcraid_change_queue_depth and then verified
all modules compile using "make allmodconfig" for any new build
warnings on X86_64.

Updated original description after combing two original
patches from Mike to make this patch git bisectable.]
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
[jejb: fixed up 53c700]
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d31429e1517c007781dfc68aed9b39cb5d3350a1 19-Oct-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add FC Passthru support

Adds support for FC passthru via BSG.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
4a5c4a5ed2b8b7fac68368e7ab8cb415dd006418 19-Oct-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix adapter cancel flags for terminate_rport_io

When issuing a Cancel to the virtual fibre channel adapter,
the interface specifies a flags field for the client to indicate
what kind of error recovery is being performed. Fix up these
flags for terminate_rport_io to indicate an abort task set
rather than a target reset.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
861890c62d46bd29c73d75fc907aeffd1c4eee06 19-Oct-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Remove unnecessary parameter to ibmvfc_init_host

Remove a parameter to ibmvfc_init_host which is always set to
zero by all callers.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
7043110550f19c1556ad18dc4d63b1c9eaf9e4fd 19-Oct-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix locking in ibmvfc_remove

Need to grab the host lock around the call to ibmvfc_link_down.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
230934a6fe2f44d14ef840639f010c9cf4da098f 19-Oct-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fixup TMF response handling

When processing the response to either a LUN reset,
target reset, or an abort task set, the ibmvfc driver needs to
treat as success receiving a response with a non-zero
status in the response IU along with a general transport
error with the FCP response code being zero. The VIOS
currently guarantees this cannot happen, but a future version
of VIOS may allow this to be returned, so ensure we handle
this response combination correctly for TMFs, as we already
do for SCSI commands.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
d68866927ddd0ed3145cb3fba4a1c07ca5e4709d 03-Aug-2009 Sage Weil <sage@newdream.net> [SCSI] ibmvscsi: avoid unnecessary use of kzalloc_pool

The allocated struct is manually zeroed after allocation, so avoid using
the (broken) kzalloc mempool (which does not re-zero previously used items
when they are returned to the pool).

Acked-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
017b2ae33c0fc7d70320cc7f1cce0efb6ce8d929 18-Jun-2009 Brian King <brking@linux.vnet.ibm.com> ibmvfc: Fix endless PRLI loop in discovery

Fixes a problem seen where sending a PRLI to a target
resulted in it sending a LOGO. This caused the ibmvfc
driver to go back through discovery again, which caused
another PRLI attempt, which caused another LOGO. Fix this
behavior by ignoring LOGO if we haven't even logged into
the target yet.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
f1d7fb7a8ab55357b6c7d44a53f644a043680ed1 18-Jun-2009 Brian King <brking@linux.vnet.ibm.com> ibmvfc: Process async events before command responses

Since async events could indicate changes to link status, or
events which could affect decisions made during discovery, we should
process async events prior to command completion responses.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
6d29cc56bead73b6f386cf43333708579deb5eed 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Improve LOGO/PRLO ELS handling

There are several scenarios where the ibmvfc driver needs to
try to log back into a target on the fabric. Today when these events
occur, we simply go through re-discovery for all attached targets,
assuming that either the query of the name server or an ADISC will
indicate we might need to log back into the target, which doesn't
work for all scenarios. Fix this by taking note of the affected target(s)
in these conditions and ensuring we try to PLOGI back into the target.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
5e47167b6be0ca24cbb04fb71ea611ab7c089aff 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Improve device rediscovery

For certain scenarios during device rediscovery, we detect we need
to log back into a target. Currently we do just that - PLOGI/PRLI
back into the target. Change the code to delete and add the target
from the FC transport layer as well, to ensure we handle any cases
where the target may have changed.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
497f9c504f76e7a751cd370604e1c8521743746d 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add flush on halt support

The virtual I/O server controlling the NPIV adapter associated with
a virtual fibre channel adapter can send a HALT event to the client.
When this occurs, the client can no longer send commands until a RESUME
is received. By adding support for flush on halt, we will get all of
our outstanding commands flushed back before the Virtual I/O server
enters the halt state, eliminating potential command timeouts for
outstanding commands which might occur if we did not support this feature.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
79111d0899a122fa3cf0a2921292c3e6a25452d0 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add support for NPIV Logout

This patch adds support for a new command supported by the Virtual I/O
Server, NPIV Logout. The command will abort all outstanding commands
and log out of the fabric. Currently, the only way to do this is
by breaking the CRQ, which can take a fairly long time when lots of
commands are outstanding. The NPIV Logout commands provides a mechanism
to accomplish virtually the same function, but is much faster.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
43c8da907ccc656935d1085701f4db83385d8a59 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix deadlock in EH

Fixes the following deadlock scenario shown below. We currently allow
queuecommand to send commands when the ibmvfc workqueue is scanning for
new rports, so we should also allow EH to function at this time as well.

scsi_eh_3 D 0000000000000000 12304 1279 2
Call Trace:
[c0000002f7257730] [c0000002f72577e0] 0xc0000002f72577e0 (unreliable)
[c0000002f7257900] [c0000000000118f4] .__switch_to+0x158/0x1a0
[c0000002f72579a0] [c0000000004f8b40] .schedule+0x8d4/0x9dc
[c0000002f7257b60] [c0000000004f8f08] .schedule_timeout+0xa8/0xe8
[c0000002f7257c50] [d0000000001d23e0] .ibmvfc_wait_while_resetting+0xe4/0x140 [ibmvfc]
[c0000002f7257d20] [d0000000001d3984] .ibmvfc_eh_abort_handler+0x60/0xe4 [ibmvfc]
[c0000002f7257dc0] [d000000000366714] .scsi_error_handler+0x38c/0x674 [scsi_mod]
[c0000002f7257f00] [c0000000000a7470] .kthread+0x78/0xc4
[c0000002f7257f90] [c000000000029b8c] .kernel_thread+0x4c/0x68
ibmvfc_3 D 0000000000000000 12432 1280 2
Call Trace:
[c0000002f7253540] [c0000002f72535f0] 0xc0000002f72535f0 (unreliable)
[c0000002f7253710] [c0000000000118f4] .__switch_to+0x158/0x1a0
[c0000002f72537b0] [c0000000004f8b40] .schedule+0x8d4/0x9dc
[c0000002f7253970] [c0000000004f8e98] .schedule_timeout+0x38/0xe8
[c0000002f7253a60] [c0000000004f80cc] .wait_for_common+0x138/0x220
[c0000002f7253b40] [c0000000000a2784] .flush_cpu_workqueue+0xac/0xcc
[c0000002f7253c10] [c0000000000a2960] .flush_workqueue+0x58/0xa0
[c0000002f7253ca0] [d0000000000827fc] .fc_flush_work+0x4c/0x64 [scsi_transport_fc]
[c0000002f7253d20] [d000000000082db4] .fc_remote_port_add+0x48/0x6c4 [scsi_transport_fc]
[c0000002f7253dd0] [d0000000001d7d04] .ibmvfc_work+0x820/0xa7c [ibmvfc]
[c0000002f7253f00] [c0000000000a7470] .kthread+0x78/0xc4
[c0000002f7253f90] [c000000000029b8c] .kernel_thread+0x4c/0x68
fc_wq_3 D 0000000000000000 10720 1283 2
Call Trace:
[c0000002f559ac30] [c0000002f559ace0] 0xc0000002f559ace0 (unreliable)
[c0000002f559ae00] [c0000000000118f4] .__switch_to+0x158/0x1a0
[c0000002f559aea0] [c0000000004f8b40] .schedule+0x8d4/0x9dc
[c0000002f559b060] [c0000000004f8e98] .schedule_timeout+0x38/0xe8
[c0000002f559b150] [c0000000004f80cc] .wait_for_common+0x138/0x220
[c0000002f559b230] [c0000000002721c4] .blk_execute_rq+0xb4/0x100
[c0000002f559b360] [d00000000036a1f8] .scsi_execute+0x118/0x194 [scsi_mod]
[c0000002f559b420] [d00000000036a32c] .scsi_execute_req+0xb8/0x124 [scsi_mod]
[c0000002f559b500] [d0000000000c1330] .sd_sync_cache+0x8c/0x108 [sd_mod]
[c0000002f559b5e0] [d0000000000c15b4] .sd_shutdown+0x9c/0x158 [sd_mod]
[c0000002f559b660] [d0000000000c16d0] .sd_remove+0x60/0xb4 [sd_mod]
[c0000002f559b700] [c000000000392ecc] .__device_release_driver+0xd0/0x118
[c0000002f559b7a0] [c000000000393080] .device_release_driver+0x30/0x54
[c0000002f559b830] [c000000000392108] .bus_remove_device+0x128/0x16c
[c0000002f559b8d0] [c00000000038f94c] .device_del+0x158/0x234
[c0000002f559b960] [d00000000036f078] .__scsi_remove_device+0x5c/0xd4 [scsi_mod]
[c0000002f559b9f0] [d00000000036f124] .scsi_remove_device+0x34/0x58 [scsi_mod]
[c0000002f559ba80] [d00000000036f204] .__scsi_remove_target+0xb4/0x120 [scsi_mod]
[c0000002f559bb10] [d00000000036f338] .__remove_child+0x2c/0x44 [scsi_mod]
[c0000002f559bb90] [c00000000038f11c] .device_for_each_child+0x54/0xb4
[c0000002f559bc50] [d00000000036f2e0] .scsi_remove_target+0x70/0x9c [scsi_mod]
[c0000002f559bce0] [d000000000083454] .fc_starget_delete+0x24/0x3c [scsi_transport_fc]
[c0000002f559bd70] [c0000000000a2368] .run_workqueue+0x118/0x208
[c0000002f559be30] [c0000000000a2580] .worker_thread+0x128/0x154
[c0000002f559bf00] [c0000000000a7470] .kthread+0x78/0xc4
[c0000002f559bf90] [c000000000029b8c] .kernel_thread+0x4c/0x68

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
7d0e462247241b8ec2d377306203b58c7f423553 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Reduce error logging noise

The ibmvfc driver currently logs errors during discovery for several
transient fabric errors, which generally get retried. If retries
do not work, we see multiple errors in the log. If retries do work,
we see errors in the log which may be confusing since the retry worked.
This patch enhances the discovery time error logging to only log errors
for command failures during discovery if all allowed retries have been
used up. The existing behavior of logging all failures can be restored
by setting the hosts log_level to a value of 3 or greater.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
85e2399e925e0afa04dd6e185a910bdd3dc4626b 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Use DEVICE_ATTR macro

Use DEVICE_ATTR macro for defining device sysfs attributes.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
7270b9bde5f382e730e1ef69d6c1b34d388df2b0 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fixup GFP flags for target allocations

Since target allocations can occur while resetting the virtual adapter,
we shouldn't be using GFP_KERNEL for them as it could hang. Switch to
use GFP_NOIO.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
4a2837d4fcaf8a2c2ad61523287073d0c14b9ed0 28-May-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix invalid error response handling

Fix an obvious bug in processing error responses for SCSI commands
which can result in successful responses being incorrectly returned
with DID_ERROR.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
10501e1ce3d97cc84a8e29a3a139f74601b59b0f 20-Mar-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Improve ADISC timeout handling

The ibmvfc driver currently breaks the CRQ and essentially
resets the entire virtual FC adapter, killing all outstanding
ops to all attached targets, if an ADISC times out during target
discover/rediscovery. This patch adds some code to cancel the
ADISC if it times out, which prevents a single ADISC timeout from
affecting the other devices attached to the fabric.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9ab3610f9c24e7f303f1b0e6bb88a5f804ab847e 20-Mar-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Show host maxframe_size

Set show_host_maxframe_size so that maxframe_size gets exported in
sysfs for the host.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
545ef9a2dc1e5ac0463f3754e239ffcc5aaa92e2 20-Mar-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fixup module parms attributes

The ibmvfc driver really does not handle dynamically changing disc_threads.
To change this dynamically would cause confusion in the driver regarding
the number of event structs allocated. Fix this by simply not allowing
disc_threads to be changed at runtime.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
039a08981a49e05f09db969cdd3f38f05a5df46f 20-Mar-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix dropped interrupts

This patch fixes a problem of possible dropped interrupts. Currently,
the ibmvfc driver has a race condition where after ibmvfc_interrupt
gets run, the platform code clears the interrupt. This can result in
lost interrupts and, in worst case scenarios, result in command
timeouts. Fix this by implementing a tasklet similar to what the
ibmvscsi driver does so that interrupt processing is no longer done in
the actual interrupt handler, which eliminates the race.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a3b7aeaba29e3dd995ece05ba50db9e0650c16b6 03-Feb-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Better handle other FC initiators

The ibmvfc driver currently always sets the role of all rports
to FC_PORT_ROLE_FCP_TARGET, which is not correct for other initiators.
This can cause problems if other initiators are on the fabric
when we then try to scan the rport for LUNs. Fix this by looking
at the service parameters returned in the PRLI to set the roles
appropriately. Also look at the returned service parameters to
decide whether or not we were actually able to successfully log into
the target.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
0883e3b3a85b5860b7729f1279a52e95b87dea97 04-Feb-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix rport relogin

The ibmvfc driver has a bug in its SCN handling. If it receives
an ELS event such asn an N-Port SCN event or an unsolicited PLOGI,
or any other SCN event which causes ibmvfc_reinit_host to be called,
it is possible that we will call fc_remote_port_add for a target
that already has an rport added, which can result in duplicate
rports getting created for the same targets. Fix this by calling
fc_remote_port_rolechg in this scenario instead to report any possible
role change that may have occurred.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
d4b17a20f30faf0debbc225bfbf98dba4e351c4d 04-Feb-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix command timeout errors

Currently the ibmvfc driver sets the IBMVFC_CLASS_3_ERR flag
in the VFC Frame if both the adapter and the device claim support
for Class 3. However, this bit actually refers to Class 3 Error
Recovery, which is currently not supported by the VIOS. Setting this
bit can cause lots of command timeout responses from the VIOS resulting
in general instability. Fix this by never setting this bit.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
64b840dd88eb2054f86c72ed6d989cb8681f0058 22-Jan-2009 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix DMA mapping leak on memory allocation failure

There is currently a DMA mapping leak that can occur in the ibmvfc
driver if we fail to allocate a scatterlist. Fix this by unmapping
the scatterlist in the failure path. Additionally, only log an error
for a scatterlist allocation failure if the log level is greater
than the default, since this can occur when running Active Memory
Sharing and this is not considered an error.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
775a42ecf8b8a86b55173da27e6cc874af5b944d 06-Jan-2009 Stephen Rothwell <sfr@canb.auug.org.au> powerpc: Cleanup from l64 to ll64 change drivers/scsi

This is a powerpc specific driver.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
752b32329b48e0b7481e82a5f891aa5bf01f3782 16-Dec-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fixup command response translation

If a link down event is received, outstanding commands may get
returned to the ibmvfc driver with a "transaction cancelled implicit"
response. This is currently translated to DID_ABORT, which does
not get retried by SCSI core, but rather passes the failure up
the stack. This can result in I/O errors at the filesystem level.
Fix up this response a well as a few other error responses.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
71610f55fa4db63dbf5385929a47c9fb2451f332 03-Dec-2008 Kay Sievers <kay.sievers@vrfy.org> [SCSI] struct device - replace bus_id with dev_name(), dev_set_name()

[jejb: limit ioctl to returning 20 characters to avoid overrun
on long device names and add a few more conversions]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
d2131b33c7e07c2905ee2f2321cc4dae1928c483 18-Dec-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Improve async event handling

While doing various error injection testing, such as cable
pulls and target moves, some issues were observed in handling
these events. This patch improves the way these events are handled
by increasing the delay waiting for the fabric to settle and also
changes the behavior of Link Up to break the CRQ to ensure everything
gets cleaned up properly on the VIOS.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
a528ab7a324f1dbb3598ae0ecd238ab7dd974294 03-Dec-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix errors due to inconsistent command data

In order to ensure the VIOS sees a consistent command buffer, we
need to add a memory barrier after building the command buffer
but before sending the command.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
1c41fa8288277e76785acb50f52bb2f39509f903 03-Dec-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Delay NPIV login retry and add retries

Adds a delay prior to retrying a failed NPIV login. This fixes
a scenario if the backing fibre channel adapter is getting reset
due to an EEH event, NPIV login will fail. Currently, ibmvfc
retries three times very quickly, resets the CRQ and tries one
more time. If the adapter is getting reset due to EEH, this isn't
enough time. This adds a delay prior to retrying a failed NPIV
login and also increments the number of retries.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
646d3857b95e8e310aae7a4594f43d7f3b100a1f 14-Nov-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Handle port login required response

The virtual fibre channel stack can return a failure response for a command
indicating the port login has been invalidated without sending the client
an async event. Add code to handle this response and initiate a PLOGI.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
4081b77c3a86151d2eaeed9d568a34dd0982ed52 14-Nov-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix oops in interrupt handler

Fixes an oops that can occur in the interrupt handler
if we get a lot of async events.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
50ed9a005dc0846685f57c637436ee28e404368d 29-Oct-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Quiet gcc warning in ibmvfc_reset_device

Stops gcc from complaining about a possible uninitialized
variable being used in ibmvfc_reset_device.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
10e794996ed00a0f09ff0745f87e3a3dd5de4606 29-Oct-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix target initialization failure retry handling

If the ibmvfc driver is in discovery attempting to log into a target
and it encounters an error, the command may get retried one or more
times, depending on the error received. If the retries are
unsuccessful such that the discovery thread gives up on discovery to
that target, the target ends up in a state where, if SCSI core had
previously known about the device, the host will get unblocked but the
host will not be logged into the target, causing any commands sent to
the target to fail. This patch fixes this so that if this occurs, the
target is deleted such that the normal dev_loss processing can occur
instead.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
ad8dcffaf9bc1d7eb86dabf591e95f4ffb86cf1b 29-Oct-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Error handling fixes

Due to an ambiguity in the VIOS VFC interface specification,
abort/cancel handling is not done correctly and can result in double
completion of commands. In order to cancel all outstanding commands to
a device, a cancel must be sent, followed by an abort task set. After
the responses are received for these commands, there may still be
commands outstanding, in the process of getting flushed back, in which
case, we need to wait for them. This patch removes the assumption that
if the abort and the cancel both complete successfully that the device
queue has been flushed and waits for all the responses to come back.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
50119dad2a6c2674f35d81e708822b40f65f40cb 29-Oct-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix error reporting for some FC errors

If either a "transport fault" or a "general transport" error is received
and no other error information is available, the command is improperly
returned as successful. Fix this to return DID_ERROR in this case.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
9cc328f502eacfcc52ab1c1bf9a7729cf12f14be 20-Aug-2008 Mike Christie <michaelc@cs.wisc.edu> [SCSI] ibmvfc, qla2xxx, lpfc: remove scsi_target_unblock calls in terminate callbacks

The fc class now calls scsi_target_unblock after calling the
terminate callback, so this patch removes the calls from the
drivers.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
3e3399467d4c4aefe6a24225b5b277cf7d6e58a7 15-Aug-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add details to async event log

When logging async events, also print the payload in addition to the
event received.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2bac406df52100aec42e230a2cc2986d34e86218 15-Aug-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Sanitize response lengths

Sanitize the response lengths in order to prevent possible oopses
in the command response path.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
cf6f10d794ab4a9bd84fce345c3947588670d5f5 15-Aug-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix for lost async events

If the client virtual fibre channel adapter is already logged into the
server and does an NPIV Login again, the async queue, which is used for
reporting Link Up/Link Down type of events, does not get reset on the
server side. Fix up the client driver so that we also do not reset it.
This fixes a problem of lost async events following relogins.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
915be024414c52e311f795566ac938223ba3c847 15-Aug-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fixup host state during reinit

If an ELS is received while the virtual fibre channel adapter is going
through its discovery, a flag is set which causes discovery to get
re-driven. However, the hosts's state does not get set back to
IBMVFC_INITIALIZING and scsi_block_requests does not get called again,
which can result in queuecommand ops getting sent during
discovery. This should not occur and may cause problems. One example
is that we may no longer be logged into the target we send the command
to, resulting in a failure which should not have occurred.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
3eddc569770a76f2ca65621cdde3c0a2552b5b0c 15-Aug-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix another hang on module removal

This fixes a hang on module removal. The module removal code was setting
the hosts's state to IBMVFC_HOST_OFFLINE before tearing down the kernel
thread, but, due to a bug in ibmvfc_wait_while_resetting, was not waiting
for the kernel thread's offlining work to be done prior to destroying
the kernel thread, which left the scsi host in a blocked state which we
never got out of.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
989b854579875b38d45fffa7f8c89177f7698cd3 22-Jul-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Add ADISC support

Add an ADISC to the target discovery job in order to sanity check whether or
not we need to re-login to the target.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
52d7e861cc071688f5fa3ee1b6e94785adeff8db 22-Jul-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Miscellaneous fixes

Properly setup the size of the async event queue. This fixes a bug where async events
were not getting processed by the driver.

Setup target_id field in the driver's target struct so that target sysfs attributes
work for multiple targets.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2d0da2a44e065a5bdd90bed2ebe0b9216c27f682 22-Jul-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Fix hang on module removal

If certain ELS events are received during module removal, after the kthread
is stopped, the rmmod can hang. This fixes the ibmvfc driver so that ELS
events during rmmod are ignored by stopping all device activity prior to
killing the kthread and also changes reinitialization to not attempt a reinit
if the adapter has been taken offline.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
b3c10489cb464b12a74dda65f826433f71f2c2e2 22-Jul-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Target refcounting fixes

Fix up some refcounting on the ibmvfc drivers internal target struct
when accessed through some sysfs attributes.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
0ae808e02e000058cf65a47662c187dc061bcfd3 22-Jul-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: Reduce unnecessary log noise

Reduces some unnecessary log noise by removing a printk during
host port state query and increasing the log level required to
log received async events.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
8d8bb39b9eba32dd70e87fd5ad5c5dd4ba118e06 26-Jul-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> dma-mapping: add the device argument to dma_mapping_error()

Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
architecture does:

This enables us to cleanly fix the Calgary IOMMU issue that some devices
are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423).

I think that per-device dma_mapping_ops support would be also helpful for
KVM people to support PCI passthrough but Andi thinks that this makes it
difficult to support the PCI passthrough (see the above thread). So I
CC'ed this to KVM camp. Comments are appreciated.

A pointer to dma_mapping_ops to struct dev_archdata is added. If the
pointer is non NULL, DMA operations in asm/dma-mapping.h use it. If it's
NULL, the system-wide dma_ops pointer is used as before.

If it's useful for KVM people, I plan to implement a mechanism to register
a hook called when a new pci (or dma capable) device is created (it works
with hot plugging). It enables IOMMUs to set up an appropriate
dma_mapping_ops per device.

The major obstacle is that dma_mapping_error doesn't take a pointer to the
device unlike other DMA operations. So x86 can't have dma_mapping_ops per
device. Note all the POWER IOMMUs use the same dma_mapping_error function
so this is not a problem for POWER but x86 IOMMUs use different
dma_mapping_error functions.

The first patch adds the device argument to dma_mapping_error. The patch
is trivial but large since it touches lots of drivers and dma-mapping.h in
all the architecture.

This patch:

dma_mapping_error() doesn't take a pointer to the device unlike other DMA
operations. So we can't have dma_mapping_ops per device.

Note that POWER already has dma_mapping_ops per device but all the POWER
IOMMUs use the same dma_mapping_error function. x86 IOMMUs use device
argument.

[akpm@linux-foundation.org: fix sge]
[akpm@linux-foundation.org: fix svc_rdma]
[akpm@linux-foundation.org: build fix]
[akpm@linux-foundation.org: fix bnx2x]
[akpm@linux-foundation.org: fix s2io]
[akpm@linux-foundation.org: fix pasemi_mac]
[akpm@linux-foundation.org: fix sdhci]
[akpm@linux-foundation.org: build fix]
[akpm@linux-foundation.org: fix sparc]
[akpm@linux-foundation.org: fix ibmvscsi]
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
39c1ffecc6aabcc8105602a95ce769f27bcf6048 23-Jul-2008 Brian King <brking@linux.vnet.ibm.com> ibmvfc: Add support for collaborative memory overcommit

Adds support to the ibmvfc driver for collaborative memory overcommit.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: Robert Jennings <rcj@linux.vnet.ibm.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
072b91f9c6510d0ec4a49d07dbc318760c7da7b3 01-Jul-2008 Brian King <brking@linux.vnet.ibm.com> [SCSI] ibmvfc: IBM Power Virtual Fibre Channel Adapter Client Driver

This patch adds a new device driver to support the Virtual Fibre Channel
interface on IBM Power based servers. The Virtual I/O Server on IBM Power
servers utilizes N-Port ID Virtualization to export a Virtual Fibre Channel
adapter to the client. This driver is the client device driver.

Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>