[coreboot-gerrit] Change in coreboot[master]: kahlee: Make CPU1 handle all SMIs

Raul Rangel (Code Review) gerrit at coreboot.org
Wed Jun 6 22:30:48 CEST 2018


Raul Rangel has uploaded this change for review. ( https://review.coreboot.org/26927


Change subject: kahlee: Make CPU1 handle all SMIs
......................................................................

kahlee: Make CPU1 handle all SMIs

If CPU0 handles the ELOG_GSMI_APM_CNT SMI after the SMI handler
completes, the system will reboot. Forcing CPU1 to always handle the SMI
fixes the issue. I have not been able to find an explanation for this.

I realize this is a terrible and ugly hack but it makes it possible to
shutdown consistently.

BUG=b:80539294
TEST=built on grunt and tried `halt` a few times in a row.

Change-Id: Ibb2784648a8e827887170f34a01dcd5f411522e2
Signed-off-by: Raul E Rangel <rrangel at chromium.org>
---
M src/cpu/x86/smm/smm_module_handler.c
1 file changed, 20 insertions(+), 3 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/27/26927/1

diff --git a/src/cpu/x86/smm/smm_module_handler.c b/src/cpu/x86/smm/smm_module_handler.c
index c2001ec..46c4a7e 100644
--- a/src/cpu/x86/smm/smm_module_handler.c
+++ b/src/cpu/x86/smm/smm_module_handler.c
@@ -117,6 +117,13 @@
 	return base;
 }
 
+static void pause(void)
+{
+	asm volatile (
+		".byte 0xf3, 0x90\n" /* PAUSE */
+	);
+}
+
 asmlinkage void smm_handler_start(void *arg)
 {
 	const struct smm_module_params *p;
@@ -139,14 +146,24 @@
 		return;
 	}
 
+#if defined(CONFIG_BOARD_GOOGLE_BASEBOARD_KAHLEE)
+	/*
+	 * Force CPU 1 to handle all SMIs. We need to do this because if CPU0
+	 * handles an SMI for ELOG_GSMI_APM_CNT it will cause the system to
+	 * reboot.
+	 */
+	while (cpu == 0 && smi_handler_status == SMI_UNLOCKED) {
+		// Wait for the other CPU to get the lock
+		pause();
+	}
+#endif
+
 	/* Are we ok to execute the handler? */
 	if (!smi_obtain_lock()) {
 		/* For security reasons we don't release the other CPUs
 		 * until the CPU with the lock is actually done */
 		while (smi_handler_status == SMI_LOCKED) {
-			asm volatile (
-				".byte 0xf3, 0x90\n" /* PAUSE */
-			);
+			pause();
 		}
 		return;
 	}

-- 
To view, visit https://review.coreboot.org/26927
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibb2784648a8e827887170f34a01dcd5f411522e2
Gerrit-Change-Number: 26927
Gerrit-PatchSet: 1
Gerrit-Owner: Raul Rangel <rrangel at chromium.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180606/d3824635/attachment.html>


More information about the coreboot-gerrit mailing list