[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240530192739.172566-4-chang.seok.bae@intel.com>
Date: Thu, 30 May 2024 12:27:39 -0700
From: "Chang S. Bae" <chang.seok.bae@...el.com>
To: linux-kernel@...r.kernel.org
Cc: x86@...nel.org,
platform-driver-x86@...r.kernel.org,
tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com,
hdegoede@...hat.com,
ilpo.jarvinen@...ux.intel.com,
tony.luck@...el.com,
ashok.raj@...el.com,
jithu.joseph@...el.com,
sathyanarayanan.kuppuswamy@...ux.intel.com,
chang.seok.bae@...el.com
Subject: [PATCH v3 3/3] platform/x86/intel/ifs: Initialize FPU states for the scan test
The In-Field Scan process aborts if AMX state is not in initialized
state. Use fpu_reset_fpregs() to ensure AMX state is initialized before
entering the rendezvous loop.
Suggested-by: Dave Hansen <dave.hansen@...ux.intel.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@...el.com>
Tested-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@...ux.intel.com>
---
V2 -> V3: Use fpu_reset_user_fpregs().
Thanks to everyone who provided tags on previous versions. Due
to the code change, I felt it necessary to revoke them, but the
high-level logic remains the same.
V1 -> V2: Revised the changelog (Ashok), added a space to the code comment
(Ilpo), and included the header file explicitly (0-day).
---
drivers/platform/x86/intel/ifs/ifs.h | 1 +
drivers/platform/x86/intel/ifs/runtest.c | 7 +++++++
2 files changed, 8 insertions(+)
diff --git a/drivers/platform/x86/intel/ifs/ifs.h b/drivers/platform/x86/intel/ifs/ifs.h
index 56b9f3e3cf76..5e7ba94b4054 100644
--- a/drivers/platform/x86/intel/ifs/ifs.h
+++ b/drivers/platform/x86/intel/ifs/ifs.h
@@ -129,6 +129,7 @@
*/
#include <linux/device.h>
#include <linux/miscdevice.h>
+#include <asm/fpu/api.h>
#define MSR_ARRAY_BIST 0x00000105
#define MSR_COPY_SCAN_HASHES 0x000002c2
diff --git a/drivers/platform/x86/intel/ifs/runtest.c b/drivers/platform/x86/intel/ifs/runtest.c
index 282e4bfe30da..68e128ea57ed 100644
--- a/drivers/platform/x86/intel/ifs/runtest.c
+++ b/drivers/platform/x86/intel/ifs/runtest.c
@@ -191,6 +191,10 @@ static int doscan(void *data)
/* Only the first logical CPU on a core reports result */
first = cpumask_first(cpu_smt_mask(cpu));
+ /* Prepare FPU state before entering the rendezvous loop */
+ kernel_fpu_begin();
+ fpu_reset_fpregs();
+
wait_for_sibling_cpu(&scan_cpus_in, NSEC_PER_SEC);
/*
@@ -202,6 +206,9 @@ static int doscan(void *data)
* are processed in a single pass) before it retires.
*/
wrmsrl(MSR_ACTIVATE_SCAN, params->activate->data);
+
+ kernel_fpu_end();
+
rdmsrl(MSR_SCAN_STATUS, status.data);
trace_ifs_status(ifsd->cur_batch, start, stop, status.data);
--
2.34.1
Powered by blists - more mailing lists