From: "Chang S. Bae" <chang.seok.bae@intel.com>
To: linux-kernel@vger.kernel.org
Cc: x86@kernel.org, platform-driver-x86@vger.kernel.org,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, hdegoede@redhat.com,
ilpo.jarvinen@linux.intel.com, tony.luck@intel.com,
ashok.raj@intel.com, jithu.joseph@intel.com,
sathyanarayanan.kuppuswamy@linux.intel.com,
chang.seok.bae@intel.com
Subject: [PATCH v3 3/3] platform/x86/intel/ifs: Initialize FPU states for the scan test
Date: Thu, 30 May 2024 12:27:39 -0700 [thread overview]
Message-ID: <20240530192739.172566-4-chang.seok.bae@intel.com> (raw)
In-Reply-To: <20240530192739.172566-1-chang.seok.bae@intel.com>
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@linux.intel.com>
Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
Tested-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.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
next prev parent reply other threads:[~2024-05-30 19:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-30 19:27 [PATCH v3 0/3] x86/fpu: Allow the In-Field Scan driver to initialize FPU state Chang S. Bae
2024-05-30 19:27 ` [PATCH v3 1/3] x86/fpu: Rename fpu_reset_fpregs() to fpu_reset_fpstate_regs() Chang S. Bae
2024-05-30 19:27 ` [PATCH v3 2/3] x86/fpu: Allow FPU users to initialize FPU state Chang S. Bae
2024-05-30 19:27 ` Chang S. Bae [this message]
2024-06-03 10:11 ` [PATCH v3 0/3] x86/fpu: Allow the In-Field Scan driver " Ilpo Järvinen
2024-06-03 12:10 ` Dave Hansen
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=20240530192739.172566-4-chang.seok.bae@intel.com \
--to=chang.seok.bae@intel.com \
--cc=ashok.raj@intel.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jithu.joseph@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®