1 /* 2 * Tracepoint definitions for the s390 zcrypt device driver 3 * 4 * Copyright IBM Corp. 2016 5 * Author(s): Harald Freudenberger <freude@de.ibm.com> 6 * 7 * Currently there are two tracepoint events defined here. 8 * An s390_zcrypt_req request event occurs as soon as the request is 9 * recognized by the zcrypt ioctl function. This event may act as some kind 10 * of request-processing-starts-now indication. 11 * As late as possible within the zcrypt ioctl function there occurs the 12 * s390_zcrypt_rep event which may act as the point in time where the 13 * request has been processed by the kernel and the result is about to be 14 * transferred back to userspace. 15 * The glue which binds together request and reply event is the ptr 16 * parameter, which is the local buffer address where the request from 17 * userspace has been stored by the ioctl function. 18 * 19 * The main purpose of this zcrypt tracepoint api is to get some data for 20 * performance measurements together with information about on which card 21 * and queue the request has been processed. It is not an ffdc interface as 22 * there is already code in the zcrypt device driver to serve the s390 23 * debug feature interface. 24 */ 25 26 #undef TRACE_SYSTEM 27 #define TRACE_SYSTEM s390 28 29 #if !defined(_TRACE_S390_ZCRYPT_H) || defined(TRACE_HEADER_MULTI_READ) 30 #define _TRACE_S390_ZCRYPT_H 31 32 #include <linux/tracepoint.h> 33 34 #define TP_ICARSAMODEXPO 0x0001 35 #define TP_ICARSACRT 0x0002 36 #define TB_ZSECSENDCPRB 0x0003 37 #define TP_ZSENDEP11CPRB 0x0004 38 #define TP_HWRNGCPRB 0x0005 39 40 #define show_zcrypt_tp_type(type) \ 41 __print_symbolic(type, \ 42 { TP_ICARSAMODEXPO, "ICARSAMODEXPO" }, \ 43 { TP_ICARSACRT, "ICARSACRT" }, \ 44 { TB_ZSECSENDCPRB, "ZSECSENDCPRB" }, \ 45 { TP_ZSENDEP11CPRB, "ZSENDEP11CPRB" }, \ 46 { TP_HWRNGCPRB, "HWRNGCPRB" }) 47 48 /** 49 * trace_s390_zcrypt_req - zcrypt request tracepoint function 50 * @ptr: Address of the local buffer where the request from userspace 51 * is stored. Can be used as a unique id to relate together 52 * request and reply. 53 * @type: One of the TP_ defines above. 54 * 55 * Called when a request from userspace is recognised within the ioctl 56 * function of the zcrypt device driver and may act as an entry 57 * timestamp. 58 */ 59 TRACE_EVENT(s390_zcrypt_req, 60 TP_PROTO(void *ptr, u32 type), 61 TP_ARGS(ptr, type), 62 TP_STRUCT__entry( 63 __field(void *, ptr) 64 __field(u32, type)), 65 TP_fast_assign( 66 __entry->ptr = ptr; 67 __entry->type = type;), 68 TP_printk("ptr=%p type=%s", 69 __entry->ptr, 70 show_zcrypt_tp_type(__entry->type)) 71 ); 72 73 /** 74 * trace_s390_zcrypt_rep - zcrypt reply tracepoint function 75 * @ptr: Address of the local buffer where the request from userspace 76 * is stored. Can be used as a unique id to match together 77 * request and reply. 78 * @fc: Function code. 79 * @rc: The bare returncode as returned by the device driver ioctl 80 * function. 81 * @dev: The adapter nr where this request was actually processed. 82 * @dom: Domain id of the device where this request was processed. 83 * 84 * Called upon recognising the reply from the crypto adapter. This 85 * message may act as the exit timestamp for the request but also 86 * carries some info about on which adapter the request was processed 87 * and the returncode from the device driver. 88 */ 89 TRACE_EVENT(s390_zcrypt_rep, 90 TP_PROTO(void *ptr, u32 fc, u32 rc, u16 dev, u16 dom), 91 TP_ARGS(ptr, fc, rc, dev, dom), 92 TP_STRUCT__entry( 93 __field(void *, ptr) 94 __field(u32, fc) 95 __field(u32, rc) 96 __field(u16, device) 97 __field(u16, domain)), 98 TP_fast_assign( 99 __entry->ptr = ptr; 100 __entry->fc = fc; 101 __entry->rc = rc; 102 __entry->device = dev; 103 __entry->domain = dom;), 104 TP_printk("ptr=%p fc=0x%04x rc=%d dev=0x%02hx domain=0x%04hx", 105 __entry->ptr, 106 (unsigned int) __entry->fc, 107 (int) __entry->rc, 108 (unsigned short) __entry->device, 109 (unsigned short) __entry->domain) 110 ); 111 112 #endif /* _TRACE_S390_ZCRYPT_H */ 113 114 /* This part must be outside protection */ 115 116 #undef TRACE_INCLUDE_PATH 117 #undef TRACE_INCLUDE_FILE 118 119 #define TRACE_INCLUDE_PATH asm/trace 120 #define TRACE_INCLUDE_FILE zcrypt 121 122 #include <trace/define_trace.h> 123