/* * Bit positions of registers that are defined above, in the sysreg.h style * of _MASK for multi bit fields and BIT() for single bits.
*/ #define TRCIDR0_INSTP0_MASK GENMASK(2, 1) #define TRCIDR0_TRCBB BIT(5) #define TRCIDR0_TRCCOND BIT(6) #define TRCIDR0_TRCCCI BIT(7) #define TRCIDR0_RETSTACK BIT(9) #define TRCIDR0_NUMEVENT_MASK GENMASK(11, 10) #define TRCIDR0_QFILT BIT(14) #define TRCIDR0_QSUPP_MASK GENMASK(16, 15) #define TRCIDR0_TSSIZE_MASK GENMASK(28, 24)
/* * System instructions to access ETM registers. * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions
*/ #define ETM4x_OFFSET_TO_REG(x) ((x) >> 2)
/* List of registers accessible via System instructions */ #define ETM4x_ONLY_SYSREG_LIST(op, val) \
CASE_##op((val), TRCPROCSELR) \
CASE_##op((val), TRCOSLAR)
/* * TRCOSLSR.OSLM advertises the OS Lock model. * OSLM[2:0] = TRCOSLSR[4:3,0] * * 0b000 - Trace OS Lock is not implemented. * 0b010 - Trace OS Lock is implemented. * 0b100 - Trace OS Lock is not implemented, unit is controlled by PE OS Lock.
*/ #define ETM_OSLOCK_NI 0b000 #define ETM_OSLOCK_PRESENT 0b010 #define ETM_OSLOCK_PE 0b100
/* PowerDown Control Register bits */ #define TRCPDCR_PU BIT(3)
#define TRCACATR_EXLEVEL_SHIFT 8
/* * Exception level mask for Secure and Non-Secure ELs. * ETM defines the bits for EL control (e.g, TRVICTLR, TRCACTRn). * The Secure and Non-Secure ELs are always to gether. * Non-secure EL3 is never implemented. * We use the following generic mask as they appear in different * registers and this can be shifted for the appropriate * fields.
*/ #define ETM_EXLEVEL_S_APP BIT(0) /* Secure EL0 */ #define ETM_EXLEVEL_S_OS BIT(1) /* Secure EL1 */ #define ETM_EXLEVEL_S_HYP BIT(2) /* Secure EL2 */ #define ETM_EXLEVEL_S_MON BIT(3) /* Secure EL3/Monitor */ #define ETM_EXLEVEL_NS_APP BIT(4) /* NonSecure EL0 */ #define ETM_EXLEVEL_NS_OS BIT(5) /* NonSecure EL1 */ #define ETM_EXLEVEL_NS_HYP BIT(6) /* NonSecure EL2 */
/* access level controls in TRCACATRn */ #define TRCACATR_EXLEVEL_SHIFT 8
/* * Driver representation of the ETM architecture. * The version of an ETM component can be detected from * * TRCDEVARCH - CoreSight architected register * - Bits[15:12] - Major version * - Bits[19:16] - Minor version * * We must rely only on TRCDEVARCH for the version information. Even though, * TRCIDR1 also provides the architecture version, it is a "Trace" register * and as such must be accessed only with Trace power domain ON. This may * not be available at probe time. * * Now to make certain decisions easier based on the version * we use an internal representation of the version in the * driver, as follows : * * ETM_ARCH_VERSION[7:0], where : * Bits[7:4] - Major version * Bits[3:0] - Minro version
*/ #define ETM_ARCH_VERSION(major, minor) \
((((major) & 0xfU) << 4) | (((minor) & 0xfU))) #define ETM_ARCH_MAJOR_VERSION(arch) (((arch) >> 4) & 0xfU) #define ETM_ARCH_MINOR_VERSION(arch) ((arch) & 0xfU)
/** * struct etmv4_config - configuration information related to an ETMv4 * @mode: Controls various modes supported by this ETM. * @pe_sel: Controls which PE to trace. * @cfg: Controls the tracing options. * @eventctrl0: Controls the tracing of arbitrary events. * @eventctrl1: Controls the behavior of the events that @event_ctrl0 selects. * @stallctl: If functionality that prevents trace unit buffer overflows * is available. * @ts_ctrl: Controls the insertion of global timestamps in the * trace streams. * @syncfreq: Controls how often trace synchronization requests occur. * the TRCCCCTLR register. * @ccctlr: Sets the threshold value for cycle counting. * @vinst_ctrl: Controls instruction trace filtering. * @viiectlr: Set or read, the address range comparators. * @vissctlr: Set, or read, the single address comparators that control the * ViewInst start-stop logic. * @vipcssctlr: Set, or read, which PE comparator inputs can control the * ViewInst start-stop logic. * @seq_idx: Sequencor index selector. * @seq_ctrl: Control for the sequencer state transition control register. * @seq_rst: Moves the sequencer to state 0 when a programmed event occurs. * @seq_state: Set, or read the sequencer state. * @cntr_idx: Counter index seletor. * @cntrldvr: Sets or returns the reload count value for a counter. * @cntr_ctrl: Controls the operation of a counter. * @cntr_val: Sets or returns the value for a counter. * @res_idx: Resource index selector. * @res_ctrl: Controls the selection of the resources in the trace unit. * @ss_idx: Single-shot index selector. * @ss_ctrl: Controls the corresponding single-shot comparator resource. * @ss_status: The status of the corresponding single-shot comparator. * @ss_pe_cmp: Selects the PE comparator inputs for Single-shot control. * @addr_idx: Address comparator index selector. * @addr_val: Value for address comparator. * @addr_acc: Address comparator access type. * @addr_type: Current status of the comparator register. * @ctxid_idx: Context ID index selector. * @ctxid_pid: Value of the context ID comparator. * @ctxid_mask0:Context ID comparator mask for comparator 0-3. * @ctxid_mask1:Context ID comparator mask for comparator 4-7. * @vmid_idx: VM ID index selector. * @vmid_val: Value of the VM ID comparator. * @vmid_mask0: VM ID comparator mask for comparator 0-3. * @vmid_mask1: VM ID comparator mask for comparator 4-7. * @ext_inp: External input selection. * @s_ex_level: Secure ELs where tracing is supported.
*/ struct etmv4_config {
u64 mode;
u32 pe_sel;
u32 cfg;
u32 eventctrl0;
u32 eventctrl1;
u32 stall_ctrl;
u32 ts_ctrl;
u32 syncfreq;
u32 ccctlr;
u32 bb_ctrl;
u32 vinst_ctrl;
u32 viiectlr;
u32 vissctlr;
u32 vipcssctlr;
u8 seq_idx;
u32 seq_ctrl[ETM_MAX_SEQ_STATES];
u32 seq_rst;
u32 seq_state;
u8 cntr_idx;
u32 cntrldvr[ETMv4_MAX_CNTR];
u32 cntr_ctrl[ETMv4_MAX_CNTR];
u32 cntr_val[ETMv4_MAX_CNTR];
u8 res_idx;
u32 res_ctrl[ETM_MAX_RES_SEL];
u8 ss_idx;
u32 ss_ctrl[ETM_MAX_SS_CMP];
u32 ss_status[ETM_MAX_SS_CMP];
u32 ss_pe_cmp[ETM_MAX_SS_CMP];
u8 addr_idx;
u64 addr_val[ETM_MAX_SINGLE_ADDR_CMP];
u64 addr_acc[ETM_MAX_SINGLE_ADDR_CMP];
u8 addr_type[ETM_MAX_SINGLE_ADDR_CMP];
u8 ctxid_idx;
u64 ctxid_pid[ETMv4_MAX_CTXID_CMP];
u32 ctxid_mask0;
u32 ctxid_mask1;
u8 vmid_idx;
u64 vmid_val[ETM_MAX_VMID_CMP];
u32 vmid_mask0;
u32 vmid_mask1;
u32 ext_inp;
u8 s_ex_level;
};
/** * struct etm4_save_state - state to be preserved when ETM is without power
*/ struct etmv4_save_state {
u32 trcprgctlr;
u32 trcprocselr;
u32 trcconfigr;
u32 trcauxctlr;
u32 trceventctl0r;
u32 trceventctl1r;
u32 trcstallctlr;
u32 trctsctlr;
u32 trcsyncpr;
u32 trcccctlr;
u32 trcbbctlr;
u32 trctraceidr;
u32 trcqctlr;
/** * struct etm4_drvdata - specifics associated to an ETM component * @pclk: APB clock if present, otherwise NULL * @atclk: Optional clock for the core parts of the ETMv4. * @base: Memory mapped base address for this component. * @csdev: Component vitals needed by the framework. * @spinlock: Only one at a time pls. * @mode: This tracer's mode, i.e sysFS, Perf or disabled. * @cpu: The cpu this component is affined to. * @arch: ETM architecture version. * @nr_pe: The number of processing entity available for tracing. * @nr_pe_cmp: The number of processing entity comparator inputs that are * available for tracing. * @nr_addr_cmp:Number of pairs of address comparators available * as found in ETMIDR4 0-3. * @nr_cntr: Number of counters as found in ETMIDR5 bit 28-30. * @nr_ext_inp: Number of external input. * @numcidc: Number of contextID comparators. * @numvmidc: Number of VMID comparators. * @nrseqstate: The number of sequencer states that are implemented. * @nr_event: Indicates how many events the trace unit support. * @nr_resource:The number of resource selection pairs available for tracing. * @nr_ss_cmp: Number of single-shot comparator controls that are available. * @trcid: value of the current ID for this component. * @trcid_size: Indicates the trace ID width. * @ts_size: Global timestamp size field. * @ctxid_size: Size of the context ID field to consider. * @vmid_size: Size of the VM ID comparator to consider. * @ccsize: Indicates the size of the cycle counter in bits. * @ccitmin: minimum value that can be programmed in * @s_ex_level: In secure state, indicates whether instruction tracing is * supported for the corresponding Exception level. * @ns_ex_level:In non-secure state, indicates whether instruction tracing is * supported for the corresponding Exception level. * @sticky_enable: true if ETM base configuration has been done. * @boot_enable:True if we should start tracing at boot time. * @os_unlock: True if access to management registers is allowed. * @instrp0: Tracing of load and store instructions * as P0 elements is supported. * @q_filt: Q element filtering support, if Q elements are supported. * @trcbb: Indicates if the trace unit supports branch broadcast tracing. * @trccond: If the trace unit supports conditional * instruction tracing. * @retstack: Indicates if the implementation supports a return stack. * @trccci: Indicates if the trace unit supports cycle counting * for instruction. * @q_support: Q element support characteristics. * @trc_error: Whether a trace unit can trace a system * error exception. * @syncpr: Indicates if an implementation has a fixed * synchronization period. * @stall_ctrl: Enables trace unit functionality that prevents trace * unit buffer overflows. * @sysstall: Does the system support stall control of the PE? * @nooverflow: Indicate if overflow prevention is supported. * @atbtrig: If the implementation can support ATB triggers * @lpoverride: If the implementation can support low-power state over. * @trfcr: If the CPU supports FEAT_TRF, value of the TRFCR_ELx that * allows tracing at all ELs. We don't want to compute this * at runtime, due to the additional setting of TRFCR_CX when * in EL2. Otherwise, 0. * @config: structure holding configuration parameters. * @save_trfcr: Saved TRFCR_EL1 register during a CPU PM event. * @save_state: State to be preserved across power loss * @state_needs_restore: True when there is context to restore after PM exit * @skip_power_up: Indicates if an implementation can skip powering up * the trace unit. * @paused: Indicates if the trace unit is paused. * @arch_features: Bitmap of arch features of etmv4 devices.
*/ struct etmv4_drvdata { struct clk *pclk; struct clk *atclk; void __iomem *base; struct coresight_device *csdev;
raw_spinlock_t spinlock; int cpu;
u8 arch;
u8 nr_pe;
u8 nr_pe_cmp;
u8 nr_addr_cmp;
u8 nr_cntr;
u8 nr_ext_inp;
u8 numcidc;
u8 numextinsel;
u8 numvmidc;
u8 nrseqstate;
u8 nr_event;
u8 nr_resource;
u8 nr_ss_cmp;
u8 trcid;
u8 trcid_size;
u8 ts_size;
u8 ctxid_size;
u8 vmid_size;
u8 ccsize;
u16 ccitmin;
u8 s_ex_level;
u8 ns_ex_level;
u8 q_support;
u8 os_lock_model; bool sticky_enable; bool boot_enable; bool os_unlock; bool instrp0; bool q_filt; bool trcbb; bool trccond; bool retstack; bool trccci; bool trc_error; bool syncpr; bool stallctl; bool sysstall; bool nooverflow; bool atbtrig; bool lpoverride;
u64 trfcr; struct etmv4_config config;
u64 save_trfcr; struct etmv4_save_state *save_state; bool state_needs_restore; bool skip_power_up; bool paused;
DECLARE_BITMAP(arch_features, ETM4_IMPDEF_FEATURE_MAX);
};
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.