Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Arthur Heymans, Felix Held.
Fred Reitberger has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/64864 )
Change subject: amdblocks/smm.h: Add header guards
......................................................................
Patch Set 1:
(1 comment)
File src/soc/amd/common/block/include/amdblocks/smm.h:
https://review.coreboot.org/c/coreboot/+/64864/comment/ca1f9476_1f0bc4b0
PS1, Line 3: _AMDBLOCKS_SMM_H_
Is there a standard format for the header guards?
Looking over other headers in this folder, most are in the form "AMD_BLOCK_foo_H"
--
To view, visit https://review.coreboot.org/c/coreboot/+/64864
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5d01c36fa4695ee42d18701a90d1b96bceb5045f
Gerrit-Change-Number: 64864
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Comment-Date: Wed, 01 Jun 2022 13:05:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Arthur Heymans, Felix Held.
Fred Reitberger has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/64864 )
Change subject: amdblocks/smm.h: Add header guards
......................................................................
Patch Set 1: Code-Review+1
--
To view, visit https://review.coreboot.org/c/coreboot/+/64864
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I5d01c36fa4695ee42d18701a90d1b96bceb5045f
Gerrit-Change-Number: 64864
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Comment-Date: Wed, 01 Jun 2022 12:57:38 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Fred Reitberger, Felix Held.
build bot (Jenkins) has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/64870 )
Change subject: cpu/amd/smm: Move MP & SMM init in a common place
......................................................................
Patch Set 1:
(1 comment)
File src/cpu/amd/smm/smm_helper.c:
Robot Comment from checkpatch (run ID jenkins-coreboot-checkpatch-150333):
https://review.coreboot.org/c/coreboot/+/64870/comment/25e66519_ddec302a
PS1, Line 88: static void get_smm_info(uintptr_t *perm_smbase, size_t *perm_smsize, size_t *smm_save_state_size)
line length of 98 exceeds 96 columns
--
To view, visit https://review.coreboot.org/c/coreboot/+/64870
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7c457ab69581f8c29f2d79c054ca3bc7e58a896e
Gerrit-Change-Number: 64870
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-CC: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Comment-Date: Wed, 01 Jun 2022 12:57:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Paul Menzel, Kyösti Mälkki, Fred Reitberger, Felix Held.
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/64498 )
Change subject: soc/amd: Do SMM relocation via MSR
......................................................................
Patch Set 3:
(1 comment)
Patchset:
PS3:
CB:64872 is an alternative
--
To view, visit https://review.coreboot.org/c/coreboot/+/64498
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I31d4d4ae20e09da5739b6bf56e7b66857b4f1afe
Gerrit-Change-Number: 64498
Gerrit-PatchSet: 3
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-CC: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Paul Menzel <paulepanter(a)mailbox.org>
Gerrit-Attention: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Gerrit-Attention: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Comment-Date: Wed, 01 Jun 2022 12:55:51 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment
Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Fred Reitberger, Felix Held.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64872 )
Change subject: soc/amd: Do SMM relocation via MSR
......................................................................
soc/amd: Do SMM relocation via MSR
AMD CPUs have a convenient MSR that allows to set the SMBASE in the save
state without ever entering SMM (e.g. at the default 0x30000 address).
This has been a feature in all AMD CPUs since at least AMD K8. This
allows to do relocation in parallel in ramstage and without setting up a
relocation handler, which likely results in a speedup. The more cores
the higher the speedup as relocation was happening sequentially. On a 4
core AMD picasso system this results in 33ms boot speedup.
TESTED on google/vilboz (Picasso) with CONFIG_SMI_DEBUG: verify that SMM
is correctly relocated with the BSP correctly entering the smihandler.
Change-Id: I9729fb94ed5c18cfd57b8098c838c08a04490e4b
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/cpu/amd/smm/smm_helper.c
M src/cpu/x86/Kconfig
M src/cpu/x86/mp_init.c
M src/soc/amd/common/Kconfig.common
4 files changed, 25 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/64872/1
diff --git a/src/cpu/amd/smm/smm_helper.c b/src/cpu/amd/smm/smm_helper.c
index 585fe0d..7724791 100644
--- a/src/cpu/amd/smm/smm_helper.c
+++ b/src/cpu/amd/smm/smm_helper.c
@@ -112,9 +112,12 @@
{
setup_tseg();
- amd64_smm_state_save_area_t *smm_state;
- smm_state = (void *)(SMM_AMD64_SAVE_STATE_OFFSET + curr_smbase);
- smm_state->smbase = staggered_smbase;
+ uintptr_t smbase = smm_get_cpu_smbase(cpu_index());
+ msr_t msr = {
+ .hi = 0,
+ .lo = smbase
+ };
+ wrmsr(SMM_BASE_MSR, msr);
tseg_valid();
lock_smm();
diff --git a/src/cpu/x86/Kconfig b/src/cpu/x86/Kconfig
index 5b92795..28705c1 100644
--- a/src/cpu/x86/Kconfig
+++ b/src/cpu/x86/Kconfig
@@ -18,6 +18,13 @@
Allow APs to do other work after initialization instead of going
to sleep.
+config X86_SMM_RELOCATION_HANDLER
+ bool
+ def_bool y
+ help
+ Select this on platforms that do SMM relocation using a
+ relocation handler running in SMM with a stub at 0x30000.
+
config LEGACY_SMP_INIT
bool
diff --git a/src/cpu/x86/mp_init.c b/src/cpu/x86/mp_init.c
index e4e662e..f4c5cd0 100644
--- a/src/cpu/x86/mp_init.c
+++ b/src/cpu/x86/mp_init.c
@@ -755,6 +755,9 @@
static enum cb_err install_relocation_handler(int num_cpus, size_t save_state_size)
{
+ if (!CONFIG(X86_SMM_RELOCATION_HANDLER))
+ return CB_SUCCESS;
+
struct smm_loader_params smm_params = {
.num_cpus = num_cpus,
.cpu_save_state_size = save_state_size,
@@ -1137,7 +1140,7 @@
/* Sanity check SMM state. */
if (mp_state.perm_smsize != 0 && mp_state.smm_save_state_size != 0 &&
- mp_state.ops.relocation_handler != NULL)
+ (mp_state.ops.relocation_handler != NULL || !CONFIG(X86_SMM_RELOCATION_HANDLER)))
smm_enable();
if (is_smm_enabled())
@@ -1152,11 +1155,13 @@
mp_params.num_records = ARRAY_SIZE(mp_steps);
/* Perform backup of default SMM area. */
- default_smm_area = backup_default_smm_area();
+ if (CONFIG(X86_SMM_RELOCATION_HANDLER))
+ default_smm_area = backup_default_smm_area();
ret = mp_init(cpu_bus, &mp_params);
- restore_default_smm_area(default_smm_area);
+ if (CONFIG(X86_SMM_RELOCATION_HANDLER))
+ restore_default_smm_area(default_smm_area);
/* Signal callback on success if it's provided. */
if (ret == CB_SUCCESS && mp_state.ops.post_mp_init != NULL)
diff --git a/src/soc/amd/common/Kconfig.common b/src/soc/amd/common/Kconfig.common
index 5a84f2f..7583f9c 100644
--- a/src/soc/amd/common/Kconfig.common
+++ b/src/soc/amd/common/Kconfig.common
@@ -5,6 +5,10 @@
if SOC_AMD_COMMON
+# ALL AMD CPUs can relocate SMM via MSRC001_0111
+config X86_SMM_RELOCATION_HANDLER
+ default n
+
source "src/soc/amd/common/block/*/Kconfig"
source "src/soc/amd/common/fsp/Kconfig"
source "src/soc/amd/common/pi/Kconfig"
--
To view, visit https://review.coreboot.org/c/coreboot/+/64872
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I9729fb94ed5c18cfd57b8098c838c08a04490e4b
Gerrit-Change-Number: 64872
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-MessageType: newchange
Attention is currently required from: Marshall Dawson, Felix Held.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64869 )
Change subject: soc/amd/stoneyridge: Align get_cpu_count to other targets
......................................................................
soc/amd/stoneyridge: Align get_cpu_count to other targets
The CPUID function to get the number of cores on a package is common
across multiple generations of AMD cpus.
Change-Id: I28bff875ea2df7837e4495787cf8a4c2d522d43d
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/soc/amd/stoneyridge/cpu.c
1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/69/64869/1
diff --git a/src/soc/amd/stoneyridge/cpu.c b/src/soc/amd/stoneyridge/cpu.c
index b14b375..b5373bc 100644
--- a/src/soc/amd/stoneyridge/cpu.c
+++ b/src/soc/amd/stoneyridge/cpu.c
@@ -43,7 +43,7 @@
static int get_cpu_count(void)
{
- return (pci_read_config16(SOC_HT_DEV, D18F0_CPU_CNT) & CPU_CNT_MASK) + 1;
+ return 1 + (cpuid_ecx(0x80000008) & 0xff);
}
static const struct mp_ops mp_ops = {
--
To view, visit https://review.coreboot.org/c/coreboot/+/64869
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I28bff875ea2df7837e4495787cf8a4c2d522d43d
Gerrit-Change-Number: 64869
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-MessageType: newchange
Attention is currently required from: Jason Glenesk, Raul Rangel, Marshall Dawson, Fred Reitberger, Felix Held.
Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64867 )
Change subject: soc/amd/*: Move apm call out of MP init code
......................................................................
soc/amd/*: Move apm call out of MP init code
This makes it easier to have common code for MP init on AMD systems.
Change-Id: Icb6808edf96a17ec0b3073ba2486b3345a4a66ea
Signed-off-by: Arthur Heymans <arthur(a)aheymans.xyz>
---
M src/soc/amd/cezanne/cpu.c
M src/soc/amd/picasso/cpu.c
M src/soc/amd/sabrina/cpu.c
3 files changed, 17 insertions(+), 30 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/67/64867/1
diff --git a/src/soc/amd/cezanne/cpu.c b/src/soc/amd/cezanne/cpu.c
index 818e4d8..0e4d7c6 100644
--- a/src/soc/amd/cezanne/cpu.c
+++ b/src/soc/amd/cezanne/cpu.c
@@ -35,21 +35,12 @@
x86_mtrr_check();
}
-static void post_mp_init(void)
-{
- global_smi_enable();
-
- /* SMMINFO only needs to be set up when booting from S5 */
- if (!acpi_is_wakeup_s3())
- apm_control(APM_CNT_SMMINFO);
-}
-
static const struct mp_ops mp_ops = {
.pre_mp_init = pre_mp_init,
.get_cpu_count = get_cpu_count,
.get_smm_info = get_smm_info,
.relocation_handler = smm_relocation_handler,
- .post_mp_init = post_mp_init,
+ .post_mp_init = global_smi_enable,
};
void mp_init_cpus(struct bus *cpu_bus)
@@ -60,6 +51,10 @@
/* 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);
+
+ /* SMMINFO only needs to be set up when booting from S5 */
+ if (!acpi_is_wakeup_s3())
+ apm_control(APM_CNT_SMMINFO);
}
static void zen_2_3_init(struct device *dev)
diff --git a/src/soc/amd/picasso/cpu.c b/src/soc/amd/picasso/cpu.c
index f14ee49..e0daa33 100644
--- a/src/soc/amd/picasso/cpu.c
+++ b/src/soc/amd/picasso/cpu.c
@@ -39,21 +39,12 @@
x86_mtrr_check();
}
-static void post_mp_init(void)
-{
- global_smi_enable();
-
- /* SMMINFO only needs to be set up when booting from S5 */
- if (!acpi_is_wakeup_s3())
- apm_control(APM_CNT_SMMINFO);
-}
-
static const struct mp_ops mp_ops = {
.pre_mp_init = pre_mp_init,
.get_cpu_count = get_cpu_count,
.get_smm_info = get_smm_info,
.relocation_handler = smm_relocation_handler,
- .post_mp_init = post_mp_init,
+ .post_mp_init = global_smi_enable,
};
void mp_init_cpus(struct bus *cpu_bus)
@@ -64,6 +55,11 @@
/* 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);
+
+ /* SMMINFO only needs to be set up when booting from S5 */
+ if (!acpi_is_wakeup_s3())
+ apm_control(APM_CNT_SMMINFO);
+
}
static void model_17_init(struct device *dev)
diff --git a/src/soc/amd/sabrina/cpu.c b/src/soc/amd/sabrina/cpu.c
index 9893a8b..5d3539f 100644
--- a/src/soc/amd/sabrina/cpu.c
+++ b/src/soc/amd/sabrina/cpu.c
@@ -2,6 +2,7 @@
/* TODO: Check if this is still correct */
+#include <acpi/acpi.h>
#include <amdblocks/cpu.h>
#include <amdblocks/mca.h>
#include <amdblocks/reset.h>
@@ -37,21 +38,12 @@
x86_mtrr_check();
}
-static void post_mp_init(void)
-{
- global_smi_enable();
-
- /* SMMINFO only needs to be set up when booting from S5 */
- if (!acpi_is_wakeup_s3())
- apm_control(APM_CNT_SMMINFO);
-}
-
static const struct mp_ops mp_ops = {
.pre_mp_init = pre_mp_init,
.get_cpu_count = get_cpu_count,
.get_smm_info = get_smm_info,
.relocation_handler = smm_relocation_handler,
- .post_mp_init = post_mp_init,
+ .post_mp_init = global_smi_enable,
};
void mp_init_cpus(struct bus *cpu_bus)
@@ -62,6 +54,10 @@
/* 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);
+
+ /* SMMINFO only needs to be set up when booting from S5 */
+ if (!acpi_is_wakeup_s3())
+ apm_control(APM_CNT_SMMINFO);
}
static void zen_2_3_init(struct device *dev)
--
To view, visit https://review.coreboot.org/c/coreboot/+/64867
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Icb6808edf96a17ec0b3073ba2486b3345a4a66ea
Gerrit-Change-Number: 64867
Gerrit-PatchSet: 1
Gerrit-Owner: Arthur Heymans <arthur(a)aheymans.xyz>
Gerrit-Reviewer: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-Reviewer: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Reviewer: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Reviewer: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Reviewer: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Jason Glenesk <jason.glenesk(a)gmail.com>
Gerrit-Attention: Raul Rangel <rrangel(a)chromium.org>
Gerrit-Attention: Marshall Dawson <marshalldawson3rd(a)gmail.com>
Gerrit-Attention: Fred Reitberger <reitbergerfred(a)gmail.com>
Gerrit-Attention: Felix Held <felix-coreboot(a)felixheld.de>
Gerrit-MessageType: newchange