Is it possible the to lock the ISR instructions to L1 cache?

843 Views Asked by At

I am running a bare metal application on one of the cores of ARM cortex A9 processor. My ISR is quite small an I am wondering whether it would be possible to lock my ISR instructions in the L1 cache? Is it possible? Is there any one who would explain some drawbacks of doing it?

Regards, N

2

There are 2 best solutions below

10
On

The Cortex-A9 does not support L1 cache lockdown (neither instructions nor data).

The drawback is that taking large chunks of the cache away (lockdown is usually done on a granularity of entire cache ways) decreases performance for everything else in the system.

Not to mention the fact that if your ISR is indeed small, and it is called frequently, it is somewhat likely to be in the cache anyway.

What is the benefit you were expecting to gain from doing this?

8
On

Your condition is the perfect fit for fast interrupt. (FIQ)

You only have to assign the last interrupt number for that particular ISR.

While other interrupt numbers are just vectors, the last number branches directly to the code area, thus saving one memory load plus interlock. You save about three cycles or so.

Besides, i-cache lockdown isn't as efficient as d-cache lockdown.

CA9 doesn't support L1 cache lockdown anyway (for some good reasons), so don't bother.

Just make sure the ISR is cache line aligned for maximum efficiency. (typically 32 or 64byte)