linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/tsc: Make recalibrate_cpu_khz() export GPL only
@ 2022-12-17 17:05 Borislav Petkov
  2022-12-18 20:52 ` [PATCH -v1.1 1/2] " Borislav Petkov
  2022-12-18 20:53 ` [PATCH 2/2] x86/tsc: Do feature check as the very first thing Borislav Petkov
  0 siblings, 2 replies; 5+ messages in thread
From: Borislav Petkov @ 2022-12-17 17:05 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: "Borislav Petkov (AMD)" <bp@alien8.de>

A quick search doesn't reveal any use outside of the kernel - which
would be questionable to begin with anyway - so make the export GPL
only.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
 arch/x86/kernel/tsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a78e73da4a74..8979df1959d3 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -913,7 +913,7 @@ void recalibrate_cpu_khz(void)
 #endif
 }
 
-EXPORT_SYMBOL(recalibrate_cpu_khz);
+EXPORT_SYMBOL_GPL(recalibrate_cpu_khz);
 
 
 static unsigned long long cyc2ns_suspend;
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH -v1.1 1/2] x86/tsc: Make recalibrate_cpu_khz() export GPL only
  2022-12-17 17:05 [PATCH] x86/tsc: Make recalibrate_cpu_khz() export GPL only Borislav Petkov
@ 2022-12-18 20:52 ` Borislav Petkov
  2023-02-11 10:01   ` [tip: x86/cleanups] " tip-bot2 for Borislav Petkov (AMD)
  2022-12-18 20:53 ` [PATCH 2/2] x86/tsc: Do feature check as the very first thing Borislav Petkov
  1 sibling, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2022-12-18 20:52 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

v1.1 which removes a stray newline  too.

---
From: "Borislav Petkov (AMD)" <bp@alien8.de>

A quick search doesn't reveal any use outside of the kernel - which
would be questionable to begin with anyway - so make the export GPL
only.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
 arch/x86/kernel/tsc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a78e73da4a74..eaeffef93a12 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -912,8 +912,7 @@ void recalibrate_cpu_khz(void)
 						    cpu_khz_old, cpu_khz);
 #endif
 }
-
-EXPORT_SYMBOL(recalibrate_cpu_khz);
+EXPORT_SYMBOL_GPL(recalibrate_cpu_khz);
 
 
 static unsigned long long cyc2ns_suspend;
-- 
2.35.1


-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] x86/tsc: Do feature check as the very first thing
  2022-12-17 17:05 [PATCH] x86/tsc: Make recalibrate_cpu_khz() export GPL only Borislav Petkov
  2022-12-18 20:52 ` [PATCH -v1.1 1/2] " Borislav Petkov
@ 2022-12-18 20:53 ` Borislav Petkov
  2023-02-11 10:01   ` [tip: x86/cleanups] " tip-bot2 for Borislav Petkov (AMD)
  1 sibling, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2022-12-18 20:53 UTC (permalink / raw)
  To: X86 ML; +Cc: LKML

From: "Borislav Petkov (AMD)" <bp@alien8.de>

Do the feature check as the very first thing in the function. Everything
else comes after that and is meaningless work if the TSC CPUID bit is
not even set.

No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
---
 arch/x86/kernel/tsc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index eaeffef93a12..1d509c8b3556 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1509,6 +1509,11 @@ void __init tsc_early_init(void)
 
 void __init tsc_init(void)
 {
+	if (!boot_cpu_has(X86_FEATURE_TSC)) {
+		setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
+		return;
+	}
+
 	/*
 	 * native_calibrate_cpu_early can only calibrate using methods that are
 	 * available early in boot.
@@ -1516,11 +1521,6 @@ void __init tsc_init(void)
 	if (x86_platform.calibrate_cpu == native_calibrate_cpu_early)
 		x86_platform.calibrate_cpu = native_calibrate_cpu;
 
-	if (!boot_cpu_has(X86_FEATURE_TSC)) {
-		setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
-		return;
-	}
-
 	if (!tsc_khz) {
 		/* We failed to determine frequencies earlier, try again */
 		if (!determine_cpu_tsc_frequencies(false)) {
-- 
2.35.1


-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip: x86/cleanups] x86/tsc: Make recalibrate_cpu_khz() export GPL only
  2022-12-18 20:52 ` [PATCH -v1.1 1/2] " Borislav Petkov
@ 2023-02-11 10:01   ` tip-bot2 for Borislav Petkov (AMD)
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2023-02-11 10:01 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Borislav Petkov (AMD), x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     8fe6d84947582e2c076abc6253b80709fb047935
Gitweb:        https://git.kernel.org/tip/8fe6d84947582e2c076abc6253b80709fb047935
Author:        Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate:    Sun, 18 Dec 2022 21:52:42 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Sat, 11 Feb 2023 10:44:07 +01:00

x86/tsc: Make recalibrate_cpu_khz() export GPL only

A quick search doesn't reveal any use outside of the kernel - which
would be questionable to begin with anyway - so make the export GPL
only.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/Y599miBzWRAuOwhg@zn.tnic
---
 arch/x86/kernel/tsc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index a78e73d..eaeffef 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -912,8 +912,7 @@ void recalibrate_cpu_khz(void)
 						    cpu_khz_old, cpu_khz);
 #endif
 }
-
-EXPORT_SYMBOL(recalibrate_cpu_khz);
+EXPORT_SYMBOL_GPL(recalibrate_cpu_khz);
 
 
 static unsigned long long cyc2ns_suspend;

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [tip: x86/cleanups] x86/tsc: Do feature check as the very first thing
  2022-12-18 20:53 ` [PATCH 2/2] x86/tsc: Do feature check as the very first thing Borislav Petkov
@ 2023-02-11 10:01   ` tip-bot2 for Borislav Petkov (AMD)
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Borislav Petkov (AMD) @ 2023-02-11 10:01 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Borislav Petkov (AMD), x86, linux-kernel

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     6b8d5dde5b6903baf82fc7400e0b3376b10805b4
Gitweb:        https://git.kernel.org/tip/6b8d5dde5b6903baf82fc7400e0b3376b10805b4
Author:        Borislav Petkov (AMD) <bp@alien8.de>
AuthorDate:    Sun, 18 Dec 2022 21:53:36 +01:00
Committer:     Borislav Petkov (AMD) <bp@alien8.de>
CommitterDate: Sat, 11 Feb 2023 10:44:07 +01:00

x86/tsc: Do feature check as the very first thing

Do the feature check as the very first thing in the function. Everything
else comes after that and is meaningless work if the TSC CPUID bit is
not even set. Switch to cpu_feature_enabled() too, while at it.

No functional changes.

Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/Y5990CUCuWd5jfBH@zn.tnic
---
 arch/x86/kernel/tsc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index eaeffef..aff1d79 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -1509,6 +1509,11 @@ void __init tsc_early_init(void)
 
 void __init tsc_init(void)
 {
+	if (!cpu_feature_enabled(X86_FEATURE_TSC)) {
+		setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
+		return;
+	}
+
 	/*
 	 * native_calibrate_cpu_early can only calibrate using methods that are
 	 * available early in boot.
@@ -1516,11 +1521,6 @@ void __init tsc_init(void)
 	if (x86_platform.calibrate_cpu == native_calibrate_cpu_early)
 		x86_platform.calibrate_cpu = native_calibrate_cpu;
 
-	if (!boot_cpu_has(X86_FEATURE_TSC)) {
-		setup_clear_cpu_cap(X86_FEATURE_TSC_DEADLINE_TIMER);
-		return;
-	}
-
 	if (!tsc_khz) {
 		/* We failed to determine frequencies earlier, try again */
 		if (!determine_cpu_tsc_frequencies(false)) {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-02-11 10:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-17 17:05 [PATCH] x86/tsc: Make recalibrate_cpu_khz() export GPL only Borislav Petkov
2022-12-18 20:52 ` [PATCH -v1.1 1/2] " Borislav Petkov
2023-02-11 10:01   ` [tip: x86/cleanups] " tip-bot2 for Borislav Petkov (AMD)
2022-12-18 20:53 ` [PATCH 2/2] x86/tsc: Do feature check as the very first thing Borislav Petkov
2023-02-11 10:01   ` [tip: x86/cleanups] " tip-bot2 for Borislav Petkov (AMD)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).