zcrypt.h 4.1 KB

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