All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pawel Laszczak <pawell@cadence.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	<linux-usb@vger.kernel.org>, Felipe Balbi <balbi@kernel.org>,
	<linux-kernel@vger.kernel.org>, <ltyrala@cadence.com>,
	<adouglas@cadence.com>, <pawell@cadence.com>
Subject: [PATCH 03/31] usb: usbssp: Add trace events used in driver
Date: Thu, 19 Jul 2018 18:57:36 +0100	[thread overview]
Message-ID: <1532023084-28083-4-git-send-email-pawell@cadence.com> (raw)
In-Reply-To: <1532023084-28083-1-git-send-email-pawell@cadence.com>

This patch creates a set of event class. For each event class this patch
defines some trace events.

1. event class: usbssp_log_msg
    - usbssp_dbg_address - debug message used in function handling
	Address Device Command.
    - usbssp_dbg_context_change - debug messages related to contexti
	 updates performed with Configure Endpoint and Evaluate Contexti
	 command.
    - usbssp_dbg_reset_ep - debug messages associated with resetting i
	an endpoint.
    - usbssp_dbg_cancel_request - debug messages related to the removal
	 of a cancelled Request.
    - usbssp_dbg_init - debug messages related to the initialization
	and unload.
    - usbssp_dbg_ring_expansion - debug messages related to ring
	expansion.

2. event class: usbssp_log_ctx
    usbssp_address_ctx - debug message related to address Device command,
    that can be used to display the context data filed.

3. event class: usbssp_log_trb
    - usbssp_handle_event - debug message related to handling Events TRB.
    - usbssp_handle_command - debug message related to handling C
	ommand TRB.
    - usbssp_handle_transfer - debug message related to handling
	Transfer TRB.
    - usbssp_queue_trb - debug message related to queuing TRB.

4. event class: usbssp_log_priv_dev
    This class event  tracing at least part of an usbssp_device lifetime,
    and for now it already exposes quite a bit of valuable information.

    - usbssp_alloc_priv_device - debug message related to allocating
	 device.
    - usbssp_free_priv_device - debug message related to the freeing
	 device.
    - usbssp_setup_addressable_priv_device - debug message related to the
    	initialization of usbssp_device object.
    - usbssp_setup_device - debug message related to Address Device
	command.
    - usbssp_stop_device - debug message related to stooping device.

5. event class: usbssp_log_request
    This will help us figuring out information related to usb_request
    object.

    - usbssp_request_enqueue - debug message used during enqueuing new
	request.
    - usbssp_request_giveback -  debug message related to
	usbssp_request_giveback function
    - usbssp_request_dequeue - debug message related to dequeuing request.
    - usbssp_alloc_request - debug message related to allocation
	new request.
    - usbssp_free_request - debug message related to freeing request.

6. event class: usbssp_log_ep_ctx
    With these event class, we can track what's happening with the
    HW while executing each and every command. It will give us visibility
    into how the endpoint contexts are being modified by controller
    which can bring insight into problems while debugging.

    - usbssp_remove_request - debug message related to removing request.
    - usbssp_handle_cmd_stop_ep - debug message related to Stop Endpointi
	command.
    - usbssp_handle_cmd_set_deq_ep - debug message releted to Set Dequeue
	 Endpoint command,
    - usbssp_handle_cmd_reset_ep - debug message related to Reset Endpoint
	 command.
    - usbssp_handle_cmd_config_ep - debug message related to Endpoint
	Configure command.

7. event class: usbssp_log_slot_ctx
    With these event class, we can track what's happening with the HW
    while executing each and every command. It will give us visibility
    into how the slot contexts are being modified by controller which
    can bring insight into problems while debugging.

    - usbssp_alloc_dev - debug message related to allocating device.
    - usbssp_free_dev - debug message related to freeing device.
    - usbssp_handle_cmd_disable_slot - debug message related to
	Disable Slot command.
    - usbssp_reset_device - debug message related to resetting device.
    - usbssp_setup_device_slot - debug message related to c
	onfiguring slot.
    - usbssp_handle_cmd_addr_dev - debug message related to Address Device
	command.
    - usbssp_handle_cmd_reset_dev - debug message related to Reset Device
	command.
    - usbssp_handle_cmd_set_deq - debug message related to
	Set Dequeue command.
    - usbssp_configure_endpoint - debug message used during configuring
	endpoints.

8. event class: usbssp_log_ring
    This event class defines the events used for tracing the change
    of all kinds of rings used by an usbssp device. An usbssp ring
    is basically a memory block shared between software and hardware.
    By tracing changes of rings, it makes the life easier for.

    - debugging hardware or software problems.
    - usbssp_ring_alloc - debug message related to allocation ring.
    - usbssp_ring_free - debug message related to freeing ring.
    - usbssp_ring_expansion - debug message related with expansion ring.
    - usbssp_inc_enq - debug message related with incrementing
	dequeue pointer.
    - usbssp_inc_deq - debug message related with decrementing
	dequeue pointer.

9. event class: usbssp_log_portsc
    Track the port status each time we get a port status change event.

     - usbssp_handle_port_status - debug message used in
	handle_port_status function.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
---
 drivers/usb/usbssp/gadget-trace.c |  13 +
 drivers/usb/usbssp/gadget-trace.h | 482 ++++++++++++++++++++++++++++++
 2 files changed, 495 insertions(+)
 create mode 100644 drivers/usb/usbssp/gadget-trace.c
 create mode 100644 drivers/usb/usbssp/gadget-trace.h

