diff options
author | Felix Held <felix.held@amd.corp-partner.google.com> | 2021-10-20 23:31:43 +0200 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2021-10-22 01:27:07 +0000 |
commit | 4dd7d1196545f1dff71b8e70b7a9b80b8bcd4041 (patch) | |
tree | 6a0c12d1d086f89d7ba7369247298a1ccde2faab | |
parent | 82faefb339a0853dd49f10bafd2c4f5ca1723fb3 (diff) |
cpu/x86/mp_init: move printing of failure message into mp_init_with_smm
Each CPU/SoC checks the return value of the mp_init_with_smm and prints
the same error message if it wasn't successful, so move this check and
printk to mp_init_with_smm. For this the original mp_init_with_smm
function gets renamed to do_mp_init_with_smm and a new mp_init_with_smm
function is created which then calls do_mp_init_with_smm, prints the
error if it didn't return CB_SUCCESS and passes the return value of
do_mp_init_with_smm to its caller.
Since no CPU/SoC code handles a mp_init_with_smm failure apart from
printing a message, also add a comment at the mp_init_with_smm call
sites that the code might want to handle a failure.
Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: I181602723c204f3e43eb43302921adf7a88c81ed
Reviewed-on: https://review.coreboot.org/c/coreboot/+/58498
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
-rw-r--r-- | src/cpu/intel/haswell/haswell_init.c | 4 | ||||
-rw-r--r-- | src/cpu/intel/model_1067x/mp_init.c | 4 | ||||
-rw-r--r-- | src/cpu/intel/model_2065x/model_2065x_init.c | 4 | ||||
-rw-r--r-- | src/cpu/intel/model_206ax/model_206ax_init.c | 4 | ||||
-rw-r--r-- | src/cpu/x86/mp_init.c | 12 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/northbridge.c | 4 | ||||
-rw-r--r-- | src/soc/amd/cezanne/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/amd/picasso/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/amd/stoneyridge/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/alderlake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/apollolake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/baytrail/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/braswell/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/cannonlake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/denverton_ns/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/elkhartlake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/icelake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/jasperlake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/skylake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/tigerlake/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/cpx/cpu.c | 4 | ||||
-rw-r--r-- | src/soc/intel/xeon_sp/skx/cpu.c | 4 |
22 files changed, 53 insertions, 43 deletions
diff --git a/src/cpu/intel/haswell/haswell_init.c b/src/cpu/intel/haswell/haswell_init.c index 40f5ce0013..2ab77b3044 100644 --- a/src/cpu/intel/haswell/haswell_init.c +++ b/src/cpu/intel/haswell/haswell_init.c @@ -642,8 +642,8 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } static struct device_operations cpu_dev_ops = { diff --git a/src/cpu/intel/model_1067x/mp_init.c b/src/cpu/intel/model_1067x/mp_init.c index 38d3735f14..9a1fc42d3e 100644 --- a/src/cpu/intel/model_1067x/mp_init.c +++ b/src/cpu/intel/model_1067x/mp_init.c @@ -98,6 +98,6 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } diff --git a/src/cpu/intel/model_2065x/model_2065x_init.c b/src/cpu/intel/model_2065x/model_2065x_init.c index a31f2cb692..30519c0256 100644 --- a/src/cpu/intel/model_2065x/model_2065x_init.c +++ b/src/cpu/intel/model_2065x/model_2065x_init.c @@ -175,8 +175,8 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } static struct device_operations cpu_dev_ops = { diff --git a/src/cpu/intel/model_206ax/model_206ax_init.c b/src/cpu/intel/model_206ax/model_206ax_init.c index f3181cfaa6..d240f53761 100644 --- a/src/cpu/intel/model_206ax/model_206ax_init.c +++ b/src/cpu/intel/model_206ax/model_206ax_init.c @@ -431,8 +431,8 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } static struct device_operations cpu_dev_ops = { diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c index 0624176b75..c99732fb39 100644 --- a/src/cpu/x86/mp_init.c +++ b/src/cpu/x86/mp_init.c @@ -1095,7 +1095,7 @@ static void fill_mp_state(struct mp_state *state, const struct mp_ops *ops) mp_state.ops.per_cpu_smm_trigger = smm_initiate_relocation; } -enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops) +static enum cb_err do_mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops) { enum cb_err ret; void *default_smm_area; @@ -1142,3 +1142,13 @@ enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops) return ret; } + +enum cb_err mp_init_with_smm(struct bus *cpu_bus, const struct mp_ops *mp_ops) +{ + enum cb_err ret = do_mp_init_with_smm(cpu_bus, mp_ops); + + if (ret != CB_SUCCESS) + printk(BIOS_ERR, "MP initialization failure.\n"); + + return ret; +} diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c index b7630a138b..d041b0c673 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -251,8 +251,8 @@ void mp_init_cpus(struct bus *cpu_bus) { const struct mp_ops *ops = CONFIG(SMM_TSEG) ? &mp_ops_with_smm : &mp_ops_no_smm; - if (mp_init_with_smm(cpu_bus, ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, ops); } static void cpu_bus_init(struct device *dev) diff --git a/src/soc/amd/cezanne/cpu.c b/src/soc/amd/cezanne/cpu.c index a2fa433a9b..c3d89bf513 100644 --- a/src/soc/amd/cezanne/cpu.c +++ b/src/soc/amd/cezanne/cpu.c @@ -52,8 +52,8 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { /* Clear for take-off */ - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* pre_mp_init made the flash not cacheable. Reset to WP for performance. */ mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT); diff --git a/src/soc/amd/picasso/cpu.c b/src/soc/amd/picasso/cpu.c index 087b153998..9822326afe 100644 --- a/src/soc/amd/picasso/cpu.c +++ b/src/soc/amd/picasso/cpu.c @@ -56,8 +56,8 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { /* Clear for take-off */ - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* pre_mp_init made the flash not cacheable. Reset to WP for performance. */ mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT); diff --git a/src/soc/amd/stoneyridge/cpu.c b/src/soc/amd/stoneyridge/cpu.c index 08f553351c..99b40a6131 100644 --- a/src/soc/amd/stoneyridge/cpu.c +++ b/src/soc/amd/stoneyridge/cpu.c @@ -54,8 +54,8 @@ static const struct mp_ops mp_ops = { void mp_init_cpus(struct bus *cpu_bus) { /* Clear for take-off */ - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* The flash is now no longer cacheable. Reset to WP for performance. */ mtrr_use_temp_range(FLASH_BASE_ADDR, CONFIG_ROM_SIZE, MTRR_TYPE_WRPROT); diff --git a/src/soc/intel/alderlake/cpu.c b/src/soc/intel/alderlake/cpu.c index a437559107..94658c7acb 100644 --- a/src/soc/intel/alderlake/cpu.c +++ b/src/soc/intel/alderlake/cpu.c @@ -127,8 +127,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); diff --git a/src/soc/intel/apollolake/cpu.c b/src/soc/intel/apollolake/cpu.c index 645582b132..af0a6dcd18 100644 --- a/src/soc/intel/apollolake/cpu.c +++ b/src/soc/intel/apollolake/cpu.c @@ -251,8 +251,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { /* Clear for take-off */ - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } void apollolake_init_cpus(struct device *dev) diff --git a/src/soc/intel/baytrail/cpu.c b/src/soc/intel/baytrail/cpu.c index 8e402651ce..98400d1a1a 100644 --- a/src/soc/intel/baytrail/cpu.c +++ b/src/soc/intel/baytrail/cpu.c @@ -197,6 +197,6 @@ void baytrail_init_cpus(struct device *dev) { struct bus *cpu_bus = dev->link_list; - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } diff --git a/src/soc/intel/braswell/cpu.c b/src/soc/intel/braswell/cpu.c index ead42b92f8..ed5244270c 100644 --- a/src/soc/intel/braswell/cpu.c +++ b/src/soc/intel/braswell/cpu.c @@ -206,6 +206,6 @@ void soc_init_cpus(struct device *dev) { struct bus *cpu_bus = dev->link_list; - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } diff --git a/src/soc/intel/cannonlake/cpu.c b/src/soc/intel/cannonlake/cpu.c index 23b944df2d..4f6720850e 100644 --- a/src/soc/intel/cannonlake/cpu.c +++ b/src/soc/intel/cannonlake/cpu.c @@ -190,8 +190,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); diff --git a/src/soc/intel/denverton_ns/cpu.c b/src/soc/intel/denverton_ns/cpu.c index ab4043bf09..d856692721 100644 --- a/src/soc/intel/denverton_ns/cpu.c +++ b/src/soc/intel/denverton_ns/cpu.c @@ -297,6 +297,6 @@ void denverton_init_cpus(struct device *dev) add_more_links(dev, 1); /* Clear for take-off */ - if (mp_init_with_smm(dev->link_list, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(dev->link_list, &mp_ops); } diff --git a/src/soc/intel/elkhartlake/cpu.c b/src/soc/intel/elkhartlake/cpu.c index bfbb87f804..0fcc61d936 100644 --- a/src/soc/intel/elkhartlake/cpu.c +++ b/src/soc/intel/elkhartlake/cpu.c @@ -118,8 +118,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); diff --git a/src/soc/intel/icelake/cpu.c b/src/soc/intel/icelake/cpu.c index dea75b6ed4..203cddd69f 100644 --- a/src/soc/intel/icelake/cpu.c +++ b/src/soc/intel/icelake/cpu.c @@ -154,6 +154,6 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); } diff --git a/src/soc/intel/jasperlake/cpu.c b/src/soc/intel/jasperlake/cpu.c index 18194c99a2..9959bd5c63 100644 --- a/src/soc/intel/jasperlake/cpu.c +++ b/src/soc/intel/jasperlake/cpu.c @@ -120,8 +120,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); diff --git a/src/soc/intel/skylake/cpu.c b/src/soc/intel/skylake/cpu.c index 86e8e52797..91db06b3a6 100644 --- a/src/soc/intel/skylake/cpu.c +++ b/src/soc/intel/skylake/cpu.c @@ -215,8 +215,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); diff --git a/src/soc/intel/tigerlake/cpu.c b/src/soc/intel/tigerlake/cpu.c index f10f0cf85d..ce020ee151 100644 --- a/src/soc/intel/tigerlake/cpu.c +++ b/src/soc/intel/tigerlake/cpu.c @@ -126,8 +126,8 @@ static const struct mp_ops mp_ops = { void soc_init_cpus(struct bus *cpu_bus) { - if (mp_init_with_smm(cpu_bus, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(cpu_bus, &mp_ops); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); diff --git a/src/soc/intel/xeon_sp/cpx/cpu.c b/src/soc/intel/xeon_sp/cpx/cpu.c index 9746972a38..ba417a7060 100644 --- a/src/soc/intel/xeon_sp/cpx/cpu.c +++ b/src/soc/intel/xeon_sp/cpx/cpu.c @@ -212,8 +212,8 @@ void cpx_init_cpus(struct device *dev) intel_microcode_load_unlocked(microcode_patch); - if (mp_init_with_smm(dev->link_list, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(dev->link_list, &mp_ops); /* * chip_config is used in cpu device callback. Other than cpu 0, diff --git a/src/soc/intel/xeon_sp/skx/cpu.c b/src/soc/intel/xeon_sp/skx/cpu.c index 4d01740656..fcdb2d7ea0 100644 --- a/src/soc/intel/xeon_sp/skx/cpu.c +++ b/src/soc/intel/xeon_sp/skx/cpu.c @@ -231,8 +231,8 @@ void xeon_sp_init_cpus(struct device *dev) config_reset_cpl3_csrs(); /* calls src/cpu/x86/mp_init.c */ - if (mp_init_with_smm(dev->link_list, &mp_ops) != CB_SUCCESS) - printk(BIOS_ERR, "MP initialization failure.\n"); + /* TODO: Handle mp_init_with_smm failure? */ + mp_init_with_smm(dev->link_list, &mp_ops); /* update numa domain for all cpu devices */ xeonsp_init_cpu_config(); |