aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Zeh <werner.zeh@siemens.com>2022-10-21 11:09:27 +0200
committerFelix Held <felix-coreboot@felixheld.de>2022-10-25 15:05:18 +0000
commitd03e896b57ea1ae2fea640937df2d57b684ce629 (patch)
treeb455d733a2a349efd7f49b1cc00c33d6866dfc8a
parent7fd9b86eaee29ae11a5c9c1b4ea200a3e30dfaf7 (diff)
soc/intel/eklhartlake: Provide an option to disable the L1 prefetcher
Depending on the real workload that is executed on the system the L1 prefetcher might be too aggressive and will populate the L1 cache ahead with data that is not really needed. In the end, this will result in a higher cache miss rate thus slowing down the real application. This patch provides a devicetree option to disable the L1 prefetcher if needed. This can be requested on mainboard level if needed. Change-Id: I3fc8fb79c42c298a20928ae4912ee23916463038 Signed-off-by: Werner Zeh <werner.zeh@siemens.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/68667 Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/soc/intel/elkhartlake/chip.h3
-rw-r--r--src/soc/intel/elkhartlake/cpu.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/src/soc/intel/elkhartlake/chip.h b/src/soc/intel/elkhartlake/chip.h
index d63844ffe7..94a2cdff78 100644
--- a/src/soc/intel/elkhartlake/chip.h
+++ b/src/soc/intel/elkhartlake/chip.h
@@ -454,6 +454,9 @@ struct soc_intel_elkhartlake_config {
* 3600, 3733, 4000, 4200, 4267 and 0 for Auto.
*/
uint16_t max_dram_speed_mts;
+
+ /* Disable L1 prefetcher */
+ bool L1_prefetcher_disable;
};
typedef struct soc_intel_elkhartlake_config config_t;
diff --git a/src/soc/intel/elkhartlake/cpu.c b/src/soc/intel/elkhartlake/cpu.c
index f4baa65fd9..8ba28c0159 100644
--- a/src/soc/intel/elkhartlake/cpu.c
+++ b/src/soc/intel/elkhartlake/cpu.c
@@ -67,6 +67,14 @@ static void configure_misc(void)
msr.lo |= (1 << 0); /* Enable Bi-directional PROCHOT as an input */
msr.lo |= (1 << 23); /* Lock it */
wrmsr(MSR_POWER_CTL, msr);
+
+ /* In some cases it is beneficial for the performance to disable the
+ L1 prefetcher as on Elkhart Lake it is set up a bit too aggressive. */
+ if (conf->L1_prefetcher_disable) {
+ msr = rdmsr(MSR_PREFETCH_CTL);
+ msr.lo |= PREFETCH_L1_DISABLE;
+ wrmsr(MSR_PREFETCH_CTL, msr);
+ }
}
/* All CPUs including BSP will run the following function. */