diff --git a/drivers/usb/usbssp/gadget-trace.c b/drivers/usb/usbssp/gadget-trace.c
new file mode 100644
index 000000000000..9994ad09eb4d
--- /dev/null
+++ b/drivers/usb/usbssp/gadget-trace.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * USBSSP device controller driver
+ *
+ * Copyright (C) 2018 Cadence.
+ *
+ * Author: Pawel Laszczak
+ * A lot of code based on Linux XHCI driver.
+ * Origin: Copyright (C) 2008 Intel Corp.
+ */
+
+#define CREATE_TRACE_POINTS
+#include "gadget-trace.h"
diff --git a/drivers/usb/usbssp/gadget-trace.h b/drivers/usb/usbssp/gadget-trace.h
new file mode 100644
index 000000000000..667246c344ba
--- /dev/null
+++ b/drivers/usb/usbssp/gadget-trace.h
@@ -0,0 +1,482 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * USBSSP device controller driver
+ *
+ * Copyright (C) 2018 Cadence.
+ *
+ * Author: Pawel Laszczak
+ *
+ * A lot of code based on Linux XHCI driver.
+ * Origin: Copyright (C) 2008 Intel Corp.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM usbssp-dev
+
+/*
+ * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
+ * legitimate C variable. It is not exported to user space.
+ */
+#undef TRACE_SYSTEM_VAR
+#define TRACE_SYSTEM_VAR usbssp_dev
+
+#if !defined(__USBSSP_DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define __USBSSP_DEV_TRACE_H
+
+#include <linux/tracepoint.h>
+#include "gadget.h"
+
+#define USBSSP_DEV_MSG_MAX	500
+
+DECLARE_EVENT_CLASS(usbssp_log_msg,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf),
+	TP_STRUCT__entry(__dynamic_array(char, msg, USBSSP_DEV_MSG_MAX)),
+	TP_fast_assign(
+		vsnprintf(__get_str(msg), USBSSP_DEV_MSG_MAX, vaf->fmt, *vaf->va);
+	),
+	TP_printk("%s", __get_str(msg))
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_address,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_context_change,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_reset_ep,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_cancel_request,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_init,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_ring_expansion,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_ctx,
+	TP_PROTO(struct usbssp_udc *usbssp_data, struct usbssp_container_ctx *ctx,
+		 unsigned int ep_num),
+	TP_ARGS(usbssp_data, ctx, ep_num),
+	TP_STRUCT__entry(
+		__field(int, ctx_64)
+		__field(unsigned int, ctx_type)
+		__field(dma_addr_t, ctx_dma)
+		__field(u8 *, ctx_va)
+		__field(unsigned int, ctx_ep_num)
+		__field(int, slot_id)
+		__dynamic_array(u32, ctx_data,
+			((HCC_64BYTE_CONTEXT(usbssp_data->hcc_params) + 1) * 8) *
+			((ctx->type == USBSSP_CTX_TYPE_INPUT) + ep_num + 1))
+	),
+	TP_fast_assign(
+		__entry->ctx_64 = HCC_64BYTE_CONTEXT(usbssp_data->hcc_params);
+		__entry->ctx_type = ctx->type;
+		__entry->ctx_dma = ctx->dma;
+		__entry->ctx_va = ctx->bytes;
+		__entry->slot_id = usbssp_data->slot_id;
+		__entry->ctx_ep_num = ep_num;
+		memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
+			((HCC_64BYTE_CONTEXT(usbssp_data->hcc_params) + 1) * 32) *
+			((ctx->type == USBSSP_CTX_TYPE_INPUT) + ep_num + 1));
+	),
+	TP_printk("\nctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p",
+			__entry->ctx_64, __entry->ctx_type,
+			(unsigned long long) __entry->ctx_dma, __entry->ctx_va
+	)
+);
+
+DEFINE_EVENT(usbssp_log_ctx, usbssp_address_ctx,
+	TP_PROTO(struct usbssp_udc *usbssp_data, struct usbssp_container_ctx *ctx,
+		 unsigned int ep_num),
+	TP_ARGS(usbssp_data, ctx, ep_num)
+);
+
+
+DECLARE_EVENT_CLASS(usbssp_log_trb,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb),
+	TP_STRUCT__entry(
+		__field(u32, type)
+		__field(u32, field0)
+		__field(u32, field1)
+		__field(u32, field2)
+		__field(u32, field3)
+	),
+	TP_fast_assign(
+		__entry->type = ring->type;
+		__entry->field0 = le32_to_cpu(trb->field[0]);
+		__entry->field1 = le32_to_cpu(trb->field[1]);
+		__entry->field2 = le32_to_cpu(trb->field[2]);
+		__entry->field3 = le32_to_cpu(trb->field[3]);
+	),
+	TP_printk("%s: %s", usbssp_ring_type_string(__entry->type),
+			usbssp_decode_trb(__entry->field0, __entry->field1,
+					__entry->field2, __entry->field3)
+	)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_handle_event,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_handle_command,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_handle_transfer,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_queue_trb,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_priv_dev,
+	TP_PROTO(struct usbssp_device *priv_dev),
+	TP_ARGS(priv_dev),
+	TP_STRUCT__entry(
+		__field(struct usbssp_device *, priv_dev)
+		__field(struct usb_gadget *, gadget)
+		__field(unsigned long long, out_ctx)
+		__field(unsigned long long, in_ctx)
+		__field(u8, port_num)
+	),
+	TP_fast_assign(
+		__entry->priv_dev = priv_dev;
+		__entry->gadget = priv_dev->gadget;
+		__entry->in_ctx = (unsigned long long) priv_dev->in_ctx->dma;
+		__entry->out_ctx = (unsigned long long) priv_dev->out_ctx->dma;
+		__entry->port_num = priv_dev->port_num;
+	),
+	TP_printk("priv_dev %p gadget %p ctx %llx | %llx, port %d ",
+		__entry->priv_dev, __entry->gadget, __entry->in_ctx, __entry->out_ctx,
+		__entry->port_num
+	)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_alloc_priv_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_free_priv_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_setup_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_setup_addressable_priv_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_stop_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_request,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request),
+	TP_STRUCT__entry(
+		__field(struct usb_request *, request)
+		__field(void *, buf)
+		__field(unsigned int, length)
+		__field(dma_addr_t, dma)
+		__field(struct scatterlist*, sg)
+		__field(unsigned int, num_sgs)
+		__field(unsigned int, num_mapped_sgs)
+		__field(unsigned int, stream_id)
+		__field(unsigned int, no_interrupt)
+		__field(unsigned int, zero)
+		__field(unsigned int, short_not_ok)
+		__field(unsigned int, dma_mapped)
+		__field(int, status)
+		__field(unsigned int, actual)
+	),
+	TP_fast_assign(
+		__entry->request = request;
+		__entry->buf = request->buf;
+		__entry->length = request->length;
+		__entry->dma = request->dma;
+		__entry->sg = request->sg;
+		__entry->num_sgs = request->num_sgs;
+		__entry->num_mapped_sgs = request->num_mapped_sgs;
+		__entry->stream_id = request->stream_id;
+		__entry->no_interrupt = request->no_interrupt;
+		__entry->zero = request->zero;
+		__entry->short_not_ok = request->short_not_ok;
+		__entry->dma_mapped = 0 /*request->dma_mapped*/;
+		__entry->status = request->status;
+		__entry->actual = request->actual;
+	),
+
+	TP_printk("req %p; buf %p, len %d, dma %llx, sg %p, num_sg %d, num_m_sg %d,"
+			"stream_id %d, no_int %x, zero %x, short_not_ok %x, dma_mapped %x, "
+			"status %d, actual %d",
+			__entry->request,
+			__entry->buf, __entry->length, __entry->dma, __entry->sg,
+			__entry->num_sgs, __entry->num_mapped_sgs, __entry->stream_id,
+			__entry->no_interrupt, __entry->zero, __entry->short_not_ok,
+			__entry->dma_mapped, __entry->status, __entry->actual
+		)
+
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_request_enqueue,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_request_giveback,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_request_dequeue,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_alloc_request,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_free_request,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_ep_ctx,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx),
+	TP_STRUCT__entry(
+		__field(u32, info)
+		__field(u32, info2)
+		__field(u64, deq)
+		__field(u32, tx_info)
+	),
+	TP_fast_assign(
+		__entry->info = le32_to_cpu(ctx->ep_info);
+		__entry->info2 = le32_to_cpu(ctx->ep_info2);
+		__entry->deq = le64_to_cpu(ctx->deq);
+		__entry->tx_info = le32_to_cpu(ctx->tx_info);
+	),
+	TP_printk("%s", usbssp_decode_ep_context(__entry->info,
+		__entry->info2, __entry->deq, __entry->tx_info)
+	)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_remove_request,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_stop_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_set_deq_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_reset_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_config_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_slot_ctx,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx),
+	TP_STRUCT__entry(
+		__field(u32, info)
+		__field(u32, info2)
+		__field(u32, int_target)
+		__field(u32, state)
+	),
+	TP_fast_assign(
+		__entry->info = le32_to_cpu(ctx->dev_info);
+		__entry->info2 = le32_to_cpu(ctx->dev_info2);
+		__entry->int_target = le64_to_cpu(ctx->int_target);
+		__entry->state = le32_to_cpu(ctx->dev_state);
+	),
+	TP_printk("%s", usbssp_decode_slot_context(__entry->info,
+			__entry->info2, __entry->int_target,
+			__entry->state)
+	)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_alloc_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_free_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_disable_slot,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_reset_device,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_setup_device_slot,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_addr_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_reset_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_set_deq,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_configure_endpoint,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_ring,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring),
+	TP_STRUCT__entry(
+		__field(u32, type)
+		__field(void *, ring)
+		__field(dma_addr_t, enq)
+		__field(dma_addr_t, deq)
+		__field(dma_addr_t, enq_seg)
+		__field(dma_addr_t, deq_seg)
+		__field(unsigned int, num_segs)
+		__field(unsigned int, stream_id)
+		__field(unsigned int, cycle_state)
+		__field(unsigned int, num_trbs_free)
+		__field(unsigned int, bounce_buf_len)
+	),
+	TP_fast_assign(
+		__entry->ring = ring;
+		__entry->type = ring->type;
+		__entry->num_segs = ring->num_segs;
+		__entry->stream_id = ring->stream_id;
+		__entry->enq_seg = ring->enq_seg->dma;
+		__entry->deq_seg = ring->deq_seg->dma;
+		__entry->cycle_state = ring->cycle_state;
+		__entry->num_trbs_free = ring->num_trbs_free;
+		__entry->bounce_buf_len = ring->bounce_buf_len;
+		__entry->enq = usbssp_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
+		__entry->deq = usbssp_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
+	),
+	TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d free_trbs %d bounce %d cycle %d",
+			usbssp_ring_type_string(__entry->type), __entry->ring,
+			&__entry->enq, &__entry->enq_seg,
+			&__entry->deq, &__entry->deq_seg,
+			__entry->num_segs,
+			__entry->stream_id,
+			__entry->num_trbs_free,
+			__entry->bounce_buf_len,
+			__entry->cycle_state
+		)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_ring_alloc,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_ring_free,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_ring_expansion,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_inc_enq,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_inc_deq,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_portsc,
+		TP_PROTO(u32 portnum, u32 portsc),
+		TP_ARGS(portnum, portsc),
+		TP_STRUCT__entry(
+				__field(u32, portnum)
+				__field(u32, portsc)
+				),
+		TP_fast_assign(
+				__entry->portnum = portnum;
+				__entry->portsc = portsc;
+				),
+		TP_printk("port-%d: %s",
+			__entry->portnum,
+			usbssp_decode_portsc(__entry->portsc)
+			)
+);
+
+DEFINE_EVENT(usbssp_log_portsc, usbssp_handle_port_status,
+		TP_PROTO(u32 portnum, u32 portsc),
+		TP_ARGS(portnum, portsc)
+);
+
+#endif /* __USBSSP_TRACE_H */
+/* this part must be outside header guard */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE gadget-trace
+
+#include <trace/define_trace.h>
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
From: Pawel Laszczak <pawell@cadence.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, Felipe Balbi <balbi@kernel.org>,
	linux-kernel@vger.kernel.org, ltyrala@cadence.com,
	adouglas@cadence.com, pawell@cadence.com
Subject: [03/31] usb: usbssp: Add trace events used in driver
Date: Thu, 19 Jul 2018 18:57:36 +0100	[thread overview]
Message-ID: <1532023084-28083-4-git-send-email-pawell@cadence.com> (raw)

This patch creates a set of event class. For each event class this patch
defines some trace events.

1. event class: usbssp_log_msg
    - usbssp_dbg_address - debug message used in function handling
	Address Device Command.
    - usbssp_dbg_context_change - debug messages related to contexti
	 updates performed with Configure Endpoint and Evaluate Contexti
	 command.
    - usbssp_dbg_reset_ep - debug messages associated with resetting i
	an endpoint.
    - usbssp_dbg_cancel_request - debug messages related to the removal
	 of a cancelled Request.
    - usbssp_dbg_init - debug messages related to the initialization
	and unload.
    - usbssp_dbg_ring_expansion - debug messages related to ring
	expansion.

2. event class: usbssp_log_ctx
    usbssp_address_ctx - debug message related to address Device command,
    that can be used to display the context data filed.

3. event class: usbssp_log_trb
    - usbssp_handle_event - debug message related to handling Events TRB.
    - usbssp_handle_command - debug message related to handling C
	ommand TRB.
    - usbssp_handle_transfer - debug message related to handling
	Transfer TRB.
    - usbssp_queue_trb - debug message related to queuing TRB.

