On Tue, 20 Jun 2023 at 02:04, ~jhogberg <jhogb...@git.sr.ht> wrote: > > From: John Högberg <john.hogb...@ericsson.com> > > Unlike architectures with precise self-modifying code semantics > (e.g. x86) ARM processors do not maintain coherency for instruction > execution and memory, and require the explicit use of cache > management instructions as well as an instruction barrier to make > code updates visible (the latter on every core that is going to > execute said code).
This is implementation-dependent : if the implementation reports CTR_EL0.{DIC,IDC} == {1,1} then it doesn't need icache invalidation or data cache clean to provide data-to-instruction or instruction-to-data coherence. This is currently not true for any CPU QEMU models, but the Neoverse-V1 (which I'm about to send a patch for) can do this. (It's also tempting to make 'max' set these bits, which would save the guest some effort in doing cache ops which we NOP anyway.) So maybe we should also force CTR_EL0.DIC to 0 in user-mode so that the guest won't decide based on the value of that bit that it doesn't need to issue the IC IVAU ? arm_cpu_realizefn() would be the place to do this, I think. thanks -- PMM