From 05865b8fbdef5df6cda4183eb66df5ef817cfe67 Mon Sep 17 00:00:00 2001 From: Subrata Banik Date: Fri, 7 Jan 2022 13:01:18 +0000 Subject: soc/intel/apl: Rework on CPU privilege level implementation This patch migrates common code API into SoC specific implementation to drop CPU privilege level as the MSR is not consistent across platforms. For example: On APL/GLK, it's MSR 0x120 and CNL onwards it's MSR 0x151. Also, include `soc/msr.h` in cpu.h to fix the compilation issue. Signed-off-by: Subrata Banik Change-Id: I0b6f39509cc5457089cc15f28956833c36b567ad Reviewed-on: https://review.coreboot.org/c/coreboot/+/60898 Reviewed-by: EricR Lai Reviewed-by: Nico Huber Reviewed-by: Angel Pons Tested-by: build bot (Jenkins) --- src/soc/intel/apollolake/chip.c | 12 +++++++++++- src/soc/intel/apollolake/include/soc/cpu.h | 1 + src/soc/intel/apollolake/include/soc/msr.h | 4 ++++ 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src/soc/intel/apollolake') diff --git a/src/soc/intel/apollolake/chip.c b/src/soc/intel/apollolake/chip.c index 651bd8418c..98844a52fd 100644 --- a/src/soc/intel/apollolake/chip.c +++ b/src/soc/intel/apollolake/chip.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -702,10 +703,19 @@ struct chip_operations soc_intel_apollolake_ops = { .final = &soc_final }; +static void soc_enable_untrusted_mode(void *unused) +{ + /* + * Set Bit 6 (ENABLE_IA_UNTRUSTED_MODE) of MSR 0x120 + * UCODE_PCR_POWER_MISC MSR to enter IA Untrusted Mode. + */ + msr_set(MSR_POWER_MISC, ENABLE_IA_UNTRUSTED); +} + static void drop_privilege_all(void) { /* Drop privilege level on all the CPUs */ - if (mp_run_on_all_cpus(&cpu_enable_untrusted_mode, NULL) != CB_SUCCESS) + if (mp_run_on_all_cpus(&soc_enable_untrusted_mode, NULL) != CB_SUCCESS) printk(BIOS_ERR, "failed to enable untrusted mode\n"); } diff --git a/src/soc/intel/apollolake/include/soc/cpu.h b/src/soc/intel/apollolake/include/soc/cpu.h index 38b830a16f..3157952455 100644 --- a/src/soc/intel/apollolake/include/soc/cpu.h +++ b/src/soc/intel/apollolake/include/soc/cpu.h @@ -5,6 +5,7 @@ #include #include +#include struct device; void apollolake_init_cpus(struct device *dev); diff --git a/src/soc/intel/apollolake/include/soc/msr.h b/src/soc/intel/apollolake/include/soc/msr.h index e35c8814eb..97c67ddc21 100644 --- a/src/soc/intel/apollolake/include/soc/msr.h +++ b/src/soc/intel/apollolake/include/soc/msr.h @@ -5,4 +5,8 @@ #include +#define MSR_POWER_MISC 0x120 +#define ENABLE_IA_UNTRUSTED (1 << 6) +#define FLUSH_DL1_L2 (1 << 8) + #endif -- cgit v1.2.3