Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/21010
Change subject: intel/common/mp_init: Refactor MP Init code to get rid of microcode param
......................................................................
intel/common/mp_init: Refactor MP Init code to get rid of microcode param
Refactor MP Init which
- removes global variable for microcode
- remove passing microcode patch pointer as param
- uses device_t data pointer for microcode pointer usage
Change-Id: Ib03bb4a3063d243d97b132e0dc288ef3868a5a7b
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati(a)intel.com>
---
M src/soc/intel/common/block/cpu/mp_init.c
M src/soc/intel/common/block/include/intelblocks/mp_init.h
M src/soc/intel/skylake/cpu.c
3 files changed, 16 insertions(+), 29 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/10/21010/1
diff --git a/src/soc/intel/common/block/cpu/mp_init.c b/src/soc/intel/common/block/cpu/mp_init.c
index 7e57b79..a5138eb 100644
--- a/src/soc/intel/common/block/cpu/mp_init.c
+++ b/src/soc/intel/common/block/cpu/mp_init.c
@@ -27,24 +27,21 @@
#include <intelblocks/msr.h>
#include <soc/cpu.h>
-static const void *microcode_patch;
-
/* SoC override function */
-__attribute__((weak)) void soc_core_init(device_t dev, const void *microcode)
+__attribute__((weak)) void soc_core_init(device_t dev)
{
/* no-op */
}
-__attribute__((weak)) void soc_init_cpus(struct bus *cpu_bus,
- const void *microcode)
+__attribute__((weak)) void soc_init_cpus(struct bus *cpu_bus)
{
/* no-op */
}
-static void init_one_cpu(device_t dev)
+static void init_one_cpu(device_t dev)
{
- soc_core_init(dev, microcode_patch);
- intel_microcode_load_unlocked(microcode_patch);
+ soc_core_init(dev);
+ intel_microcode_load_unlocked(dev->data);
}
static struct device_operations cpu_dev_ops = {
@@ -102,7 +99,10 @@
*/
void get_microcode_info(const void **microcode, int *parallel)
{
- *microcode = microcode_patch;
+ device_t dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER);
+ assert(dev != NULL);
+
+ *microcode = dev->data;
*parallel = 1;
}
@@ -111,23 +111,10 @@
device_t dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER);
assert(dev != NULL);
- microcode_patch = intel_microcode_find();
- intel_microcode_load_unlocked(microcode_patch);
+ dev->data = intel_microcode_find();
+ intel_microcode_load_unlocked(dev->data);
- dev->data = microcode_patch;
- /*
- * TODO: This parameter "microcode_patch" should be removed
- * in this function call once the following two cases are resolved -
- *
- * 1) SGX enabling for the BSP issue gets solved, due to which
- * configure_sgx() function is kept inside soc/cpu.c soc_init_cpus().
- * 2) uCode loading after SMM relocation is deleted inside
- * per_cpu_smm_trigger() mp_ops callback function in soc/cpu.c,
- * since as per current BWG, uCode loading can be done after
- * all feature programmings are done. There is no specific
- * recommendation to do it after SMM Relocation.
- */
- soc_init_cpus(dev->link_list, microcode_patch);
+ soc_init_cpus(dev->link_list);
}
/* Ensure to re-program all MTRRs based on DRAM resource settings */
diff --git a/src/soc/intel/common/block/include/intelblocks/mp_init.h b/src/soc/intel/common/block/include/intelblocks/mp_init.h
index 1e5531c..7118d70 100644
--- a/src/soc/intel/common/block/include/intelblocks/mp_init.h
+++ b/src/soc/intel/common/block/include/intelblocks/mp_init.h
@@ -62,7 +62,7 @@
* In this function SOC must perform CPU feature programming
* during Ramstage phase.
*/
-void soc_core_init(device_t dev, const void *microcode);
+void soc_core_init(device_t dev);
/*
* In this function SOC must fill required mp_ops params, also it
@@ -72,6 +72,6 @@
* Also, if there is any other SOC specific functionalities to be
* implemented before or after MP Init, it can be done here.
*/
-void soc_init_cpus(struct bus *cpu_bus, const void *microcode);
+void soc_init_cpus(struct bus *cpu_bus);
#endif /* SOC_INTEL_COMMON_BLOCK_MP_INIT_H */
diff --git a/src/soc/intel/skylake/cpu.c b/src/soc/intel/skylake/cpu.c
index e20e5a0..9ade614 100644
--- a/src/soc/intel/skylake/cpu.c
+++ b/src/soc/intel/skylake/cpu.c
@@ -407,7 +407,7 @@
}
/* All CPUs including BSP will run the following function. */
-void soc_core_init(device_t cpu, const void *microcode)
+void soc_core_init(device_t cpu)
{
/* Clear out pending MCEs */
configure_mca();
@@ -491,7 +491,7 @@
.post_mp_init = post_mp_init,
};
-void soc_init_cpus(struct bus *cpu_bus, const void *microcode)
+void soc_init_cpus(struct bus *cpu_bus)
{
if (mp_init_with_smm(cpu_bus, &mp_ops))
printk(BIOS_ERR, "MP initialization failure.\n");
--
To view, visit https://review.coreboot.org/21010
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib03bb4a3063d243d97b132e0dc288ef3868a5a7b
Gerrit-Change-Number: 21010
Gerrit-PatchSet: 1
Gerrit-Owner: Pratikkumar V Prajapati <pratikkumar.v.prajapati(a)intel.com>
Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/21008
Change subject: device_t struct: Introduce device specific data field
......................................................................
device_t struct: Introduce device specific data field
Let device store anything it needs. For CPU, data pointer would
store microcode patch address (MP init code sets it now). This would be
efficient as, device_t can be located easily and its data can be accessed.
e.g. to get microcode patch address for CPU device
device_t dev = dev_find_path(NULL, DEVICE_PATH_CPU_CLUSTER);
and then dev->data can be used, rather than loading microcode each
time from boot media.
Change-Id: I7e377621dd9c00388c4e148c451f9e01cb7fe4fa
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati(a)intel.com>
---
M src/include/device/device.h
M src/soc/intel/common/block/cpu/mp_init.c
2 files changed, 3 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/08/21008/1
diff --git a/src/include/device/device.h b/src/include/device/device.h
index 54d4ec3..04962dd 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -146,6 +146,7 @@
const char *name;
#endif
DEVTREE_CONST void *chip_info;
+ const void *data; /* device specific data. Store anything you want */
};
/**
diff --git a/src/soc/intel/common/block/cpu/mp_init.c b/src/soc/intel/common/block/cpu/mp_init.c
index fd8b5db..7e57b79 100644
--- a/src/soc/intel/common/block/cpu/mp_init.c
+++ b/src/soc/intel/common/block/cpu/mp_init.c
@@ -102,7 +102,7 @@
*/
void get_microcode_info(const void **microcode, int *parallel)
{
- *microcode =microcode_patch;
+ *microcode = microcode_patch;
*parallel = 1;
}
@@ -114,6 +114,7 @@
microcode_patch = intel_microcode_find();
intel_microcode_load_unlocked(microcode_patch);
+ dev->data = microcode_patch;
/*
* TODO: This parameter "microcode_patch" should be removed
* in this function call once the following two cases are resolved -
--
To view, visit https://review.coreboot.org/21008
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7e377621dd9c00388c4e148c451f9e01cb7fe4fa
Gerrit-Change-Number: 21008
Gerrit-PatchSet: 1
Gerrit-Owner: Pratikkumar V Prajapati <pratikkumar.v.prajapati(a)intel.com>
Pratikkumar V Prajapati has uploaded this change for review. ( https://review.coreboot.org/21007
Change subject: soc/intel/skylake: Fix SGX init sequence.
......................................................................
soc/intel/skylake: Fix SGX init sequence.
Configure core PRMRR first on all the cores and then follow
the SGX init sequence. Second microcode load would run the
MCHECK. To pass MCHECK, PRMRR on all cores needs to be
configured first. Hence, PRMRR configuration would be called
from soc_core_init while MP init for each core and then from
soc_init_cpus, BSP would call sgx_configure for each core
(including for itself). This code flow satisfies the MCHECK
passing pre-conditions; and apparently this patch fixes the
behavior of calling configure_sgx() “again” for BSP. (So
removed the TODO comment also).
Change-Id: I88f330eb9757cdc3dbfc7609729c6ceb7d58a0e1
Signed-off-by: Pratik Prajapati <pratikkumar.v.prajapati(a)intel.com>
---
M src/soc/intel/skylake/cpu.c
1 file changed, 3 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/07/21007/1
diff --git a/src/soc/intel/skylake/cpu.c b/src/soc/intel/skylake/cpu.c
index 1a08191..e20e5a0 100644
--- a/src/soc/intel/skylake/cpu.c
+++ b/src/soc/intel/skylake/cpu.c
@@ -437,8 +437,8 @@
/* Enable Turbo */
enable_turbo();
- /* Configure SGX */
- sgx_configure(microcode);
+ /* Configure Core PRMRR for SGX. */
+ prmrr_core_configure();
}
static int adjust_apic_id(int index, int apic_id)
@@ -499,13 +499,7 @@
/* Thermal throttle activation offset */
configure_thermal_target();
- /*
- * TODO: somehow calling configure_sgx() in cpu_core_init() is not
- * successful on the BSP (other threads are fine). Have to run it again
- * here to get SGX enabled on BSP. This behavior needs to root-caused
- * and we shall not have this redundant call.
- */
- sgx_configure(microcode);
+ mp_run_on_all_cpus(sgx_configure, 2000);
}
int soc_skip_ucode_update(u32 current_patch_id, u32 new_patch_id)
--
To view, visit https://review.coreboot.org/21007
To unsubscribe, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I88f330eb9757cdc3dbfc7609729c6ceb7d58a0e1
Gerrit-Change-Number: 21007
Gerrit-PatchSet: 1
Gerrit-Owner: Pratikkumar V Prajapati <pratikkumar.v.prajapati(a)intel.com>