aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/cio/ioasm.c
diff options
context:
space:
mode:
authorVineeth Vijayan <vneethv@linux.ibm.com>2021-02-07 20:40:58 +0100
committerHeiko Carstens <hca@linux.ibm.com>2021-03-22 11:36:04 +0100
commita4f17cc726712a52122ad38540bc3ff3a052d1a4 (patch)
tree0a56fb18ff0e1517a4d9a42527204ce17e180a0a /drivers/s390/cio/ioasm.c
parents390/cio: introduce CIO debugfs directory (diff)
downloadlinux-dev-a4f17cc726712a52122ad38540bc3ff3a052d1a4.tar.xz
linux-dev-a4f17cc726712a52122ad38540bc3ff3a052d1a4.zip
s390/cio: add CRW inject functionality
This patch introduces the mechanism to inject artificial events to the CIO layer. One of the main-event type which triggers the CommonIO operations are Channel Report events. When a malfunction or other condition affecting channel-subsystem operation is recognized, a Channel Report Word (consisting of one or more CRWs) describing the condition is made pending for retrieval and analysis by the program. The CRW contains information concerning the identity and state of a facility following the detection of the malfunction or other condition. The patch introduces two debugfs interfaces which can be used to inject 'artificial' events from the userspace. It is intended to provide an easy means to increase the test coverage for CIO code. And this functionality can be enabled via a new configuration option CONFIG_CIO_INJECT. The newly introduces debugfs interfaces can be used as mentioned below to generate different fake-events. To use the crw_inject, first we should enable it by using enable_inject interface. i.e echo 1 > /sys/kernel/debug/s390/cio/enable_inject After the first step, user can simulate CRW as follows: echo <solicited> <overflow> <chaining> <rsc> <ancillary> <erc> <rsid> \ > /sys/kernel/debug/s390/cio/crw_inject Example: A permanent error ERC on CHPID 0x60 would look like this: echo 0 0 0 4 0 6 0x60 > /sys/kernel/debug/s390/cio/crw_inject and an initialized ERC on the same CHPID: echo 0 0 0 4 0 2 0x60 > /sys/kernel/debug/s390/cio/crw_inject Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com> Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'drivers/s390/cio/ioasm.c')
-rw-r--r--drivers/s390/cio/ioasm.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/drivers/s390/cio/ioasm.c b/drivers/s390/cio/ioasm.c
index 08eb10283b18..4c5244d6052b 100644
--- a/drivers/s390/cio/ioasm.c
+++ b/drivers/s390/cio/ioasm.c
@@ -12,6 +12,7 @@
#include "ioasm.h"
#include "orb.h"
#include "cio.h"
+#include "cio_inject.h"
static inline int __stsch(struct subchannel_id schid, struct schib *addr)
{
@@ -260,7 +261,7 @@ int xsch(struct subchannel_id schid)
return ccode;
}
-int stcrw(struct crw *crw)
+static inline int __stcrw(struct crw *crw)
{
int ccode;
@@ -271,6 +272,26 @@ int stcrw(struct crw *crw)
: "=d" (ccode), "=m" (*crw)
: "a" (crw)
: "cc");
+ return ccode;
+}
+
+static inline int _stcrw(struct crw *crw)
+{
+#ifdef CONFIG_CIO_INJECT
+ if (static_branch_unlikely(&cio_inject_enabled)) {
+ if (stcrw_get_injected(crw) == 0)
+ return 0;
+ }
+#endif
+
+ return __stcrw(crw);
+}
+
+int stcrw(struct crw *crw)
+{
+ int ccode;
+
+ ccode = _stcrw(crw);
trace_s390_cio_stcrw(crw, ccode);
return ccode;