Table 5-3. Data Access Synchronization Requirements and Table 5-4. Instruction Fetch and/or Execution Synchronization Requirements explicitly defines synchronization requirements for tlbwe.
Usual sequence is
msync
tlbwe
isync
Q: When can I be sure no CSI instructions are needed for tlbwe?
A: It is better to do it bulletproof and put it there always then later dealing with issues caused by missing synch instructions. Changing context takes several cycles and if new context is not touched during this time (for instance definition of memory that wasn’t defined before), then will be no issue. In case AN5191, it is startup code and tlbwe is followed by another register loading and definition of another TLB, so in this it is OK exludion TLB1 or TLB3.
Q: In the AN5191 example, can se_isync be replaced by any other CSI instruction?
A: Yes, if it does make sense. The notation “CSI” in the tables means any context-synchronizing instruction (sc, isync, rfi, rfgi <E.HV>, rfci, rfdi <E.ED>, or rfmci). In AN5191 it does not make any sense.
Q: In the AN5191 example, why is the msync inserted before tlbwe? Is this equivalent to the EREF note that describes the possible need for an extra msync after tlbwe? Or there is some other case where an msync would be necessary before tlbwe?
A: Not sure which note you have on your mind, but it is possible. I would keep standard sequence as we have for instance in MAS TLB calculator:
https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/MMU-Assist-Register-CONFIGURATOR/ta-p/1110436
Q: EREF_RM table 4-41 describes msync as performing instruction and memory synchronization. Why would I need a CSI instruction after msync?
A: You apparently don’t have document that is up to date. Latest version is EREFRM Rev. 1 12/2007. Isync is required by tlbwe as I already mentioned.