diff options
author | Aaron Durbin <adurbin@chromium.org> | 2013-05-28 14:26:29 -0500 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-06-03 17:30:48 +0200 |
commit | 66da043e48c65e6d89b385d840e5f7c53e482db9 (patch) | |
tree | 08a1e3acfa427d8c8d71b417a6cd15554248a25a /src/cpu/intel/haswell/smmrelocate.c | |
parent | 27435d3bcdd4c7bccb326f77ca64a54d3fb1170a (diff) |
haswell: allow for disabled hyperthreading
There were assumptions being made in the haswell
MP and SMM code which assumed the APIC id space
was 1:1 w.r.t. cpu number. When hyperthreading is
disabled the APIC ids of the logical processors
are all even. That means the APIC id space is sparse.
Handle this situation.
Change-Id: Ibe79ab156c0a171208a77db8a252aa5b73205d6c
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/3353
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/cpu/intel/haswell/smmrelocate.c')
-rw-r--r-- | src/cpu/intel/haswell/smmrelocate.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/cpu/intel/haswell/smmrelocate.c b/src/cpu/intel/haswell/smmrelocate.c index 6caeafa5e1..4fe6489be2 100644 --- a/src/cpu/intel/haswell/smmrelocate.c +++ b/src/cpu/intel/haswell/smmrelocate.c @@ -286,6 +286,22 @@ static void fill_in_relocation_params(device_t dev, params->uncore_emrr_mask.hi = (1 << (39 - 32)) - 1; } +static void adjust_apic_id_map(struct smm_loader_params *smm_params) +{ + struct smm_runtime *runtime; + int i; + + /* Adjust the APIC id map if HT is disabled. */ + if (!ht_disabled) + return; + + runtime = smm_params->runtime; + + /* The APIC ids increment by 2 when HT is disabled. */ + for (i = 0; i < CONFIG_MAX_CPUS; i++) + runtime->apic_id_to_cpu[i] = runtime->apic_id_to_cpu[i] * 2; +} + static int install_relocation_handler(int num_cpus, struct smm_relocation_params *relo_params) { @@ -305,7 +321,12 @@ static int install_relocation_handler(int num_cpus, .handler_arg = (void *)relo_params, }; - return smm_setup_relocation_handler(&smm_params); + if (smm_setup_relocation_handler(&smm_params)) + return -1; + + adjust_apic_id_map(&smm_params); + + return 0; } static void setup_ied_area(struct smm_relocation_params *params) @@ -347,8 +368,13 @@ static int install_permanent_handler(int num_cpus, printk(BIOS_DEBUG, "Installing SMM handler to 0x%08x\n", relo_params->smram_base); - return smm_load_module((void *)relo_params->smram_base, - relo_params->smram_size, &smm_params); + if (smm_load_module((void *)relo_params->smram_base, + relo_params->smram_size, &smm_params)) + return -1; + + adjust_apic_id_map(&smm_params); + + return 0; } static int cpu_smm_setup(void) |