coreboot-kgpe-d16/src/soc/amd/picasso/finalize.c
Patrick Rudolph 5ec97cea67 soc/*: mp_run_on_all_cpus: Remove configurable timeout
Some timeouts given were too small when serial console is enabled due to
its spinlock making code runtime worse with every AP present.

In addition we usually don't know how long specific code runs and how
long ago it was sent to the APs.

Remove the timeout argument from mp_run_on_all_cpus and instead wait up
to 1 second, to prevent possible crashing of secondary APs still
processing the old job.

Tested on Supermicro X11SSH-TF.

Change-Id: I456be647b159f7a2ea7d94986a24424e56dcc8c4
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34587
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Philipp Deppenwiese <zaolin.daisuki@gmail.com>
2019-08-15 06:45:34 +00:00

60 lines
1.5 KiB
C

/*
* This file is part of the coreboot project.
*
* Copyright (C) 2018 Advanced Micro Devices, Inc.
*
* 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
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <cpu/x86/mp.h>
#include <cpu/x86/msr.h>
#include <cpu/amd/msr.h>
#include <bootstate.h>
#include <timer.h>
#include <console/console.h>
static void per_core_finalize(void *unused)
{
msr_t hwcr, mask;
/* Finalize SMM settings */
hwcr = rdmsr(HWCR_MSR);
if (hwcr.lo & SMM_LOCK) /* Skip if already locked, avoid GPF */
return;
if (CONFIG(HAVE_SMI_HANDLER)) {
mask = rdmsr(SMM_MASK_MSR);
mask.lo |= SMM_TSEG_VALID;
wrmsr(SMM_MASK_MSR, mask);
}
hwcr.lo |= SMM_LOCK;
wrmsr(HWCR_MSR, hwcr);
}
static void finalize_cores(void)
{
int r;
printk(BIOS_SPEW, "Lock SMM configuration\n");
r = mp_run_on_all_cpus(per_core_finalize, NULL);
if (r)
printk(BIOS_WARNING, "Failed to finalize all cores\n");
}
static void soc_finalize(void *unused)
{
finalize_cores();
post_code(POST_OS_BOOT);
}
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL);
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL);