mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 13:05:10 +07:00
d850c16583
commit44a182b9d1
("xhci: Fix use-after-free in xhci_free_virt_device") set dev->udev pointer to NULL in xhci_free_dev(), it will cause kernel panic in trace_xhci_free_virt_device. This patch reimplement the trace function trace_xhci_free_virt_device, remove dev->udev dereference and added more useful parameters to show in the trace function,it also makes sure dev->udev is not NULL before calling trace_xhci_free_virt_device. This issue happened when xhci-hcd trace is enabled and USB devices hot plug test. Original use-after-free patch went to stable so this needs so be applied there as well. [ 1092.022457] usb 2-4: USB disconnect, device number 6 [ 1092.092772] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 [ 1092.101694] PGD 0 P4D 0 [ 1092.104601] Oops: 0000 [#1] SMP [ 1092.207734] Workqueue: usb_hub_wq hub_event [ 1092.212507] RIP: 0010:trace_event_raw_event_xhci_log_virt_dev+0x6c/0xf0 [ 1092.220050] RSP: 0018:ffff8c252e883d28 EFLAGS: 00010086 [ 1092.226024] RAX: ffff8c24af86fa84 RBX: 0000000000000003 RCX: ffff8c25255c2a01 [ 1092.234130] RDX: 0000000000000000 RSI: 00000000aef55009 RDI: ffff8c252e883d28 [ 1092.242242] RBP: ffff8c252550e2c0 R08: ffff8c24af86fa84 R09: 0000000000000a70 [ 1092.250364] R10: 0000000000000a70 R11: 0000000000000000 R12: ffff8c251f21a000 [ 1092.258468] R13: 000000000000000c R14: ffff8c251f21a000 R15: ffff8c251f432f60 [ 1092.266572] FS: 0000000000000000(0000) GS:ffff8c252e880000(0000) knlGS:0000000000000000 [ 1092.275757] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1092.282281] CR2: 0000000000000000 CR3: 0000000154209001 CR4: 00000000003606e0 [ 1092.290384] Call Trace: [ 1092.293156] <IRQ> [ 1092.295439] xhci_free_virt_device.part.34+0x182/0x1a0 [ 1092.301288] handle_cmd_completion+0x7ac/0xfa0 [ 1092.306336] ? trace_event_raw_event_xhci_log_trb+0x6e/0xa0 [ 1092.312661] xhci_irq+0x3e8/0x1f60 [ 1092.316524] __handle_irq_event_percpu+0x75/0x180 [ 1092.321876] handle_irq_event_percpu+0x20/0x50 [ 1092.326922] handle_irq_event+0x36/0x60 [ 1092.331273] handle_edge_irq+0x6d/0x180 [ 1092.335644] handle_irq+0x16/0x20 [ 1092.339417] do_IRQ+0x41/0xc0 [ 1092.342782] common_interrupt+0xf/0xf [ 1092.346955] </IRQ> Fixes:44a182b9d1
("xhci: Fix use-after-free in xhci_free_virt_device") Cc: <stable@vger.kernel.org> Signed-off-by: Zhengjun Xing <zhengjun.xing@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
587 lines
15 KiB
C
587 lines
15 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* xHCI host controller driver
|
|
*
|
|
* Copyright (C) 2013 Xenia Ragiadakou
|
|
*
|
|
* Author: Xenia Ragiadakou
|
|
* Email : burzalodowa@gmail.com
|
|
*/
|
|
|
|
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM xhci-hcd
|
|
|
|
/*
|
|
* 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 xhci_hcd
|
|
|
|
#if !defined(__XHCI_TRACE_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define __XHCI_TRACE_H
|
|
|
|
#include <linux/tracepoint.h>
|
|
#include "xhci.h"
|
|
#include "xhci-dbgcap.h"
|
|
|
|
#define XHCI_MSG_MAX 500
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_msg,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf),
|
|
TP_STRUCT__entry(__dynamic_array(char, msg, XHCI_MSG_MAX)),
|
|
TP_fast_assign(
|
|
vsnprintf(__get_str(msg), XHCI_MSG_MAX, vaf->fmt, *vaf->va);
|
|
),
|
|
TP_printk("%s", __get_str(msg))
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_address,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_context_change,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_quirks,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_reset_ep,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_cancel_urb,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_init,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_msg, xhci_dbg_ring_expansion,
|
|
TP_PROTO(struct va_format *vaf),
|
|
TP_ARGS(vaf)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_ctx,
|
|
TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
|
|
unsigned int ep_num),
|
|
TP_ARGS(xhci, ctx, ep_num),
|
|
TP_STRUCT__entry(
|
|
__field(int, ctx_64)
|
|
__field(unsigned, ctx_type)
|
|
__field(dma_addr_t, ctx_dma)
|
|
__field(u8 *, ctx_va)
|
|
__field(unsigned, ctx_ep_num)
|
|
__field(int, slot_id)
|
|
__dynamic_array(u32, ctx_data,
|
|
((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 8) *
|
|
((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1))
|
|
),
|
|
TP_fast_assign(
|
|
struct usb_device *udev;
|
|
|
|
udev = to_usb_device(xhci_to_hcd(xhci)->self.controller);
|
|
__entry->ctx_64 = HCC_64BYTE_CONTEXT(xhci->hcc_params);
|
|
__entry->ctx_type = ctx->type;
|
|
__entry->ctx_dma = ctx->dma;
|
|
__entry->ctx_va = ctx->bytes;
|
|
__entry->slot_id = udev->slot_id;
|
|
__entry->ctx_ep_num = ep_num;
|
|
memcpy(__get_dynamic_array(ctx_data), ctx->bytes,
|
|
((HCC_64BYTE_CONTEXT(xhci->hcc_params) + 1) * 32) *
|
|
((ctx->type == XHCI_CTX_TYPE_INPUT) + ep_num + 1));
|
|
),
|
|
TP_printk("ctx_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(xhci_log_ctx, xhci_address_ctx,
|
|
TP_PROTO(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx,
|
|
unsigned int ep_num),
|
|
TP_ARGS(xhci, ctx, ep_num)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_trb,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_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", xhci_ring_type_string(__entry->type),
|
|
xhci_decode_trb(__entry->field0, __entry->field1,
|
|
__entry->field2, __entry->field3)
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_handle_event,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_handle_command,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_handle_transfer,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_queue_trb,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_event,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_dbc_handle_transfer,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_trb, xhci_dbc_gadget_ep_queue,
|
|
TP_PROTO(struct xhci_ring *ring, struct xhci_generic_trb *trb),
|
|
TP_ARGS(ring, trb)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_free_virt_dev,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev),
|
|
TP_STRUCT__entry(
|
|
__field(void *, vdev)
|
|
__field(unsigned long long, out_ctx)
|
|
__field(unsigned long long, in_ctx)
|
|
__field(u8, fake_port)
|
|
__field(u8, real_port)
|
|
__field(u16, current_mel)
|
|
|
|
),
|
|
TP_fast_assign(
|
|
__entry->vdev = vdev;
|
|
__entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
|
|
__entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
|
|
__entry->fake_port = (u8) vdev->fake_port;
|
|
__entry->real_port = (u8) vdev->real_port;
|
|
__entry->current_mel = (u16) vdev->current_mel;
|
|
),
|
|
TP_printk("vdev %p ctx %llx | %llx fake_port %d real_port %d current_mel %d",
|
|
__entry->vdev, __entry->in_ctx, __entry->out_ctx,
|
|
__entry->fake_port, __entry->real_port, __entry->current_mel
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_free_virt_dev, xhci_free_virt_device,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_virt_dev,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev),
|
|
TP_STRUCT__entry(
|
|
__field(void *, vdev)
|
|
__field(unsigned long long, out_ctx)
|
|
__field(unsigned long long, in_ctx)
|
|
__field(int, devnum)
|
|
__field(int, state)
|
|
__field(int, speed)
|
|
__field(u8, portnum)
|
|
__field(u8, level)
|
|
__field(int, slot_id)
|
|
),
|
|
TP_fast_assign(
|
|
__entry->vdev = vdev;
|
|
__entry->in_ctx = (unsigned long long) vdev->in_ctx->dma;
|
|
__entry->out_ctx = (unsigned long long) vdev->out_ctx->dma;
|
|
__entry->devnum = vdev->udev->devnum;
|
|
__entry->state = vdev->udev->state;
|
|
__entry->speed = vdev->udev->speed;
|
|
__entry->portnum = vdev->udev->portnum;
|
|
__entry->level = vdev->udev->level;
|
|
__entry->slot_id = vdev->udev->slot_id;
|
|
),
|
|
TP_printk("vdev %p ctx %llx | %llx num %d state %d speed %d port %d level %d slot %d",
|
|
__entry->vdev, __entry->in_ctx, __entry->out_ctx,
|
|
__entry->devnum, __entry->state, __entry->speed,
|
|
__entry->portnum, __entry->level, __entry->slot_id
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_virt_dev, xhci_alloc_virt_device,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_device,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_virt_dev, xhci_setup_addressable_virt_device,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_virt_dev, xhci_stop_device,
|
|
TP_PROTO(struct xhci_virt_device *vdev),
|
|
TP_ARGS(vdev)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_urb,
|
|
TP_PROTO(struct urb *urb),
|
|
TP_ARGS(urb),
|
|
TP_STRUCT__entry(
|
|
__field(void *, urb)
|
|
__field(unsigned int, pipe)
|
|
__field(unsigned int, stream)
|
|
__field(int, status)
|
|
__field(unsigned int, flags)
|
|
__field(int, num_mapped_sgs)
|
|
__field(int, num_sgs)
|
|
__field(int, length)
|
|
__field(int, actual)
|
|
__field(int, epnum)
|
|
__field(int, dir_in)
|
|
__field(int, type)
|
|
__field(int, slot_id)
|
|
),
|
|
TP_fast_assign(
|
|
__entry->urb = urb;
|
|
__entry->pipe = urb->pipe;
|
|
__entry->stream = urb->stream_id;
|
|
__entry->status = urb->status;
|
|
__entry->flags = urb->transfer_flags;
|
|
__entry->num_mapped_sgs = urb->num_mapped_sgs;
|
|
__entry->num_sgs = urb->num_sgs;
|
|
__entry->length = urb->transfer_buffer_length;
|
|
__entry->actual = urb->actual_length;
|
|
__entry->epnum = usb_endpoint_num(&urb->ep->desc);
|
|
__entry->dir_in = usb_endpoint_dir_in(&urb->ep->desc);
|
|
__entry->type = usb_endpoint_type(&urb->ep->desc);
|
|
__entry->slot_id = urb->dev->slot_id;
|
|
),
|
|
TP_printk("ep%d%s-%s: urb %p pipe %u slot %d length %d/%d sgs %d/%d stream %d flags %08x",
|
|
__entry->epnum, __entry->dir_in ? "in" : "out",
|
|
({ char *s;
|
|
switch (__entry->type) {
|
|
case USB_ENDPOINT_XFER_INT:
|
|
s = "intr";
|
|
break;
|
|
case USB_ENDPOINT_XFER_CONTROL:
|
|
s = "control";
|
|
break;
|
|
case USB_ENDPOINT_XFER_BULK:
|
|
s = "bulk";
|
|
break;
|
|
case USB_ENDPOINT_XFER_ISOC:
|
|
s = "isoc";
|
|
break;
|
|
default:
|
|
s = "UNKNOWN";
|
|
} s; }), __entry->urb, __entry->pipe, __entry->slot_id,
|
|
__entry->actual, __entry->length, __entry->num_mapped_sgs,
|
|
__entry->num_sgs, __entry->stream, __entry->flags
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_urb, xhci_urb_enqueue,
|
|
TP_PROTO(struct urb *urb),
|
|
TP_ARGS(urb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_urb, xhci_urb_giveback,
|
|
TP_PROTO(struct urb *urb),
|
|
TP_ARGS(urb)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_urb, xhci_urb_dequeue,
|
|
TP_PROTO(struct urb *urb),
|
|
TP_ARGS(urb)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_ep_ctx,
|
|
TP_PROTO(struct xhci_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", xhci_decode_ep_context(__entry->info,
|
|
__entry->info2, __entry->deq, __entry->tx_info)
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_stop_ep,
|
|
TP_PROTO(struct xhci_ep_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_set_deq_ep,
|
|
TP_PROTO(struct xhci_ep_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_reset_ep,
|
|
TP_PROTO(struct xhci_ep_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ep_ctx, xhci_handle_cmd_config_ep,
|
|
TP_PROTO(struct xhci_ep_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_slot_ctx,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx),
|
|
TP_STRUCT__entry(
|
|
__field(u32, info)
|
|
__field(u32, info2)
|
|
__field(u32, tt_info)
|
|
__field(u32, state)
|
|
),
|
|
TP_fast_assign(
|
|
__entry->info = le32_to_cpu(ctx->dev_info);
|
|
__entry->info2 = le32_to_cpu(ctx->dev_info2);
|
|
__entry->tt_info = le64_to_cpu(ctx->tt_info);
|
|
__entry->state = le32_to_cpu(ctx->dev_state);
|
|
),
|
|
TP_printk("%s", xhci_decode_slot_context(__entry->info,
|
|
__entry->info2, __entry->tt_info,
|
|
__entry->state)
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_alloc_dev,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_free_dev,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_disable_slot,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_discover_or_reset_device,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_setup_device_slot,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_addr_dev,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_reset_dev,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_handle_cmd_set_deq,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_slot_ctx, xhci_configure_endpoint,
|
|
TP_PROTO(struct xhci_slot_ctx *ctx),
|
|
TP_ARGS(ctx)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_log_ring,
|
|
TP_PROTO(struct xhci_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 = xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue);
|
|
__entry->deq = xhci_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",
|
|
xhci_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(xhci_log_ring, xhci_ring_alloc,
|
|
TP_PROTO(struct xhci_ring *ring),
|
|
TP_ARGS(ring)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ring, xhci_ring_free,
|
|
TP_PROTO(struct xhci_ring *ring),
|
|
TP_ARGS(ring)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ring, xhci_ring_expansion,
|
|
TP_PROTO(struct xhci_ring *ring),
|
|
TP_ARGS(ring)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ring, xhci_inc_enq,
|
|
TP_PROTO(struct xhci_ring *ring),
|
|
TP_ARGS(ring)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_ring, xhci_inc_deq,
|
|
TP_PROTO(struct xhci_ring *ring),
|
|
TP_ARGS(ring)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_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,
|
|
xhci_decode_portsc(__entry->portsc)
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_portsc, xhci_handle_port_status,
|
|
TP_PROTO(u32 portnum, u32 portsc),
|
|
TP_ARGS(portnum, portsc)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_portsc, xhci_get_port_status,
|
|
TP_PROTO(u32 portnum, u32 portsc),
|
|
TP_ARGS(portnum, portsc)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_log_portsc, xhci_hub_status_data,
|
|
TP_PROTO(u32 portnum, u32 portsc),
|
|
TP_ARGS(portnum, portsc)
|
|
);
|
|
|
|
DECLARE_EVENT_CLASS(xhci_dbc_log_request,
|
|
TP_PROTO(struct dbc_request *req),
|
|
TP_ARGS(req),
|
|
TP_STRUCT__entry(
|
|
__field(struct dbc_request *, req)
|
|
__field(bool, dir)
|
|
__field(unsigned int, actual)
|
|
__field(unsigned int, length)
|
|
__field(int, status)
|
|
),
|
|
TP_fast_assign(
|
|
__entry->req = req;
|
|
__entry->dir = req->direction;
|
|
__entry->actual = req->actual;
|
|
__entry->length = req->length;
|
|
__entry->status = req->status;
|
|
),
|
|
TP_printk("%s: req %p length %u/%u ==> %d",
|
|
__entry->dir ? "bulk-in" : "bulk-out",
|
|
__entry->req, __entry->actual,
|
|
__entry->length, __entry->status
|
|
)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_alloc_request,
|
|
TP_PROTO(struct dbc_request *req),
|
|
TP_ARGS(req)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_free_request,
|
|
TP_PROTO(struct dbc_request *req),
|
|
TP_ARGS(req)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_queue_request,
|
|
TP_PROTO(struct dbc_request *req),
|
|
TP_ARGS(req)
|
|
);
|
|
|
|
DEFINE_EVENT(xhci_dbc_log_request, xhci_dbc_giveback_request,
|
|
TP_PROTO(struct dbc_request *req),
|
|
TP_ARGS(req)
|
|
);
|
|
#endif /* __XHCI_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 xhci-trace
|
|
|
|
#include <trace/define_trace.h>
|