On Thu, Dec 04, 2025 at 06:13:56PM +0530, Anshuman Khandual wrote:
On 01/12/25 4:51 PM, Leo Yan wrote:
set_trbe_disabled() should never appear in the enable flow, otherwise, it may potentially hide bugs in the disable flow.
Remove set_trbe_disabled() from the enable path.
IIRC without first disabling TRBLIMITR_EL1_E - TRBE registers or their fields should not be fetched or interpreted.
Yes. I think you are referring to the rule DJMDD in Arm ARM: "The PE might ignore a direct or external write to any of certain Trace Buffer Unit registers ... (when) TRBLIMITR_EL1.E is 1, and the Trace Buffer Unit is using Self-hosted mode."
Without that none of the subsequent HW operations should be performed inside trbe_enable_hw() leading upto enabling it.
Fair enough.
If we can conclude the trace unit has been disabled properly in below cases, no reason to arbitrarily calling set_trbe_disabled() during each enable.
1) The SYS_TRBLIMITR_EL1 register is cleared in trbe_reset_local() during probe phase. 2) The SYS_TRBLIMITR_EL1.E bit is cleared in arm_trbe_irq_handler() for interrupt handling. 3) The SYS_TRBLIMITR_EL1.E bit is cleared in the disable flow.
Seems to me, this is not only for code cleanup, we need to promise a sane logic in the flow.
Thanks, Leo