Skip to contentSkip to conversation

x86/fpu/init: Add __setup() functions back to fpu/init.c

PATCH In review Haoyu Tang 2 participants 4 messages Jan 11, 2019 x86

lore
Share & tools
lore

Haoyu Tang

author
#0 lore raw

PATCH 1/1 x86/fpu/init: Add __setup() functions back to fpu/init.c

__setup() functions were removed in:

commit 4f81cbafcce2 ("x86/fpu: Fix early FPU command-line parsing")

caused that FPU parameter is passed as an argument to init, the dummy __setup() functions can avoid this.

---
 arch/x86/kernel/fpu/init.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
arch/x86/kernel/fpu/init.c +36 -0
index 6abd835..df325d0 100644
@@ -301,3 +301,39 @@ void __init fpu__init_system(struct cpuinfo_x86 *c)
 
 	fpu__init_system_ctx_switch();
 }
+
+/* Although parse fpu parameters early before parse_early_param(),but
+ * __setup() is still mandatory in order not to pass fpu parameters
+ * into init as argument. At here, the interfaces don't need to set
+ * registers again, they are only used to indicate parse_args() that
+ * the parameter has been consumed.
+ */
+static int __init no_387(char *s)
+{
+	return 1;
+}
+__setup("no387", no_387);
+
+static int __init x86_noxsave_setup(char *s)
+{
+	return 1;
+}
+__setup("noxsave", x86_noxsave_setup);
+
+static int __init x86_noxsaveopt_setup(char *s)
+{
+	return 1;
+}
+__setup("noxsaveopt", x86_noxsaveopt_setup);
+
+static int __init x86_noxsaves_setup(char *s)
+{
+	return 1;
+}
+__setup("noxsaves", x86_noxsaves_setup);
+
+static int __init x86_nofxsr_setup(char *s)
+{
+	return 1;
+}
+__setup("nofxsr", x86_nofxsr_setup);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 6 lines · Haoyu Tang

__setup() functions were removed in:

commit 4f81cbafcce2 ("x86/fpu: Fix early FPU command-line parsing")

caused that FPU parameter is passed as an argument to init, the dummy __setup() functions can avoid this.

why is that bad?

Sebastian

#2 lore raw

It doesn't consistent with document: https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html
I met an init which didn't accept unknown arguments.

Haoyu

-----Original Message-----
From: Sebastian Andrzej Siewior [mailto:[email protected]]
Sent: Friday, January 11, 2019 4:12 PM
To: Tang, Haoyu <[email protected]>
Cc: Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; Borislav Petkov <[email protected]>; H. Peter Anvin <[email protected]>; [email protected]; Andy Lutomirski <[email protected]>; Nicolai Stange <[email protected]>; [email protected]
Subject: Re: [PATCH] x86/fpu/init: Add __setup() functions back to fpu/init.c

Quoted 6 lines · Haoyu Tang

__setup() functions were removed in:

commit 4f81cbafcce2 ("x86/fpu: Fix early FPU command-line parsing")

caused that FPU parameter is passed as an argument to init, the dummy __setup() functions can avoid this.

why is that bad?

Sebastian