4. event class: usbssp_log_priv_dev
    This class event  tracing at least part of an usbssp_device lifetime,
    and for now it already exposes quite a bit of valuable information.

    - usbssp_alloc_priv_device - debug message related to allocating
	 device.
    - usbssp_free_priv_device - debug message related to the freeing
	 device.
    - usbssp_setup_addressable_priv_device - debug message related to the
    	initialization of usbssp_device object.
    - usbssp_setup_device - debug message related to Address Device
	command.
    - usbssp_stop_device - debug message related to stooping device.

5. event class: usbssp_log_request
    This will help us figuring out information related to usb_request
    object.

    - usbssp_request_enqueue - debug message used during enqueuing new
	request.
    - usbssp_request_giveback -  debug message related to
	usbssp_request_giveback function
    - usbssp_request_dequeue - debug message related to dequeuing request.
    - usbssp_alloc_request - debug message related to allocation
	new request.
    - usbssp_free_request - debug message related to freeing request.

6. event class: usbssp_log_ep_ctx
    With these event class, we can track what's happening with the
    HW while executing each and every command. It will give us visibility
    into how the endpoint contexts are being modified by controller
    which can bring insight into problems while debugging.

    - usbssp_remove_request - debug message related to removing request.
    - usbssp_handle_cmd_stop_ep - debug message related to Stop Endpointi
	command.
    - usbssp_handle_cmd_set_deq_ep - debug message releted to Set Dequeue
	 Endpoint command,
    - usbssp_handle_cmd_reset_ep - debug message related to Reset Endpoint
	 command.
    - usbssp_handle_cmd_config_ep - debug message related to Endpoint
	Configure command.

7. event class: usbssp_log_slot_ctx
    With these event class, we can track what's happening with the HW
    while executing each and every command. It will give us visibility
    into how the slot contexts are being modified by controller which
    can bring insight into problems while debugging.

    - usbssp_alloc_dev - debug message related to allocating device.
    - usbssp_free_dev - debug message related to freeing device.
    - usbssp_handle_cmd_disable_slot - debug message related to
	Disable Slot command.
    - usbssp_reset_device - debug message related to resetting device.
    - usbssp_setup_device_slot - debug message related to c
	onfiguring slot.
    - usbssp_handle_cmd_addr_dev - debug message related to Address Device
	command.
    - usbssp_handle_cmd_reset_dev - debug message related to Reset Device
	command.
    - usbssp_handle_cmd_set_deq - debug message related to
	Set Dequeue command.
    - usbssp_configure_endpoint - debug message used during configuring
	endpoints.

8. event class: usbssp_log_ring
    This event class defines the events used for tracing the change
    of all kinds of rings used by an usbssp device. An usbssp ring
    is basically a memory block shared between software and hardware.
    By tracing changes of rings, it makes the life easier for.

    - debugging hardware or software problems.
    - usbssp_ring_alloc - debug message related to allocation ring.
    - usbssp_ring_free - debug message related to freeing ring.
    - usbssp_ring_expansion - debug message related with expansion ring.
    - usbssp_inc_enq - debug message related with incrementing
	dequeue pointer.
    - usbssp_inc_deq - debug message related with decrementing
	dequeue pointer.

