You modify the kernel. As for SMIs, you know where SMRAM is located in memory and the cache geometry, so can ensure that there are cache ways available which SMIs won't evict.
Cache evictions can also be monitored by CPU performance counters, so you can detect any that do occur.