/* Parameters of PTT trace DMA part. */ #define HISI_PTT_TRACE_DMA_IRQ 0 #define HISI_PTT_TRACE_BUF_CNT 4 #define HISI_PTT_TRACE_BUF_SIZE SZ_4M #define HISI_PTT_TRACE_TOTAL_BUF_SIZE (HISI_PTT_TRACE_BUF_SIZE * \
HISI_PTT_TRACE_BUF_CNT) /* Wait time for hardware DMA to reset */ #define HISI_PTT_RESET_TIMEOUT_US 10UL #define HISI_PTT_RESET_POLL_INTERVAL_US 1UL /* Poll timeout and interval for waiting hardware work to finish */ #define HISI_PTT_WAIT_TUNE_TIMEOUT_US 1000000UL #define HISI_PTT_WAIT_TRACE_TIMEOUT_US 100UL #define HISI_PTT_WAIT_POLL_INTERVAL_US 10UL
/* FIFO size for dynamically updating the PTT trace filter list. */ #define HISI_PTT_FILTER_UPDATE_FIFO_SIZE 16 /* Delay time for filter updating work */ #define HISI_PTT_WORK_DELAY_MS 100UL
/** * struct hisi_ptt_tune_desc - Describe tune event for PTT tune * @hisi_ptt: PTT device this tune event belongs to * @name: name of this event * @event_code: code of the event
*/ struct hisi_ptt_tune_desc { struct hisi_ptt *hisi_ptt; constchar *name;
u32 event_code;
};
/** * struct hisi_ptt_dma_buffer - Describe a single trace buffer of PTT trace. * The detail of the data format is described * in the documentation of PTT device. * @dma: DMA address of this buffer visible to the device * @addr: virtual address of this buffer visible to the cpu
*/ struct hisi_ptt_dma_buffer {
dma_addr_t dma; void *addr;
};
/** * struct hisi_ptt_trace_ctrl - Control and status of PTT trace * @trace_buf: array of the trace buffers for holding the trace data. * the length will be HISI_PTT_TRACE_BUF_CNT. * @handle: perf output handle of current trace session * @buf_index: the index of current using trace buffer * @on_cpu: current tracing cpu * @started: current trace status, true for started * @is_port: whether we're tracing root port or not * @direction: direction of the TLP headers to trace * @filter: filter value for tracing the TLP headers * @format: format of the TLP headers to trace * @type: type of the TLP headers to trace
*/ struct hisi_ptt_trace_ctrl { struct hisi_ptt_dma_buffer *trace_buf; struct perf_output_handle handle;
u32 buf_index; int on_cpu; bool started; bool is_port;
u32 direction:2;
u32 filter:16;
u32 format:1;
u32 type:4;
};
/* * sysfs attribute group name for root port filters and requester filters: * /sys/devices/hisi_ptt<sicl_id>_<core_id>/root_port_filters * and * /sys/devices/hisi_ptt<sicl_id>_<core_id>/requester_filters
*/ #define HISI_PTT_RP_FILTERS_GRP_NAME "root_port_filters" #define HISI_PTT_REQ_FILTERS_GRP_NAME "requester_filters"
/** * struct hisi_ptt_filter_desc - Descriptor of the PTT trace filter * @attr: sysfs attribute of this filter * @list: entry of this descriptor in the filter list * @is_port: the PCI device of the filter is a Root Port or not * @name: name of this filter, same as the name of the related PCI device * @devid: the PCI device's devid of the filter
*/ struct hisi_ptt_filter_desc { struct device_attribute attr; struct list_head list; bool is_port; char *name;
u16 devid;
};
/** * struct hisi_ptt_filter_update_info - Information for PTT filter updating * @is_port: the PCI device to update is a Root Port or not * @is_add: adding to the filter or not * @devid: the PCI device's devid of the filter
*/ struct hisi_ptt_filter_update_info { bool is_port; bool is_add;
u16 devid;
};
/** * struct hisi_ptt_pmu_buf - Descriptor of the AUX buffer of PTT trace * @length: size of the AUX buffer * @nr_pages: number of pages of the AUX buffer * @base: start address of AUX buffer * @pos: position in the AUX buffer to commit traced data
*/ struct hisi_ptt_pmu_buf {
size_t length; int nr_pages; void *base; long pos;
};
/** * struct hisi_ptt - Per PTT device data * @trace_ctrl: the control information of PTT trace * @hisi_ptt_nb: dynamic filter update notifier * @hotplug_node: node for register cpu hotplug event * @hisi_ptt_pmu: the pum device of trace * @iobase: base IO address of the device * @pdev: pci_dev of this PTT device * @tune_lock: lock to serialize the tune process * @pmu_lock: lock to serialize the perf process * @trace_irq: interrupt number used by trace * @upper_bdf: the upper BDF range of the PCI devices managed by this PTT device * @lower_bdf: the lower BDF range of the PCI devices managed by this PTT device * @port_filters: the filter list of root ports * @req_filters: the filter list of requester ID * @filter_lock: lock to protect the filters * @sysfs_inited: whether the filters' sysfs entries has been initialized * @port_mask: port mask of the managed root ports * @work: delayed work for filter updating * @filter_update_lock: spinlock to protect the filter update fifo * @filter_update_fifo: fifo of the filters waiting to update the filter list
*/ struct hisi_ptt { struct hisi_ptt_trace_ctrl trace_ctrl; struct notifier_block hisi_ptt_nb; struct hlist_node hotplug_node; struct pmu hisi_ptt_pmu; void __iomem *iobase; struct pci_dev *pdev; struct mutex tune_lock;
spinlock_t pmu_lock; int trace_irq;
u32 upper_bdf;
u32 lower_bdf;
/* * The trace TLP headers can either be filtered by certain * root port, or by the requester ID. Organize the filters * by @port_filters and @req_filters here. The mask of all * the valid ports is also cached for doing sanity check * of user input.
*/ struct list_head port_filters; struct list_head req_filters; struct mutex filter_lock; bool sysfs_inited;
u16 port_mask;
/* * We use a delayed work here to avoid indefinitely waiting for * the hisi_ptt->mutex which protecting the filter list. The * work will be delayed only if the mutex can not be held, * otherwise no delay will be applied.
*/ struct delayed_work work;
spinlock_t filter_update_lock;
DECLARE_KFIFO(filter_update_kfifo, struct hisi_ptt_filter_update_info,
HISI_PTT_FILTER_UPDATE_FIFO_SIZE);
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.