9. event class: usbssp_log_portsc
    Track the port status each time we get a port status change event.

     - usbssp_handle_port_status - debug message used in
	handle_port_status function.

Signed-off-by: Pawel Laszczak <pawell@cadence.com>
---
 drivers/usb/usbssp/gadget-trace.c |  13 +
 drivers/usb/usbssp/gadget-trace.h | 482 ++++++++++++++++++++++++++++++
 2 files changed, 495 insertions(+)
 create mode 100644 drivers/usb/usbssp/gadget-trace.c
 create mode 100644 drivers/usb/usbssp/gadget-trace.h

diff --git a/drivers/usb/usbssp/gadget-trace.c b/drivers/usb/usbssp/gadget-trace.c
new file mode 100644
index 000000000000..9994ad09eb4d
--- /dev/null
+++ b/drivers/usb/usbssp/gadget-trace.c
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * USBSSP device controller driver
+ *
+ * Copyright (C) 2018 Cadence.
+ *
+ * Author: Pawel Laszczak
+ * A lot of code based on Linux XHCI driver.
+ * Origin: Copyright (C) 2008 Intel Corp.
+ */
+
+#define CREATE_TRACE_POINTS
+#include "gadget-trace.h"
diff --git a/drivers/usb/usbssp/gadget-trace.h b/drivers/usb/usbssp/gadget-trace.h
new file mode 100644
index 000000000000..667246c344ba
--- /dev/null
+++ b/drivers/usb/usbssp/gadget-trace.h
@@ -0,0 +1,482 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * USBSSP device controller driver
+ *
+ * Copyright (C) 2018 Cadence.
+ *
+ * Author: Pawel Laszczak
+ *
+ * A lot of code based on Linux XHCI driver.
+ * Origin: Copyright (C) 2008 Intel Corp.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM usbssp-dev
+
+/*
+ * The TRACE_SYSTEM_VAR defaults to TRACE_SYSTEM, but must be a
+ * legitimate C variable. It is not exported to user space.
+ */
+#undef TRACE_SYSTEM_VAR
+#define TRACE_SYSTEM_VAR usbssp_dev
+
+#if !defined(__USBSSP_DEV_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define __USBSSP_DEV_TRACE_H
+
+#include <linux/tracepoint.h>
+#include "gadget.h"
+
+#define USBSSP_DEV_MSG_MAX	500
+
+DECLARE_EVENT_CLASS(usbssp_log_msg,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf),
+	TP_STRUCT__entry(__dynamic_array(char, msg, USBSSP_DEV_MSG_MAX)),
+	TP_fast_assign(
+		vsnprintf(__get_str(msg), USBSSP_DEV_MSG_MAX, vaf->fmt, *vaf->va);
+	),
+	TP_printk("%s", __get_str(msg))
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_address,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_context_change,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_reset_ep,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_cancel_request,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_init,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DEFINE_EVENT(usbssp_log_msg, usbssp_dbg_ring_expansion,
+	TP_PROTO(struct va_format *vaf),
+	TP_ARGS(vaf)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_ctx,
+	TP_PROTO(struct usbssp_udc *usbssp_data, struct usbssp_container_ctx *ctx,
+		 unsigned int ep_num),
+	TP_ARGS(usbssp_data, ctx, ep_num),
+	TP_STRUCT__entry(
+		__field(int, ctx_64)
+		__field(unsigned int, ctx_type)
+		__field(dma_addr_t, ctx_dma)
+		__field(u8 *, ctx_va)
+		__field(unsigned int, ctx_ep_num)
+		__field(int, slot_id)
+		__dynamic_array(u32, ctx_data,
+			((HCC_64BYTE_CONTEXT(usbssp_data->hcc_params) + 1) * 8) *
+			((ctx->type == USBSSP_CTX_TYPE_INPUT) + ep_num + 1))
+	),
+	TP_fast_assign(
+		__entry->ctx_64 = HCC_64BYTE_CONTEXT(usbssp_data->hcc_params);
+		__entry->ctx_type = ctx->type;
+		__entry->ctx_dma = ctx->dma;
+		__entry->ctx_va = ctx->bytes;
+		__entry->slot_id = usbssp_data->slot_id;
+		__entry->ctx_ep_num = ep_num;
+		memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
+			((HCC_64BYTE_CONTEXT(usbssp_data->hcc_params) + 1) * 32) *
+			((ctx->type == USBSSP_CTX_TYPE_INPUT) + ep_num + 1));
+	),
+	TP_printk("\nctx_64=%d, ctx_type=%u, ctx_dma=@%llx, ctx_va=@%p",
+			__entry->ctx_64, __entry->ctx_type,
+			(unsigned long long) __entry->ctx_dma, __entry->ctx_va
+	)
+);
+
+DEFINE_EVENT(usbssp_log_ctx, usbssp_address_ctx,
+	TP_PROTO(struct usbssp_udc *usbssp_data, struct usbssp_container_ctx *ctx,
+		 unsigned int ep_num),
+	TP_ARGS(usbssp_data, ctx, ep_num)
+);
+
+
+DECLARE_EVENT_CLASS(usbssp_log_trb,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb),
+	TP_STRUCT__entry(
+		__field(u32, type)
+		__field(u32, field0)
+		__field(u32, field1)
+		__field(u32, field2)
+		__field(u32, field3)
+	),
+	TP_fast_assign(
+		__entry->type = ring->type;
+		__entry->field0 = le32_to_cpu(trb->field[0]);
+		__entry->field1 = le32_to_cpu(trb->field[1]);
+		__entry->field2 = le32_to_cpu(trb->field[2]);
+		__entry->field3 = le32_to_cpu(trb->field[3]);
+	),
+	TP_printk("%s: %s", usbssp_ring_type_string(__entry->type),
+			usbssp_decode_trb(__entry->field0, __entry->field1,
+					__entry->field2, __entry->field3)
+	)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_handle_event,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_handle_command,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_handle_transfer,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DEFINE_EVENT(usbssp_log_trb, usbssp_queue_trb,
+	TP_PROTO(struct usbssp_ring *ring, struct usbssp_generic_trb *trb),
+	TP_ARGS(ring, trb)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_priv_dev,
+	TP_PROTO(struct usbssp_device *priv_dev),
+	TP_ARGS(priv_dev),
+	TP_STRUCT__entry(
+		__field(struct usbssp_device *, priv_dev)
+		__field(struct usb_gadget *, gadget)
+		__field(unsigned long long, out_ctx)
+		__field(unsigned long long, in_ctx)
+		__field(u8, port_num)
+	),
+	TP_fast_assign(
+		__entry->priv_dev = priv_dev;
+		__entry->gadget = priv_dev->gadget;
+		__entry->in_ctx = (unsigned long long) priv_dev->in_ctx->dma;
+		__entry->out_ctx = (unsigned long long) priv_dev->out_ctx->dma;
+		__entry->port_num = priv_dev->port_num;
+	),
+	TP_printk("priv_dev %p gadget %p ctx %llx | %llx, port %d ",
+		__entry->priv_dev, __entry->gadget, __entry->in_ctx, __entry->out_ctx,
+		__entry->port_num
+	)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_alloc_priv_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_free_priv_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_setup_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_setup_addressable_priv_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DEFINE_EVENT(usbssp_log_priv_dev, usbssp_stop_device,
+	TP_PROTO(struct usbssp_device *vdev),
+	TP_ARGS(vdev)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_request,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request),
+	TP_STRUCT__entry(
+		__field(struct usb_request *, request)
+		__field(void *, buf)
+		__field(unsigned int, length)
+		__field(dma_addr_t, dma)
+		__field(struct scatterlist*, sg)
+		__field(unsigned int, num_sgs)
+		__field(unsigned int, num_mapped_sgs)
+		__field(unsigned int, stream_id)
+		__field(unsigned int, no_interrupt)
+		__field(unsigned int, zero)
+		__field(unsigned int, short_not_ok)
+		__field(unsigned int, dma_mapped)
+		__field(int, status)
+		__field(unsigned int, actual)
+	),
+	TP_fast_assign(
+		__entry->request = request;
+		__entry->buf = request->buf;
+		__entry->length = request->length;
+		__entry->dma = request->dma;
+		__entry->sg = request->sg;
+		__entry->num_sgs = request->num_sgs;
+		__entry->num_mapped_sgs = request->num_mapped_sgs;
+		__entry->stream_id = request->stream_id;
+		__entry->no_interrupt = request->no_interrupt;
+		__entry->zero = request->zero;
+		__entry->short_not_ok = request->short_not_ok;
+		__entry->dma_mapped = 0 /*request->dma_mapped*/;
+		__entry->status = request->status;
+		__entry->actual = request->actual;
+	),
+
+	TP_printk("req %p; buf %p, len %d, dma %llx, sg %p, num_sg %d, num_m_sg %d,"
+			"stream_id %d, no_int %x, zero %x, short_not_ok %x, dma_mapped %x, "
+			"status %d, actual %d",
+			__entry->request,
+			__entry->buf, __entry->length, __entry->dma, __entry->sg,
+			__entry->num_sgs, __entry->num_mapped_sgs, __entry->stream_id,
+			__entry->no_interrupt, __entry->zero, __entry->short_not_ok,
+			__entry->dma_mapped, __entry->status, __entry->actual
+		)
+
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_request_enqueue,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_request_giveback,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_request_dequeue,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_alloc_request,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DEFINE_EVENT(usbssp_log_request, usbssp_free_request,
+	TP_PROTO(struct usb_request *request),
+	TP_ARGS(request)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_ep_ctx,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx),
+	TP_STRUCT__entry(
+		__field(u32, info)
+		__field(u32, info2)
+		__field(u64, deq)
+		__field(u32, tx_info)
+	),
+	TP_fast_assign(
+		__entry->info = le32_to_cpu(ctx->ep_info);
+		__entry->info2 = le32_to_cpu(ctx->ep_info2);
+		__entry->deq = le64_to_cpu(ctx->deq);
+		__entry->tx_info = le32_to_cpu(ctx->tx_info);
+	),
+	TP_printk("%s", usbssp_decode_ep_context(__entry->info,
+		__entry->info2, __entry->deq, __entry->tx_info)
+	)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_remove_request,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_stop_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_set_deq_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_reset_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_ep_ctx, usbssp_handle_cmd_config_ep,
+	TP_PROTO(struct usbssp_ep_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_slot_ctx,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx),
+	TP_STRUCT__entry(
+		__field(u32, info)
+		__field(u32, info2)
+		__field(u32, int_target)
+		__field(u32, state)
+	),
+	TP_fast_assign(
+		__entry->info = le32_to_cpu(ctx->dev_info);
+		__entry->info2 = le32_to_cpu(ctx->dev_info2);
+		__entry->int_target = le64_to_cpu(ctx->int_target);
+		__entry->state = le32_to_cpu(ctx->dev_state);
+	),
+	TP_printk("%s", usbssp_decode_slot_context(__entry->info,
+			__entry->info2, __entry->int_target,
+			__entry->state)
+	)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_alloc_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_free_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_disable_slot,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_reset_device,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_setup_device_slot,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_addr_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_reset_dev,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_handle_cmd_set_deq,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DEFINE_EVENT(usbssp_log_slot_ctx, usbssp_configure_endpoint,
+	TP_PROTO(struct usbssp_slot_ctx *ctx),
+	TP_ARGS(ctx)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_ring,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring),
+	TP_STRUCT__entry(
+		__field(u32, type)
+		__field(void *, ring)
+		__field(dma_addr_t, enq)
+		__field(dma_addr_t, deq)
+		__field(dma_addr_t, enq_seg)
+		__field(dma_addr_t, deq_seg)
+		__field(unsigned int, num_segs)
+		__field(unsigned int, stream_id)
+		__field(unsigned int, cycle_state)
+		__field(unsigned int, num_trbs_free)
+		__field(unsigned int, bounce_buf_len)
+	),
+	TP_fast_assign(
+		__entry->ring = ring;
+		__entry->type = ring->type;
+		__entry->num_segs = ring->num_segs;
+		__entry->stream_id = ring->stream_id;
+		__entry->enq_seg = ring->enq_seg->dma;
+		__entry->deq_seg = ring->deq_seg->dma;
+		__entry->cycle_state = ring->cycle_state;
+		__entry->num_trbs_free = ring->num_trbs_free;
+		__entry->bounce_buf_len = ring->bounce_buf_len;
+		__entry->enq = usbssp_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
+		__entry->deq = usbssp_trb_virt_to_dma(ring->deq_seg, ring->dequeue);
+	),
+	TP_printk("%s %p: enq %pad(%pad) deq %pad(%pad) segs %d stream %d free_trbs %d bounce %d cycle %d",
+			usbssp_ring_type_string(__entry->type), __entry->ring,
+			&__entry->enq, &__entry->enq_seg,
+			&__entry->deq, &__entry->deq_seg,
+			__entry->num_segs,
+			__entry->stream_id,
+			__entry->num_trbs_free,
+			__entry->bounce_buf_len,
+			__entry->cycle_state
+		)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_ring_alloc,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_ring_free,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_ring_expansion,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_inc_enq,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DEFINE_EVENT(usbssp_log_ring, usbssp_inc_deq,
+	TP_PROTO(struct usbssp_ring *ring),
+	TP_ARGS(ring)
+);
+
+DECLARE_EVENT_CLASS(usbssp_log_portsc,
+		TP_PROTO(u32 portnum, u32 portsc),
+		TP_ARGS(portnum, portsc),
+		TP_STRUCT__entry(
+				__field(u32, portnum)
+				__field(u32, portsc)
+				),
+		TP_fast_assign(
+				__entry->portnum = portnum;
+				__entry->portsc = portsc;
+				),
+		TP_printk("port-%d: %s",
+			__entry->portnum,
+			usbssp_decode_portsc(__entry->portsc)
+			)
+);
+
+DEFINE_EVENT(usbssp_log_portsc, usbssp_handle_port_status,
+		TP_PROTO(u32 portnum, u32 portsc),
+		TP_ARGS(portnum, portsc)
+);
+
+#endif /* __USBSSP_TRACE_H */
+/* this part must be outside header guard */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE gadget-trace
+
+#include <trace/define_trace.h>

  parent reply	other threads:[~2018-07-19 18:01 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-19 17:57 [PATCH 00/31] Introduced new Cadence USBSSP DRD Driver Pawel Laszczak
2018-07-19 17:57 ` [PATCH 01/31] usb: usbssp: Defined register maps and other useful structures Pawel Laszczak
2018-07-19 17:57   ` [01/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 02/31] usb: usbssp: Added some decoding functions Pawel Laszczak
2018-07-19 17:57   ` [02/31] " Pawel Laszczak
2018-09-10 18:18   ` [PATCH 02/31] " Greg Kroah-Hartman
2018-09-10 18:18     ` [02/31] " Greg Kroah-Hartman
2018-09-11  5:48     ` [PATCH 02/31] " Felipe Balbi
2018-09-11  5:48       ` [02/31] " Felipe Balbi
2018-09-11  8:12       ` [PATCH 02/31] " Greg Kroah-Hartman
2018-09-11  8:12         ` [02/31] " Greg Kroah-Hartman
2018-09-11  9:01         ` [PATCH 02/31] " Pawel Laszczak
2018-09-11  9:01           ` [02/31] " Pawel Laszczak
2018-07-19 17:57 ` Pawel Laszczak [this message]
2018-07-19 17:57   ` [03/31] usb: usbssp: Add trace events used in driver Pawel Laszczak
2018-07-19 17:57 ` [PATCH 04/31] usb: usbssp: Added USBSSP platform driver Pawel Laszczak
2018-07-19 17:57   ` [04/31] " Pawel Laszczak
2018-08-01 12:24   ` [PATCH 04/31] " Roger Quadros
2018-08-01 12:24     ` [04/31] " Roger Quadros
2018-08-02  6:25     ` [PATCH 04/31] " Pawel Laszczak
2018-08-02  6:25       ` [04/31] " Pawel Laszczak
2018-08-02 13:28       ` [PATCH 04/31] " Roger Quadros
2018-08-02 13:28         ` [04/31] " Roger Quadros
2018-07-19 17:57 ` [PATCH 05/31] usb: usbssp: Added first part of initialization sequence Pawel Laszczak
2018-07-19 17:57   ` [05/31] " Pawel Laszczak
2018-08-03 10:17   ` [PATCH 05/31] " Roger Quadros
2018-08-03 10:17     ` [05/31] " Roger Quadros
2018-08-06  8:57     ` [PATCH 05/31] " Pawel Laszczak
2018-08-06  8:57       ` [05/31] " Pawel Laszczak
2018-08-06 10:33       ` [PATCH 05/31] " Roger Quadros
2018-08-06 10:33         ` [05/31] " Roger Quadros
2018-08-06 12:03         ` [PATCH 05/31] " Pawel Laszczak
2018-08-06 12:03           ` [05/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 06/31] usb: usbssp: added template functions used by upper layer Pawel Laszczak
2018-07-19 17:57   ` [06/31] " Pawel Laszczak
2018-08-03 10:42   ` [PATCH 06/31] " Roger Quadros
2018-08-03 10:42     ` [06/31] " Roger Quadros
2018-08-04  6:37     ` [PATCH 06/31] " Pawel Laszczak
2018-08-04  6:37       ` [06/31] " Pawel Laszczak
2018-08-06  8:57       ` [PATCH 06/31] " Roger Quadros
2018-08-06  8:57         ` [06/31] " Roger Quadros
2018-08-06 11:40         ` [PATCH 06/31] " Pawel Laszczak
2018-08-06 11:40           ` [06/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 07/31] usb: usbssp: Initialization - added usbssp_mem_init Pawel Laszczak
2018-07-19 17:57   ` [07/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 08/31] usb: usbssp: Added ring and segment handling functions Pawel Laszczak
2018-07-19 17:57   ` [08/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 09/31] usb: usbssp: add implementation of usbssp_mem_cleanup Pawel Laszczak
2018-07-19 17:57   ` [09/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 10/31] usb: usbssp: added usbssp_trb_in_td function Pawel Laszczak
2018-07-19 17:57   ` [10/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 11/31] usb: usbssp: added function for stopping driver Pawel Laszczak
2018-07-19 17:57   ` [11/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 12/31] usb: usbssp: added functions for queuing commands Pawel Laszczak
2018-07-19 17:57   ` [12/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 13/31] usb: usbssp: addec procedure for handlin Port Status Change events Pawel Laszczak
2018-07-19 17:57   ` [13/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 14/31] usb: usbssp: added procedure handling command completion events Pawel Laszczak
2018-07-19 17:57   ` [14/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 15/31] usb: usbssp: added device controller error, transfer and SETUP completion event Pawel Laszczak
2018-07-19 17:57   ` [15/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 16/31] usb: usbssp: added connect/disconnect procedures Pawel Laszczak
2018-07-19 17:57   ` [16/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 17/31] usb: usbssp: added implementation of usbssp_halt_endpoint function Pawel Laszczak
2018-07-19 17:57   ` [17/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 18/31] usb: usbssp: added handling of Port Reset event Pawel Laszczak
2018-07-19 17:57   ` [18/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 19/31] usb: usbssp: added support for USB enumeration process Pawel Laszczak
2018-07-19 17:57   ` [19/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 20/31] usb: usbssp: added queuing procedure for control transfer Pawel Laszczak
2018-07-19 17:57   ` [20/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 21/31] usb: usbssp: added queuing procedure for BULK and INT transfer Pawel Laszczak
2018-07-19 17:57   ` [21/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 22/31] usb: usbssp: added procedure removing request from transfer ring Pawel Laszczak
2018-07-19 17:57   ` [22/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 23/31] usb: usbssp: added implementation of transfer events Pawel Laszczak
2018-07-19 17:57   ` [23/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 24/31] usb: usbssp: added detecting command timeout Pawel Laszczak
2018-07-19 17:57   ` [24/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 25/31] usb: usbssp: added implementation of usbssp interface Pawel Laszczak
2018-07-19 17:57   ` [25/31] " Pawel Laszczak
2018-07-19 17:57 ` [PATCH 26/31] usb: usbssp: added endpoint configuration functionality Pawel Laszczak
2018-07-19 17:57   ` [26/31] " Pawel Laszczak
2018-07-19 17:58 ` [PATCH 27/31] usb: usbssp: implements usbssp_gadget_ep_enable function Pawel Laszczak
2018-07-19 17:58   ` [27/31] " Pawel Laszczak
2018-07-19 17:58 ` [PATCH 28/31] usb: usbssp: implemented usbssp_gadget_ep_disable function Pawel Laszczak
2018-07-19 17:58   ` [28/31] " Pawel Laszczak
2018-07-19 17:58 ` [PATCH 29/31] usb: usbssp: added support for LPM Pawel Laszczak
2018-07-19 17:58   ` [29/31] " Pawel Laszczak
2018-07-19 17:58 ` [PATCH 30/31] usb: usbssp: added support for TEST_MODE Pawel Laszczak
2018-07-19 17:58   ` [30/31] " Pawel Laszczak
2018-07-19 17:58 ` [PATCH 31/31] usb: usbssp: add pci to platform driver wrapper Pawel Laszczak
2018-07-19 17:58   ` [31/31] " Pawel Laszczak
2018-08-01 11:27 ` [PATCH 00/31] Introduced new Cadence USBSSP DRD Driver Roger Quadros
2018-08-02  4:26   ` Pawel Laszczak
2018-08-02 13:24     ` Roger Quadros
2018-09-10 18:21     ` Greg Kroah-Hartman
2018-08-17 21:05 ` Bin Liu
2018-08-21 14:50   ` Pawel Laszczak
2018-09-10 18:20     ` Greg Kroah-Hartman
2018-09-10 18:16 ` Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2018-07-12  5:46 Pawel Laszczak
2018-07-12  5:47 ` [PATCH 03/31] usb: usbssp: Add trace events used in driver Pawel Laszczak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1532023084-28083-4-git-send-email-pawell@cadence.com \
    --to=pawell@cadence.com \
    --cc=adouglas@cadence.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=ltyrala@cadence.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.