soc/intel/cmn/cpu: API to initialize core PRMRR

This patch implements API to sync between core
PRMRR(Processor Reserved Memory Range Registers).

Read PRMRR base and limit value from BSP and apply it on the
rest of the cores.

BUG=b:233199592
TEST=Build and boot google/taeko to ChromeOS.

Signed-off-by: Subrata Banik <subratabanik@google.com>
Change-Id: I720669139429afc3d8c8d15c0ce15f1524f22e4c
Reviewed-on: https://review.coreboot.org/c/coreboot/+/64976
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tarun Tuli <taruntuli@google.com>
This commit is contained in:
Subrata Banik 2022-06-05 18:57:36 +05:30 committed by Felix Held
parent 91bc6d1da7
commit 13fd3c8dae
3 changed files with 32 additions and 0 deletions

View File

@ -3,12 +3,15 @@
#include <assert.h>
#include <acpi/acpigen.h>
#include <console/console.h>
#include <cpu/intel/common/common.h>
#include <cpu/intel/turbo.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
#include <arch/cpu.h>
#include <intelblocks/cpulib.h>
#include <intelblocks/fast_spi.h>
#include <intelblocks/msr.h>
#include <smp/node.h>
#include <soc/soc_chip.h>
#include <types.h>
@ -477,3 +480,24 @@ void get_cpu_topology_from_apicid(uint32_t apicid, uint8_t *package,
if (thread)
*thread = apicid & ((1 << thread_bits) - 1);
}
static void sync_core_prmrr(void)
{
static msr_t msr_base, msr_mask;
if (boot_cpu()) {
msr_base = rdmsr(MSR_PRMRR_BASE_0);
msr_mask = rdmsr(MSR_PRMRR_PHYS_MASK);
} else if (!intel_ht_sibling()) {
wrmsr(MSR_PRMRR_BASE_0, msr_base);
wrmsr(MSR_PRMRR_PHYS_MASK, msr_mask);
}
}
void init_core_prmrr(void)
{
msr_t msr = rdmsr(MTRR_CAP_MSR);
if (msr.lo & MTRR_CAP_PRMRR)
sync_core_prmrr();
}

View File

@ -187,4 +187,11 @@ void enable_pm_timer_emulation(void);
void get_cpu_topology_from_apicid(uint32_t apicid, uint8_t *package,
uint8_t *core, uint8_t *thread);
/*
* Initialize core PRMRR
*
* Read the BSP PRMRR snapshot and apply on the rest of the core threads
*/
void init_core_prmrr(void);
#endif /* SOC_INTEL_COMMON_BLOCK_CPULIB_H */

View File

@ -48,6 +48,7 @@
#define MSR_PRMRR_VALID_CONFIG 0x1fb
#define MSR_POWER_CTL 0x1fc
#define POWER_CTL_C1E_MASK (1 << 1)
#define MSR_PRMRR_BASE_0 0x2a0
#define MSR_EVICT_CTL 0x2e0
#define MSR_LT_CONTROL 0x2e7
#define LT_CONTROL_LOCK (1 << 0)