All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Glass <sjg@chromium.org>
To: u-boot@lists.denx.de
Subject: [PATCH v2 01/26] x86: fsp: Reinit the FPU after FSP meminit
Date: Sun, 24 May 2020 19:48:38 -0600	[thread overview]
Message-ID: <20200525014904.115621-2-sjg@chromium.org> (raw)
In-Reply-To: <20200525014904.115621-1-sjg@chromium.org>

The APL FSP appears to leave the FPU in a bad state in that it has
registers in use. This causes an error when the next FPU operation is
performed.

Work around this by re-resetting the FPU after calling FSP-M. This allows
the freetype console to work correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

Changes in v2: None

 arch/x86/cpu/i386/cpu.c           | 5 +++++
 arch/x86/include/asm/u-boot-x86.h | 8 ++++++++
 arch/x86/lib/fsp2/fsp_meminit.c   | 1 +
 3 files changed, 14 insertions(+)

diff --git a/arch/x86/cpu/i386/cpu.c b/arch/x86/cpu/i386/cpu.c
index 435e50edad..d27324cb4e 100644
--- a/arch/x86/cpu/i386/cpu.c
+++ b/arch/x86/cpu/i386/cpu.c
@@ -363,6 +363,11 @@ static void setup_cpu_features(void)
 	: : "i" (em_rst), "i" (mp_ne_set) : "eax");
 }
 
+void cpu_reinit_fpu(void)
+{
+	asm ("fninit\n");
+}
+
 static void setup_identity(void)
 {
 	/* identify CPU via cpuid and store the decoded info into gd->arch */
diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h
index 3e5d56d075..bd3f44014c 100644
--- a/arch/x86/include/asm/u-boot-x86.h
+++ b/arch/x86/include/asm/u-boot-x86.h
@@ -43,6 +43,14 @@ int x86_cpu_reinit_f(void);
  */
 int x86_cpu_init_tpl(void);
 
+/**
+ * cpu_reinit_fpu() - Reinit the FPU if something is wrong with it
+ *
+ * The FSP-M code can leave registers in use in the FPU. This functions reinits
+ * it so that the FPU can be used safely
+ */
+void cpu_reinit_fpu(void);
+
 int cpu_init_f(void);
 void setup_gdt(struct global_data *id, u64 *gdt_addr);
 /*
diff --git a/arch/x86/lib/fsp2/fsp_meminit.c b/arch/x86/lib/fsp2/fsp_meminit.c
index 1a758147b0..faf9c29aef 100644
--- a/arch/x86/lib/fsp2/fsp_meminit.c
+++ b/arch/x86/lib/fsp2/fsp_meminit.c
@@ -85,6 +85,7 @@ int fsp_memory_init(bool s3wake, bool use_spi_flash)
 	func = (fsp_memory_init_func)(hdr->img_base + hdr->fsp_mem_init);
 	ret = func(&upd, &hob);
 	bootstage_accum(BOOTSTAGE_ID_ACCUM_FSP_M);
+	cpu_reinit_fpu();
 	if (ret)
 		return log_msg_ret("SDRAM init fail\n", ret);
 
-- 
2.27.0.rc0.183.gde8f92d652-goog

  reply	other threads:[~2020-05-25  1:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-25  1:48 [PATCH v2 00/26] x86: video: Speed up the framebuffer Simon Glass
2020-05-25  1:48 ` Simon Glass [this message]
2020-05-25  1:48 ` [PATCH v2 02/26] console: Add a way to output to serial only Simon Glass
2020-05-25  1:48 ` [PATCH v2 03/26] video: Show an error when a vidconsole function fails Simon Glass
2020-05-25  1:48 ` [PATCH v2 04/26] sandbox: video: Allow selection of rotated console Simon Glass
2020-05-25  1:48 ` [PATCH v2 05/26] video: Split out expression parts into variables Simon Glass
2020-05-25  1:48 ` [PATCH v2 06/26] video: Adjust rotated console to start at right edge Simon Glass
2020-05-25  1:48 ` [PATCH v2 07/26] video: Drop unnecessary #ifdef around vid_console_color() Simon Glass
2020-05-25  1:48 ` [PATCH v2 08/26] video: Add a comment for struct video_uc_platdata Simon Glass
2020-05-25  1:48 ` [PATCH v2 09/26] video: Add support for copying to a hardware framebuffer Simon Glass
2020-05-25  1:48 ` [PATCH v2 10/26] video: Set up the copy framebuffer when enabled Simon Glass
2020-05-25  1:48 ` [PATCH v2 11/26] video: Clear the copy framebuffer when clearing the screen Simon Glass
2020-05-25  1:48 ` [PATCH v2 12/26] video: Add helpers for vidconsole for the copy framebuffer Simon Glass
2020-05-25  1:48 ` [PATCH v2 13/26] video: Update normal console to support copy buffer Simon Glass
2020-05-25  1:48 ` [PATCH v2 14/26] video: Update truetype " Simon Glass
2020-05-25  1:48 ` [PATCH v2 15/26] video: Update rotated " Simon Glass
2020-05-25  1:48 ` [PATCH v2 16/26] video: Update the copy framebuffer when writing bitmaps Simon Glass
2020-05-25  1:48 ` [PATCH v2 17/26] video: Add comments to struct sandbox_sdl_plat Simon Glass
2020-05-25  1:48 ` [PATCH v2 18/26] video: sandbox: Add support for the copy framebuffer Simon Glass
2020-05-25  1:48 ` [PATCH v2 19/26] video: pci: Set up " Simon Glass
2020-05-25  1:48 ` [PATCH v2 20/26] x86: fsp: video: Allocate a frame buffer when needed Simon Glass
2020-05-25  1:48 ` [PATCH v2 21/26] video: Correctly handle multiple framebuffers Simon Glass
2020-05-25  1:48 ` [PATCH v2 22/26] x86: video: Support copy framebuffer with probed devices Simon Glass
2020-05-25  1:49 ` [PATCH v2 23/26] chromebook_samus: Enable the copy framebuffer Simon Glass
2020-05-25  1:49 ` [PATCH v2 24/26] chromebook_link: " Simon Glass
2020-05-25  1:49 ` [PATCH v2 25/26] minnowmax: " Simon Glass
2020-05-25  1:49 ` [PATCH v2 26/26] x86: minnowmax: Drop screen resolution to 1024x768 Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200525014904.115621-2-sjg@chromium.org \
    --to=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.