Ross Philipson
unread,Sep 13, 2024, 4:12:31 PMSep 13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to linux-...@vger.kernel.org, x...@kernel.org, linux-i...@vger.kernel.org, linu...@vger.kernel.org, linux-...@vger.kernel.org, ke...@lists.infradead.org, linu...@vger.kernel.org, io...@lists.linux-foundation.org, ross.ph...@oracle.com, dps...@apertussolutions.com, tg...@linutronix.de, mi...@redhat.com, b...@alien8.de, h...@zytor.com, dave....@linux.intel.com, ar...@kernel.org, mj...@srcf.ucam.org, James.B...@hansenpartnership.com, peter...@gmx.de, jar...@kernel.org, j...@ziepe.ca, lu...@amacapital.net, nive...@alum.mit.edu, her...@gondor.apana.org.au, da...@davemloft.net, cor...@lwn.net, ebie...@xmission.com, dw...@infradead.org, baol...@linux.intel.com, kanth.g...@oracle.com, andrew....@citrix.com, trenchbo...@googlegroups.com
If the MLE kernel is being powered off, rebooted or halted,
then SEXIT must be called. Note that the SEXIT GETSEC leaf
can only be called after a machine_shutdown() has been done on
these paths. The machine_shutdown() is not called on a few paths
like when poweroff action does not have a poweroff callback (into
ACPI code) or when an emergency reset is done. In these cases,
just the TXT registers are finalized but SEXIT is skipped.
Signed-off-by: Ross Philipson <
ross.ph...@oracle.com>
---
arch/x86/kernel/reboot.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 0e0a4cf6b5eb..c66e8896d516 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -13,6 +13,7 @@
#include <linux/objtool.h>
#include <linux/pgtable.h>
#include <linux/kexec.h>
+#include <linux/slaunch.h>
#include <acpi/reboot.h>
#include <asm/io.h>
#include <asm/apic.h>
@@ -778,6 +779,7 @@ static void native_machine_restart(char *__unused)
if (!reboot_force)
machine_shutdown();
+ slaunch_finalize(!reboot_force);
__machine_emergency_restart(0);
}
@@ -788,6 +790,9 @@ static void native_machine_halt(void)
tboot_shutdown(TB_SHUTDOWN_HALT);
+ /* SEXIT done after machine_shutdown() to meet TXT requirements */
+ slaunch_finalize(1);
+
stop_this_cpu(NULL);
}
@@ -796,8 +801,12 @@ static void native_machine_power_off(void)
if (kernel_can_power_off()) {
if (!reboot_force)
machine_shutdown();
+ slaunch_finalize(!reboot_force);
do_kernel_power_off();
+ } else {
+ slaunch_finalize(0);
}
+
/* A fallback in case there is no PM info available */
tboot_shutdown(TB_SHUTDOWN_HALT);
}
@@ -825,6 +834,7 @@ void machine_shutdown(void)
void machine_emergency_restart(void)
{
+ slaunch_finalize(0);
__machine_emergency_restart(1);
}
--
2.39.3