Please note: We are aware of an issue affecting replies on the Arm Community forums, which may not be loading as expected.

We apologize for any inconvenience and appreciate your patience while we investigate and work to resolve the issue.

Thank you for your understanding.


This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MMU deactivation and I-Cache / Branch Predictor

Hi !

In order to call some functionality hard-coded in my board ROM (HAB from NXP i.MX6 board), I need to shut down the MMU: the ROM is not position independent. In particular, it is not always possible to map it and the devices correctly due to restriction in my OS.

I order to shutdown the MMU, I started first to shutdown and invalidate the I-Cache, BP and L1/L2 D cache, then I run the ROM code, and then I re-enable everything.

I was wondering if I could keep the I-Cache and BP activated running ROM code, and what was the correct code sequence ? At the moment I do the following:

  • Jump to a virtual code region which is mapped as 1:1 with physical addresses
  • Disable I Cache & BP
  • Invalidate I Cache & BP
  • Flush (Clean + Invalidate) L1 D-cache
  • Flush (Clean + Invalidate) L2 D-cache
  • Disable MMU & L1 D-cache at the same time
  • set the stack pointer to a valid physical address
  • Disable L2 D-cache
  • run the HAB ROM code
  • Invalidate I Cache, BP & TLB
  • Reactivate I Cache & BP
  • Invalidate L1 / L2 D-cache
  • Reactivate L2 D-cache
  • Reactivate L1 D cache & MMU at the same time
  • restore virtual stack pointer
  • jump back to my OS

I think I still need to invalidate I cache & BP before shutting down the MMU, but could I keep them enabled ? Or should I reenable them before calling the HAB ROM code ?

Best,

Vincent

Parents Reply Children