soc/intel/skylake: Perform CPU MP Init before FSP-S Init

As per BWG, CPU MP Init (loading ucode) should be done prior
to BIOS_RESET_CPL. Hence, pull MP Init to BS_DEV_INIT_CHIPS Entry
(before FSP-S call).

BUG=chrome-os-partner:62438
BRANCH=NONE
TEST=Boot to OS with all threads enabled.

Change-Id: Ia6f83d466fb27e1290da84abe7832dc814b5273a
Signed-off-by: Subrata Banik <subrata.banik@intel.com>
Reviewed-on: https://review.coreboot.org/18287
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
Subrata Banik 2017-02-03 18:57:49 +05:30 committed by Martin Roth
parent 408fda799a
commit a4b11e5c90
5 changed files with 31 additions and 18 deletions

View File

@ -2,7 +2,7 @@
* This file is part of the coreboot project. * This file is part of the coreboot project.
* *
* Copyright (C) 2014 Google Inc. * Copyright (C) 2014 Google Inc.
* Copyright (C) 2015 Intel Corporation. * Copyright (C) 2015-2017 Intel Corporation.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -49,7 +49,7 @@ static struct device_operations pci_domain_ops = {
}; };
static struct device_operations cpu_bus_ops = { static struct device_operations cpu_bus_ops = {
.init = &soc_init_cpus, .init = DEVICE_NOOP,
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
.acpi_fill_ssdt_generator = generate_cpu_entries, .acpi_fill_ssdt_generator = generate_cpu_entries,
#endif #endif

View File

@ -1,7 +1,7 @@
/* /*
* This file is part of the coreboot project. * This file is part of the coreboot project.
* *
* Copyright (C) 2016 Intel Corporation. * Copyright (C) 2016-2017 Intel Corporation.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -59,7 +59,7 @@ static struct device_operations cpu_bus_ops = {
.read_resources = DEVICE_NOOP, .read_resources = DEVICE_NOOP,
.set_resources = DEVICE_NOOP, .set_resources = DEVICE_NOOP,
.enable_resources = DEVICE_NOOP, .enable_resources = DEVICE_NOOP,
.init = &soc_init_cpus, .init = DEVICE_NOOP,
#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES) #if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
.acpi_fill_ssdt_generator = generate_cpu_entries, .acpi_fill_ssdt_generator = generate_cpu_entries,
#endif #endif

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2007-2009 coresystems GmbH * Copyright (C) 2007-2009 coresystems GmbH
* Copyright (C) 2014 Google Inc. * Copyright (C) 2014 Google Inc.
* Copyright (C) 2015 Intel Corporation. * Copyright (C) 2015-2017 Intel Corporation.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -15,6 +15,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
*/ */
#include <assert.h>
#include <bootstate.h>
#include <console/console.h> #include <console/console.h>
#include <device/device.h> #include <device/device.h>
#include <device/pci.h> #include <device/pci.h>
@ -397,13 +399,6 @@ static const struct cpu_driver driver __cpu_driver = {
static const void *microcode_patch; static const void *microcode_patch;
static int ht_disabled; static int ht_disabled;
static void pre_mp_init(void)
{
/* Setup MTRRs based on physical address size. */
x86_setup_mtrrs_with_detect();
x86_mtrr_check();
}
static int get_cpu_count(void) static int get_cpu_count(void)
{ {
msr_t msr; msr_t msr;
@ -463,7 +458,12 @@ static void post_mp_init(void)
} }
static const struct mp_ops mp_ops = { static const struct mp_ops mp_ops = {
.pre_mp_init = pre_mp_init, /*
* Skip Pre MP init MTRR programming as MTRRs are mirrored from BSP,
* that are set prior to ramstage.
* Real MTRRs programming are being done after resource allocation.
*/
.pre_mp_init = NULL,
.get_cpu_count = get_cpu_count, .get_cpu_count = get_cpu_count,
.get_smm_info = smm_info, .get_smm_info = smm_info,
.get_microcode_info = get_microcode_info, .get_microcode_info = get_microcode_info,
@ -474,8 +474,10 @@ static const struct mp_ops mp_ops = {
.post_mp_init = post_mp_init, .post_mp_init = post_mp_init,
}; };
void soc_init_cpus(device_t dev) static void soc_init_cpus(void *unused)
{ {
device_t dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER);
assert(dev != NULL);
struct bus *cpu_bus = dev->link_list; struct bus *cpu_bus = dev->link_list;
if (mp_init_with_smm(cpu_bus, &mp_ops)) { if (mp_init_with_smm(cpu_bus, &mp_ops)) {
@ -486,6 +488,13 @@ void soc_init_cpus(device_t dev)
configure_thermal_target(); configure_thermal_target();
} }
/* Ensure to re-program all MTRRs based on DRAM resource settings */
static void soc_post_cpus_init(void *unused)
{
if (mp_run_on_all_cpus(&x86_setup_mtrrs_with_detect, 1000) < 0)
printk(BIOS_ERR, "MTRR programming failure\n");
}
int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id) int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id)
{ {
msr_t msr; msr_t msr;
@ -498,3 +507,9 @@ int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id)
msr = rdmsr(MTRR_CAP_MSR); msr = rdmsr(MTRR_CAP_MSR);
return (msr.lo & PRMRR_SUPPORTED) && (current_patch_id == new_patch_id - 1); return (msr.lo & PRMRR_SUPPORTED) && (current_patch_id == new_patch_id - 1);
} }
/*
* Do CPU MP Init before FSP Silicon Init
*/
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT_CHIPS, BS_ON_ENTRY, soc_init_cpus, NULL);
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, soc_post_cpus_init, NULL);

View File

@ -2,7 +2,7 @@
* This file is part of the coreboot project. * This file is part of the coreboot project.
* *
* Copyright (C) 2014 Google Inc. * Copyright (C) 2014 Google Inc.
* Copyright (C) 2015 Intel Corporation. * Copyright (C) 2015-2017 Intel Corporation.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,7 +29,6 @@
void soc_irq_settings(FSP_SIL_UPD *params); void soc_irq_settings(FSP_SIL_UPD *params);
void pch_enable_dev(device_t dev); void pch_enable_dev(device_t dev);
void soc_init_pre_device(void *chip_info); void soc_init_pre_device(void *chip_info);
void soc_init_cpus(device_t dev);
const char *soc_acpi_name(struct device *dev); const char *soc_acpi_name(struct device *dev);
int init_igd_opregion(igd_opregion_t *igd_opregion); int init_igd_opregion(igd_opregion_t *igd_opregion);
extern struct pci_operations soc_pci_ops; extern struct pci_operations soc_pci_ops;

View File

@ -2,7 +2,7 @@
* This file is part of the coreboot project. * This file is part of the coreboot project.
* *
* Copyright (C) 2014 Google Inc. * Copyright (C) 2014 Google Inc.
* Copyright (C) 2015 Intel Corporation. * Copyright (C) 2015-2017 Intel Corporation.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -29,7 +29,6 @@
void mainboard_silicon_init_params(FSP_S_CONFIG *params); void mainboard_silicon_init_params(FSP_S_CONFIG *params);
void pch_enable_dev(device_t dev); void pch_enable_dev(device_t dev);
void soc_init_pre_device(void *chip_info); void soc_init_pre_device(void *chip_info);
void soc_init_cpus(device_t dev);
void soc_irq_settings(FSP_SIL_UPD *params); void soc_irq_settings(FSP_SIL_UPD *params);
const char *soc_acpi_name(struct device *dev); const char *soc_acpi_name(struct device *dev);