Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Tracepoint definitions for the s390 zcrypt device driver
0004  *
0005  * Copyright IBM Corp. 2016
0006  * Author(s): Harald Freudenberger <freude@de.ibm.com>
0007  *
0008  * Currently there are two tracepoint events defined here.
0009  * An s390_zcrypt_req request event occurs as soon as the request is
0010  * recognized by the zcrypt ioctl function. This event may act as some kind
0011  * of request-processing-starts-now indication.
0012  * As late as possible within the zcrypt ioctl function there occurs the
0013  * s390_zcrypt_rep event which may act as the point in time where the
0014  * request has been processed by the kernel and the result is about to be
0015  * transferred back to userspace.
0016  * The glue which binds together request and reply event is the ptr
0017  * parameter, which is the local buffer address where the request from
0018  * userspace has been stored by the ioctl function.
0019  *
0020  * The main purpose of this zcrypt tracepoint api is to get some data for
0021  * performance measurements together with information about on which card
0022  * and queue the request has been processed. It is not an ffdc interface as
0023  * there is already code in the zcrypt device driver to serve the s390
0024  * debug feature interface.
0025  */
0026 
0027 #undef TRACE_SYSTEM
0028 #define TRACE_SYSTEM s390
0029 
0030 #if !defined(_TRACE_S390_ZCRYPT_H) || defined(TRACE_HEADER_MULTI_READ)
0031 #define _TRACE_S390_ZCRYPT_H
0032 
0033 #include <linux/tracepoint.h>
0034 
0035 #define TP_ICARSAMODEXPO  0x0001
0036 #define TP_ICARSACRT      0x0002
0037 #define TB_ZSECSENDCPRB   0x0003
0038 #define TP_ZSENDEP11CPRB  0x0004
0039 #define TP_HWRNGCPRB      0x0005
0040 
0041 #define show_zcrypt_tp_type(type)               \
0042     __print_symbolic(type,                  \
0043              { TP_ICARSAMODEXPO, "ICARSAMODEXPO" }, \
0044              { TP_ICARSACRT, "ICARSACRT" },     \
0045              { TB_ZSECSENDCPRB, "ZSECSENDCPRB" },   \
0046              { TP_ZSENDEP11CPRB, "ZSENDEP11CPRB" }, \
0047              { TP_HWRNGCPRB, "HWRNGCPRB" })
0048 
0049 /**
0050  * trace_s390_zcrypt_req - zcrypt request tracepoint function
0051  * @ptr:  Address of the local buffer where the request from userspace
0052  *    is stored. Can be used as a unique id to relate together
0053  *    request and reply.
0054  * @type: One of the TP_ defines above.
0055  *
0056  * Called when a request from userspace is recognised within the ioctl
0057  * function of the zcrypt device driver and may act as an entry
0058  * timestamp.
0059  */
0060 TRACE_EVENT(s390_zcrypt_req,
0061         TP_PROTO(void *ptr, u32 type),
0062         TP_ARGS(ptr, type),
0063         TP_STRUCT__entry(
0064             __field(void *, ptr)
0065             __field(u32, type)),
0066         TP_fast_assign(
0067             __entry->ptr = ptr;
0068             __entry->type = type;),
0069         TP_printk("ptr=%p type=%s",
0070               __entry->ptr,
0071               show_zcrypt_tp_type(__entry->type))
0072 );
0073 
0074 /**
0075  * trace_s390_zcrypt_rep - zcrypt reply tracepoint function
0076  * @ptr:  Address of the local buffer where the request from userspace
0077  *    is stored. Can be used as a unique id to match together
0078  *    request and reply.
0079  * @fc:   Function code.
0080  * @rc:   The bare returncode as returned by the device driver ioctl
0081  *    function.
0082  * @dev:  The adapter nr where this request was actually processed.
0083  * @dom:  Domain id of the device where this request was processed.
0084  *
0085  * Called upon recognising the reply from the crypto adapter. This
0086  * message may act as the exit timestamp for the request but also
0087  * carries some info about on which adapter the request was processed
0088  * and the returncode from the device driver.
0089  */
0090 TRACE_EVENT(s390_zcrypt_rep,
0091         TP_PROTO(void *ptr, u32 fc, u32 rc, u16 dev, u16 dom),
0092         TP_ARGS(ptr, fc, rc, dev, dom),
0093         TP_STRUCT__entry(
0094             __field(void *, ptr)
0095             __field(u32, fc)
0096             __field(u32, rc)
0097             __field(u16, device)
0098             __field(u16, domain)),
0099         TP_fast_assign(
0100             __entry->ptr = ptr;
0101             __entry->fc = fc;
0102             __entry->rc = rc;
0103             __entry->device = dev;
0104             __entry->domain = dom;),
0105         TP_printk("ptr=%p fc=0x%04x rc=%d dev=0x%02hx domain=0x%04hx",
0106               __entry->ptr,
0107               (unsigned int) __entry->fc,
0108               (int) __entry->rc,
0109               (unsigned short) __entry->device,
0110               (unsigned short) __entry->domain)
0111 );
0112 
0113 #endif /* _TRACE_S390_ZCRYPT_H */
0114 
0115 /* This part must be outside protection */
0116 
0117 #undef TRACE_INCLUDE_PATH
0118 #undef TRACE_INCLUDE_FILE
0119 
0120 #define TRACE_INCLUDE_PATH asm/trace
0121 #define TRACE_INCLUDE_FILE zcrypt
0122 
0123 #include <trace/define_trace.h>