summaryrefslogtreecommitdiffstats
path: root/drivers/staging/unisys/visorhba
Commit message (Collapse)AuthorAgeFilesLines
* staging: unisys: visorbus: Convert visorchannel_signalinsert() return valDavid Binder2016-09-271-6/+6
| | | | | | | | | | | Per Documentation/CodingStyle, function names that convey an action or an imperative command should return an integer. This commit converts the visorbus API function, visorchannel_signalinsert(), to returning integer values. All uses of this function are updated accordingly. Signed-off-by: David Binder <david.binder@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorbus: Convert visorchannel_signalremove() return valDavid Binder2016-09-271-3/+3
| | | | | | | | | | | Per Documentation/CodingStyle, function names that convey an action or an imperative command should return an integer. This commit converts the visorbus API function, visorchannel_signalremove(), to returning integer values. All uses of this function are updated accordingly. Signed-off-by: David Binder <david.binder@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: make MODULE_DESCRIPTIONs consistentJon Frisch2016-09-271-1/+1
| | | | | | | | | | This patch ensures that consistent verbiage is used in the MODULE_DESCRIPTION text (reported by 'modinfo') for all of the Unisys s-Par drivers. Signed-off-by: Jon Frisch <jon.frisch@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: remove prototypes for visorhba_main.cDavid Kershner2016-09-211-29/+21
| | | | | | | | Remove not needed prototypes in visorhba. Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba change -1 return valueErik Arfvidson2016-06-071-2/+2
| | | | | | | | This patch changes the vague -1 return value to -EBUSY Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: "Prefer 'unsigned int'" checkpatch warningsTim Sell2016-06-071-3/+3
| | | | | | | | | | This patch fixes a few checkpatch warnings in visorhba: WARNING: Prefer 'unsigned int' to bare use of 'unsigned' Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: return 0 literalDavid Binder2016-06-071-1/+1
| | | | | | | | Returns 0 instead of variable rc in visorhba_init(). Signed-off-by: David Binder <david.binder@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: visorhbas_open[] no longer used, so deletedTim Sell2016-06-071-11/+1
| | | | | | | | | | The prior patch which simplified the visorhba debugfs interface made it so visorhbas_open[] and VISORHBA_OPEN_MAX were no longer needed, so they have now been deleted. Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: simplify and enhance debugfs interfaceTim Sell2016-06-071-71/+65
| | | | | | | | | | | | | | | | | debugfs info for each visorhba device is now presented by a file named of the following form within the debugfs tree: visorhba/vbus<x>:dev<y>/info where <x> is the vbus number, and <y> is the relative device number. Also, the debugfs presentation function was converted to use the seq_file interface, so that it could access the device context without resorting to a global array. This also simplified the function. Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: remove unused (and broken) logicTim Sell2016-06-071-74/+4
| | | | | | | | | | The handling of CMD_NOTIFYGUEST_TYPE messages from the IO partition appears to be only partially implemented, but fortunately it is never used in our current environment. This patch deletes the unused code. Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: correct scsi task mgmt completion handlingTim Sell2016-06-071-27/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is necessary to enable ANY task mgmt command to complete successfully via visorhba. When issuing a task mgmt command (CMD_SCSITASKMGMT_TYPE) to the IO partition (back-end), forward_taskmgmt_command() includes pointers within the command area that will be used to wake up the issuing process and provide the result when the command completes: cmdrsp->scsitaskmgmt.notify_handle = (u64)&notifyevent; cmdrsp->scsitaskmgmt.notifyresult_handle = (u64)&notifyresult; 'notify_handle' is a pointer to a 'wait_queue_head_t' variable, and 'notifyresult' is a pointer to an int. Both of these are just local stack variables in the issuing process. The way it's supposed to happen is that when the IO partition completes the command, in our completion handling we get copies of those pointers back from the IO partition, where we stash the result of the command at '*notifyresult' (which should not be 0xffff, because that is the initial value that the caller is looking to see a change in), and wake up the wait queue at '*notify_handle'. There are several places we do that dance, but prior to this patch, we always do it WRONG, like: cmdrsp->scsitaskmgmt.notifyresult_handle = TASK_MGMT_FAILED; wake_up_all((wait_queue_head_t *)cmdrsp->scsitaskmgmt.notify_handle); The wake_up_all() part is correct (albeit with the help of the sloppy pointer casting, but that's irrelevant to the bug), but the assignment of 'notifyresult_handle' is WRONG, and SHOULD read: *(int *)(cmdrsp->scsitaskmgmt.notifyresult_handle) = TASK_MGMT_FAILED; Without this change, the caller is NEVER going to notice a change in his local value of 'notifyresult' when he does the: if (!wait_event_timeout(notifyevent, notifyresult != 0xffff, msecs_to_jiffies(45000))) and hence will be timing out EVERY taskmgmt command. This patch also eliminates the need for sloppy casting of pointers back-and-forth between u64 values, with the help of idr_alloc() to provide handles for us. It is the generated int handles we pass to the IO partition to denote our completion context, and these are validated and converted back to the required pointers when the task mgmt commands are returned back to us by the IO partition. == Testing == You must enable dynamic debugging in visorhba (build kernel with 'CONFIG_DYNAMIC_DEBUG=y', provide kernel parameter 'visorhba.dyndbg=+p') to see kernel messages involved with visorhba scsi task mgmt commands, which were added in this patch in the form of a few dev_dbg() / pr_debug() messages. In order to inject faults necessary to get visorhba to actully issue scsi task mgmt commands, you will need to compile a kernel with CONFIG_FAIL_IO_TIMEOUT and friends, in the "Kernel hacking" section: * Enable "Fault-injection framework" * Enable "Fault-injection capability for disk IO" * Enable "Fault-injection capability for faking disk interrupts" * Enable "Debugfs entries for fault-injection capabilities" When running a kernel with those options, you can manually inject a fault that will force a scsi task mgmt command to be issued like this: # mount -t debugfs nodev /sys/kernel/debug # cd /sys/kernel/debug/fail_io_timeout # cat interval 1 # cat probability 0 # cat times 1 # echo 100 >probability # cd /sys/block/sda # l | grep fail -rw-r--r-- 1 root root 4096 May 5 10:53 io-timeout-fail -rw-r--r-- 1 root root 4096 May 5 10:54 make-it-fail # echo 1 >io-timeout-fail # echo 1 >make-it-fail To test this patch, after performing the above steps, I did something to force a block device i/o, then shortly afterwards examined the kernel log. There I found evidence that visorhba had successfully issued a task mgmt command, and that it completed successfully: [ 333.352612] FAULT_INJECTION: forcing a failure. name fail_io_timeout, interval 1, probability 100, space 0, times 1 [ 333.352617] CPU: 0 PID: 295 Comm: vhba_incoming Tainted: G C 4.6.0-rc3-ARCH+ #2 [ 333.352619] Hardware name: Dell Inc. PowerEdge T110/ , BIOS 1.23 12/15/2009 [ 333.352620] 0000000000000000 ffff88001d1a7dd0 ffffffff8125beeb ffffffff818507c0 [ 333.352623] 0000000000000064 ffff88001d1a7df0 ffffffff8128047a ffff8800113462b0 [ 333.352625] ffff88000e523000 ffff88001d1a7e00 ffffffff81241c79 ffff88001d1a7e18 [ 333.352627] Call Trace: [ 333.352634] [<ffffffff8125beeb>] dump_stack+0x4d/0x72 [ 333.352637] [<ffffffff8128047a>] should_fail+0x11a/0x120 [ 333.352641] [<ffffffff81241c79>] blk_should_fake_timeout+0x29/0x30 [ 333.352643] [<ffffffff81241c36>] blk_complete_request+0x16/0x30 [ 333.352654] [<ffffffffa0118b36>] scsi_done+0x26/0x80 [scsi_mod] [ 333.352657] [<ffffffffa014a56c>] process_incoming_rsps+0x2bc/0x770 [visorhba] [ 333.352661] [<ffffffff81095630>] ? wait_woken+0x80/0x80 [ 333.352663] [<ffffffffa014a2b0>] ? add_scsipending_entry+0x100/0x100 [visorhba] [ 333.352666] [<ffffffff81077759>] kthread+0xc9/0xe0 [ 333.352669] [<ffffffff814609d2>] ret_from_fork+0x22/0x40 [ 333.352671] [<ffffffff81077690>] ? kthread_create_on_node+0x180/0x180 [ 364.025672] sd 0:0:1:1: visorhba: initiating type=1 taskmgmt command [ 364.029721] visorhba: notifying initiator with result=0x1 [ 364.029726] sd 0:0:1:1: visorhba: taskmgmt type=1 success; result=0x1 Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: delete processing of vdiskmgmt commandsTim Sell2016-06-071-22/+0
| | | | | | | | | We never issue SCSI commands of type CMD_VDISKMGMT_TYPE, so there is no need to have code that processes their completions. Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: switch success handling to error handlingDavid Binder2016-05-091-8/+9
| | | | | | | | | Addresses code audit feeback to switch from success handling to error handling in visorhba_main.c/process_disk_notify(). Signed-off-by: David Binder <david.binder@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: main path needs to flow down the left marginTim Sell2016-05-091-8/+9
| | | | | | | | | | | In del_scsipending_ent(), the error-path and main-path were switched, so the error-path is handled like 'if (err) return;', and the main-path flows down the left margin. This also allowed us to remove the initialization of "sent". Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: fail gracefully for thread creation failuresTim Sell2016-05-091-26/+28
| | | | | | | | | | | | | | | | Previously, if visorhba ever failed to create its thread, it would have subsequently attempted to do a kthread_stop() on an invalid task_struct pointer. This was fixed via the new visor_thread_stop() function, which validates the task_struct pointer before doing the kthread_stop(). Also, the other thread-related fields in visor_thread_info (has_stopped and id) were not being used, so visor_thead_info was just removed. We also now spit out an error message if thread creation fails. Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: visorhba: replace functionlike macro with functionAlexander Curtin2016-05-091-4/+22
| | | | | | | | | | | | | | The `set_no_disk_inquiry_request` function now uses the correct min macro. Also I removed an unnecessary conditional. Get rid of u8 casts, u32 len, and u32 lun (which is actually defined as a u64 in the scsidev->lun field from whence it originated). Signed-off-by: Alexander Curtin <alexander.curtin@unisys.com> Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: Modify boolean assignmentJanani Ravichandran2016-02-111-1/+1
| | | | | | | | | Boolean variables should be assigned true/false rather than 1/0. This patch makes a correction on such a variable which has boolean values assigned in all other places within the file. Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: Remove parentheses around right hand side of assignmentJanani Ravichandran2016-02-111-2/+2
| | | | | | | | | | | | | | | | | | | | | Remove parentheses on the right hand side of assignment as they are not needed. Semantic patch used: @@ expression a, b, c, d; @@ ( a = (c == d) | a = - ( b - ) ) Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: unisys: fix potential format string leakKees Cook2016-02-071-1/+1
| | | | | | | | Since "name" is always used directly, force "%s" for the kthread format string to avoid any potential format string leaks. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: return error value directlySudip Mukherjee2015-11-171-8/+4
| | | | | | | | | In case of error we are jumping to err_del_scsipending_ent and always returning SCSI_MLQUEUE_DEVICE_BUSY from error path. We donot need a variable to return a fixed error value, it can be returned directly. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: remove unused variableSudip Mukherjee2015-11-171-4/+0
| | | | | | | The variables op, sd and zmotion were never being used. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Staging: unisys: Remove unnecessary cast on void pointerShraddha Barke2015-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | void pointers do not need to be cast to other pointer types. The semantic patch used to find this: @r@ expression x; void* e; type T; identifier f; @@ ( *((T *)e) | ((T *)x)[...] | ((T *)x)->f | - (T *) e ) Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: unisys: Add s-Par visorhbaDavid Kershner2015-09-293-0/+1265
This driver create a host bus adapter device when s-Par sends a device create message to create a storage adapter on the visorbus. When the message is received by visorbus, the visorhba_probe function is called and the hba device is created and managed by the visorhba driver. Signed-off-by: Erik Arfvidson <erik.arfvidson@unisys.com> Signed-off-by: Benjamin Romer <benjamin.romer@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud