linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/apb_timer: drop unused TSC calibration
@ 2020-05-13 10:09 Johan Hovold
  2020-05-13 10:09 ` [PATCH 2/2] x86/apb_timer: drop unused declaration and macro Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Johan Hovold @ 2020-05-13 10:09 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov
  Cc: x86, H. Peter Anvin, linux-kernel, Johan Hovold

Drop the APB-timer TSC calibration, which hasn't been used since the
removal of Moorestown support by commit 1a8359e411eb ("x86/mid: Remove
Intel Moorestown").

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 arch/x86/include/asm/apb_timer.h |  2 --
 arch/x86/kernel/apb_timer.c      | 53 --------------------------------
 2 files changed, 55 deletions(-)

diff --git a/arch/x86/include/asm/apb_timer.h b/arch/x86/include/asm/apb_timer.h
index 99bb207fc04c..0a9bf8b77a28 100644
--- a/arch/x86/include/asm/apb_timer.h
+++ b/arch/x86/include/asm/apb_timer.h
@@ -28,7 +28,6 @@
 #define APBT_DEV_USED  1
 
 extern void apbt_time_init(void);
-extern unsigned long apbt_quick_calibrate(void);
 extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
 extern void apbt_setup_secondary_clock(void);
 
@@ -38,7 +37,6 @@ extern int sfi_mtimer_num;
 
 #else /* CONFIG_APB_TIMER */
 
-static inline unsigned long apbt_quick_calibrate(void) {return 0; }
 static inline void apbt_time_init(void) { }
 
 #endif
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index fe698f96617c..263eeaddb0aa 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -345,56 +345,3 @@ void __init apbt_time_init(void)
 	apb_timer_block_enabled = 0;
 	panic("failed to enable APB timer\n");
 }
-
-/* called before apb_timer_enable, use early map */
-unsigned long apbt_quick_calibrate(void)
-{
-	int i, scale;
-	u64 old, new;
-	u64 t1, t2;
-	unsigned long khz = 0;
-	u32 loop, shift;
-
-	apbt_set_mapping();
-	dw_apb_clocksource_start(clocksource_apbt);
-
-	/* check if the timer can count down, otherwise return */
-	old = dw_apb_clocksource_read(clocksource_apbt);
-	i = 10000;
-	while (--i) {
-		if (old != dw_apb_clocksource_read(clocksource_apbt))
-			break;
-	}
-	if (!i)
-		goto failed;
-
-	/* count 16 ms */
-	loop = (apbt_freq / 1000) << 4;
-
-	/* restart the timer to ensure it won't get to 0 in the calibration */
-	dw_apb_clocksource_start(clocksource_apbt);
-
-	old = dw_apb_clocksource_read(clocksource_apbt);
-	old += loop;
-
-	t1 = rdtsc();
-
-	do {
-		new = dw_apb_clocksource_read(clocksource_apbt);
-	} while (new < old);
-
-	t2 = rdtsc();
-
-	shift = 5;
-	if (unlikely(loop >> shift == 0)) {
-		printk(KERN_INFO
-		       "APBT TSC calibration failed, not enough resolution\n");
-		return 0;
-	}
-	scale = (int)div_u64((t2 - t1), loop >> shift);
-	khz = (scale * (apbt_freq / 1000)) >> shift;
-	printk(KERN_INFO "TSC freq calculated by APB timer is %lu khz\n", khz);
-	return khz;
-failed:
-	return 0;
-}
-- 
2.26.2


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

* [PATCH 2/2] x86/apb_timer: drop unused declaration and macro
  2020-05-13 10:09 [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
@ 2020-05-13 10:09 ` Johan Hovold
  2020-05-27 11:25   ` [tip: x86/cleanups] x86/apb_timer: Drop " tip-bot2 for Johan Hovold
  2020-05-27  8:29 ` [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
  2020-05-27 11:25 ` [tip: x86/cleanups] x86/apb_timer: Drop " tip-bot2 for Johan Hovold
  2 siblings, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2020-05-13 10:09 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov
  Cc: x86, H. Peter Anvin, linux-kernel, Johan Hovold

Drop an extern declaration that has never been used and a no longer
needed macro.

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 arch/x86/include/asm/apb_timer.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/include/asm/apb_timer.h b/arch/x86/include/asm/apb_timer.h
index 0a9bf8b77a28..87ce8e963215 100644
--- a/arch/x86/include/asm/apb_timer.h
+++ b/arch/x86/include/asm/apb_timer.h
@@ -25,10 +25,7 @@
 #define APBT_MIN_FREQ          1000000
 #define APBT_MMAP_SIZE         1024
 
-#define APBT_DEV_USED  1
-
 extern void apbt_time_init(void);
-extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
 extern void apbt_setup_secondary_clock(void);
 
 extern struct sfi_timer_table_entry *sfi_get_mtmr(int hint);
-- 
2.26.2


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

* Re: [PATCH 1/2] x86/apb_timer: drop unused TSC calibration
  2020-05-13 10:09 [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
  2020-05-13 10:09 ` [PATCH 2/2] x86/apb_timer: drop unused declaration and macro Johan Hovold
@ 2020-05-27  8:29 ` Johan Hovold
  2020-05-27 11:25 ` [tip: x86/cleanups] x86/apb_timer: Drop " tip-bot2 for Johan Hovold
  2 siblings, 0 replies; 5+ messages in thread
From: Johan Hovold @ 2020-05-27  8:29 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov
  Cc: x86, H. Peter Anvin, linux-kernel, Johan Hovold

On Wed, May 13, 2020 at 12:09:43PM +0200, Johan Hovold wrote:
> Drop the APB-timer TSC calibration, which hasn't been used since the
> removal of Moorestown support by commit 1a8359e411eb ("x86/mid: Remove
> Intel Moorestown").
> 
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  arch/x86/include/asm/apb_timer.h |  2 --
>  arch/x86/kernel/apb_timer.c      | 53 --------------------------------
>  2 files changed, 55 deletions(-)

Any comments to these two clean ups?

Johan

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

* [tip: x86/cleanups] x86/apb_timer: Drop unused declaration and macro
  2020-05-13 10:09 ` [PATCH 2/2] x86/apb_timer: drop unused declaration and macro Johan Hovold
@ 2020-05-27 11:25   ` tip-bot2 for Johan Hovold
  0 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Johan Hovold @ 2020-05-27 11:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Johan Hovold, Borislav Petkov, Thomas Gleixner, x86, LKML

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

Commit-ID:     e027a2bc934fd05d52ec5b77d159efdfc485b5b3
Gitweb:        https://git.kernel.org/tip/e027a2bc934fd05d52ec5b77d159efdfc485b5b3
Author:        Johan Hovold <johan@kernel.org>
AuthorDate:    Wed, 13 May 2020 12:09:44 +02:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Wed, 27 May 2020 13:12:49 +02:00

x86/apb_timer: Drop unused declaration and macro

Drop an extern declaration that has never been used and a no longer
needed macro.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200513100944.9171-2-johan@kernel.org
---
 arch/x86/include/asm/apb_timer.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/x86/include/asm/apb_timer.h b/arch/x86/include/asm/apb_timer.h
index 0a9bf8b..87ce8e9 100644
--- a/arch/x86/include/asm/apb_timer.h
+++ b/arch/x86/include/asm/apb_timer.h
@@ -25,10 +25,7 @@
 #define APBT_MIN_FREQ          1000000
 #define APBT_MMAP_SIZE         1024
 
-#define APBT_DEV_USED  1
-
 extern void apbt_time_init(void);
-extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
 extern void apbt_setup_secondary_clock(void);
 
 extern struct sfi_timer_table_entry *sfi_get_mtmr(int hint);

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

* [tip: x86/cleanups] x86/apb_timer: Drop unused TSC calibration
  2020-05-13 10:09 [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
  2020-05-13 10:09 ` [PATCH 2/2] x86/apb_timer: drop unused declaration and macro Johan Hovold
  2020-05-27  8:29 ` [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
@ 2020-05-27 11:25 ` tip-bot2 for Johan Hovold
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot2 for Johan Hovold @ 2020-05-27 11:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Johan Hovold, Borislav Petkov, Thomas Gleixner, x86, LKML

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

Commit-ID:     003d80535180f74f262c40462b9fccd7f004901a
Gitweb:        https://git.kernel.org/tip/003d80535180f74f262c40462b9fccd7f004901a
Author:        Johan Hovold <johan@kernel.org>
AuthorDate:    Wed, 13 May 2020 12:09:43 +02:00
Committer:     Borislav Petkov <bp@suse.de>
CommitterDate: Wed, 27 May 2020 13:05:59 +02:00

x86/apb_timer: Drop unused TSC calibration

Drop the APB-timer TSC calibration, which hasn't been used since the
removal of Moorestown support by commit

  1a8359e411eb ("x86/mid: Remove Intel Moorestown").

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20200513100944.9171-1-johan@kernel.org
---
 arch/x86/include/asm/apb_timer.h |  2 +-
 arch/x86/kernel/apb_timer.c      | 53 +-------------------------------
 2 files changed, 55 deletions(-)

diff --git a/arch/x86/include/asm/apb_timer.h b/arch/x86/include/asm/apb_timer.h
index 99bb207..0a9bf8b 100644
--- a/arch/x86/include/asm/apb_timer.h
+++ b/arch/x86/include/asm/apb_timer.h
@@ -28,7 +28,6 @@
 #define APBT_DEV_USED  1
 
 extern void apbt_time_init(void);
-extern unsigned long apbt_quick_calibrate(void);
 extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
 extern void apbt_setup_secondary_clock(void);
 
@@ -38,7 +37,6 @@ extern int sfi_mtimer_num;
 
 #else /* CONFIG_APB_TIMER */
 
-static inline unsigned long apbt_quick_calibrate(void) {return 0; }
 static inline void apbt_time_init(void) { }
 
 #endif
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index fe698f9..263eead 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -345,56 +345,3 @@ out_noapbt:
 	apb_timer_block_enabled = 0;
 	panic("failed to enable APB timer\n");
 }
-
-/* called before apb_timer_enable, use early map */
-unsigned long apbt_quick_calibrate(void)
-{
-	int i, scale;
-	u64 old, new;
-	u64 t1, t2;
-	unsigned long khz = 0;
-	u32 loop, shift;
-
-	apbt_set_mapping();
-	dw_apb_clocksource_start(clocksource_apbt);
-
-	/* check if the timer can count down, otherwise return */
-	old = dw_apb_clocksource_read(clocksource_apbt);
-	i = 10000;
-	while (--i) {
-		if (old != dw_apb_clocksource_read(clocksource_apbt))
-			break;
-	}
-	if (!i)
-		goto failed;
-
-	/* count 16 ms */
-	loop = (apbt_freq / 1000) << 4;
-
-	/* restart the timer to ensure it won't get to 0 in the calibration */
-	dw_apb_clocksource_start(clocksource_apbt);
-
-	old = dw_apb_clocksource_read(clocksource_apbt);
-	old += loop;
-
-	t1 = rdtsc();
-
-	do {
-		new = dw_apb_clocksource_read(clocksource_apbt);
-	} while (new < old);
-
-	t2 = rdtsc();
-
-	shift = 5;
-	if (unlikely(loop >> shift == 0)) {
-		printk(KERN_INFO
-		       "APBT TSC calibration failed, not enough resolution\n");
-		return 0;
-	}
-	scale = (int)div_u64((t2 - t1), loop >> shift);
-	khz = (scale * (apbt_freq / 1000)) >> shift;
-	printk(KERN_INFO "TSC freq calculated by APB timer is %lu khz\n", khz);
-	return khz;
-failed:
-	return 0;
-}

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

end of thread, other threads:[~2020-05-27 11:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 10:09 [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
2020-05-13 10:09 ` [PATCH 2/2] x86/apb_timer: drop unused declaration and macro Johan Hovold
2020-05-27 11:25   ` [tip: x86/cleanups] x86/apb_timer: Drop " tip-bot2 for Johan Hovold
2020-05-27  8:29 ` [PATCH 1/2] x86/apb_timer: drop unused TSC calibration Johan Hovold
2020-05-27 11:25 ` [tip: x86/cleanups] x86/apb_timer: Drop " tip-bot2 for Johan Hovold

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).