Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 22 Mar 2018 18:24:00 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r331365 - in head/sys: amd64/amd64 dev/efidev
Message-ID:  <201803221824.w2MIO0EL032986@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Mar 22 18:24:00 2018
New Revision: 331365
URL: https://svnweb.freebsd.org/changeset/base/331365

Log:
  Re-work efidev ordering to fix efirt preloaded by loader on amd64
  
  On amd64, efi_enter calls fpu_kern_enter(). This may not be called until
  fpuinitstate has been invoked, resulting in a kernel panic with
  efirt_load="YES" in loader.conf(5).
  
  Move fpuinitstate a little earlier in SI_SUB_DRIVERS so that we can squeeze
  efirt between it and efirtc at SI_SUB_DRIVERS, SI_ORDER_ANY. efidev must be
  after efirt and doesn't really need to be at SI_SUB_DEVFS, so drop it at
  SI_SUB_DRIVER, SI_ORDER_ANY.
  
  The not immediately obvious dependency of fpuinitstate by efirt has been
  noted in both places.
  
  Discussed with:	kib, andrew
  Reported by:	Jakob Alvermark <jakob@alvermark.net>
  X-MFC-With:	r330868

Modified:
  head/sys/amd64/amd64/fpu.c
  head/sys/dev/efidev/efidev.c
  head/sys/dev/efidev/efirt.c

Modified: head/sys/amd64/amd64/fpu.c
==============================================================================
--- head/sys/amd64/amd64/fpu.c	Thu Mar 22 17:49:27 2018	(r331364)
+++ head/sys/amd64/amd64/fpu.c	Thu Mar 22 18:24:00 2018	(r331365)
@@ -366,7 +366,8 @@ fpuinitstate(void *arg __unused)
 	start_emulating();
 	intr_restore(saveintr);
 }
-SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_ANY, fpuinitstate, NULL);
+/* EFIRT needs this to be initialized before we can enter our EFI environment */
+SYSINIT(fpuinitstate, SI_SUB_DRIVERS, SI_ORDER_FIRST, fpuinitstate, NULL);
 
 /*
  * Free coprocessor (if we have it).

Modified: head/sys/dev/efidev/efidev.c
==============================================================================
--- head/sys/dev/efidev/efidev.c	Thu Mar 22 17:49:27 2018	(r331364)
+++ head/sys/dev/efidev/efidev.c	Thu Mar 22 18:24:00 2018	(r331365)
@@ -216,6 +216,6 @@ static moduledata_t efidev_moddata = {
 	.priv = NULL,
 };
 
-DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DEVFS, SI_ORDER_ANY);
+DECLARE_MODULE(efidev, efidev_moddata, SI_SUB_DRIVERS, SI_ORDER_ANY);
 MODULE_VERSION(efidev, 1);
 MODULE_DEPEND(efidev, efirt, 1, 1, 1);

Modified: head/sys/dev/efidev/efirt.c
==============================================================================
--- head/sys/dev/efidev/efirt.c	Thu Mar 22 17:49:27 2018	(r331364)
+++ head/sys/dev/efidev/efirt.c	Thu Mar 22 18:24:00 2018	(r331365)
@@ -450,5 +450,6 @@ static moduledata_t efirt_moddata = {
 	.evhand = efirt_modevents,
 	.priv = NULL,
 };
-DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_VM_CONF, SI_ORDER_ANY);
+/* After fpuinitstate, before efidev */
+DECLARE_MODULE(efirt, efirt_moddata, SI_SUB_DRIVERS, SI_ORDER_SECOND);
 MODULE_VERSION(efirt, 1);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803221824.w2MIO0EL032986>