diff options
author | Andy Lutomirski <luto@kernel.org> | 2015-06-25 12:44:07 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-07-06 09:23:28 -0400 |
commit | 4ea1636b04dbd66536fa387bae2eea463efc705b (patch) | |
tree | 02067d97d1f200b280df8df114b77f26ff1b8e89 /arch/x86/kernel | |
parent | fe47ae6e1a5005b2e82f7eab57b5c3820453293a (diff) |
x86/asm/tsc: Rename native_read_tsc() to rdtsc()
Now that there is no paravirt TSC, the "native" is
inappropriate. The function does RDTSC, so give it the obvious
name: rdtsc().
Suggested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Huang Rui <ray.huang@amd.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: kvm ML <kvm@vger.kernel.org>
Link: http://lkml.kernel.org/r/fd43e16281991f096c1e4d21574d9e1402c62d39.1434501121.git.luto@kernel.org
[ Ported it to v4.2-rc1. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/apb_timer.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/apic/apic.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/amd.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/mcheck/mce.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/espfix_64.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/hpet.c | 4 | ||||
-rw-r--r-- | arch/x86/kernel/trace_clock.c | 2 | ||||
-rw-r--r-- | arch/x86/kernel/tsc.c | 4 |
8 files changed, 18 insertions, 18 deletions
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c index 25efa534c4e4..222a57076039 100644 --- a/arch/x86/kernel/apb_timer.c +++ b/arch/x86/kernel/apb_timer.c | |||
@@ -263,7 +263,7 @@ static int apbt_clocksource_register(void) | |||
263 | 263 | ||
264 | /* Verify whether apbt counter works */ | 264 | /* Verify whether apbt counter works */ |
265 | t1 = dw_apb_clocksource_read(clocksource_apbt); | 265 | t1 = dw_apb_clocksource_read(clocksource_apbt); |
266 | start = native_read_tsc(); | 266 | start = rdtsc(); |
267 | 267 | ||
268 | /* | 268 | /* |
269 | * We don't know the TSC frequency yet, but waiting for | 269 | * We don't know the TSC frequency yet, but waiting for |
@@ -273,7 +273,7 @@ static int apbt_clocksource_register(void) | |||
273 | */ | 273 | */ |
274 | do { | 274 | do { |
275 | rep_nop(); | 275 | rep_nop(); |
276 | now = native_read_tsc(); | 276 | now = rdtsc(); |
277 | } while ((now - start) < 200000UL); | 277 | } while ((now - start) < 200000UL); |
278 | 278 | ||
279 | /* APBT is the only always on clocksource, it has to work! */ | 279 | /* APBT is the only always on clocksource, it has to work! */ |
@@ -390,13 +390,13 @@ unsigned long apbt_quick_calibrate(void) | |||
390 | old = dw_apb_clocksource_read(clocksource_apbt); | 390 | old = dw_apb_clocksource_read(clocksource_apbt); |
391 | old += loop; | 391 | old += loop; |
392 | 392 | ||
393 | t1 = native_read_tsc(); | 393 | t1 = rdtsc(); |
394 | 394 | ||
395 | do { | 395 | do { |
396 | new = dw_apb_clocksource_read(clocksource_apbt); | 396 | new = dw_apb_clocksource_read(clocksource_apbt); |
397 | } while (new < old); | 397 | } while (new < old); |
398 | 398 | ||
399 | t2 = native_read_tsc(); | 399 | t2 = rdtsc(); |
400 | 400 | ||
401 | shift = 5; | 401 | shift = 5; |
402 | if (unlikely(loop >> shift == 0)) { | 402 | if (unlikely(loop >> shift == 0)) { |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 51af1ed1ae2e..0d71cd9b4a50 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -457,7 +457,7 @@ static int lapic_next_deadline(unsigned long delta, | |||
457 | { | 457 | { |
458 | u64 tsc; | 458 | u64 tsc; |
459 | 459 | ||
460 | tsc = native_read_tsc(); | 460 | tsc = rdtsc(); |
461 | wrmsrl(MSR_IA32_TSC_DEADLINE, tsc + (((u64) delta) * TSC_DIVISOR)); | 461 | wrmsrl(MSR_IA32_TSC_DEADLINE, tsc + (((u64) delta) * TSC_DIVISOR)); |
462 | return 0; | 462 | return 0; |
463 | } | 463 | } |
@@ -592,7 +592,7 @@ static void __init lapic_cal_handler(struct clock_event_device *dev) | |||
592 | unsigned long pm = acpi_pm_read_early(); | 592 | unsigned long pm = acpi_pm_read_early(); |
593 | 593 | ||
594 | if (cpu_has_tsc) | 594 | if (cpu_has_tsc) |
595 | tsc = native_read_tsc(); | 595 | tsc = rdtsc(); |
596 | 596 | ||
597 | switch (lapic_cal_loops++) { | 597 | switch (lapic_cal_loops++) { |
598 | case 0: | 598 | case 0: |
@@ -1209,7 +1209,7 @@ void setup_local_APIC(void) | |||
1209 | long long max_loops = cpu_khz ? cpu_khz : 1000000; | 1209 | long long max_loops = cpu_khz ? cpu_khz : 1000000; |
1210 | 1210 | ||
1211 | if (cpu_has_tsc) | 1211 | if (cpu_has_tsc) |
1212 | tsc = native_read_tsc(); | 1212 | tsc = rdtsc(); |
1213 | 1213 | ||
1214 | if (disable_apic) { | 1214 | if (disable_apic) { |
1215 | disable_ioapic_support(); | 1215 | disable_ioapic_support(); |
@@ -1293,7 +1293,7 @@ void setup_local_APIC(void) | |||
1293 | } | 1293 | } |
1294 | if (queued) { | 1294 | if (queued) { |
1295 | if (cpu_has_tsc && cpu_khz) { | 1295 | if (cpu_has_tsc && cpu_khz) { |
1296 | ntsc = native_read_tsc(); | 1296 | ntsc = rdtsc(); |
1297 | max_loops = (cpu_khz << 10) - (ntsc - tsc); | 1297 | max_loops = (cpu_khz << 10) - (ntsc - tsc); |
1298 | } else | 1298 | } else |
1299 | max_loops--; | 1299 | max_loops--; |
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c index a69710db6112..51ad2af84a72 100644 --- a/arch/x86/kernel/cpu/amd.c +++ b/arch/x86/kernel/cpu/amd.c | |||
@@ -125,10 +125,10 @@ static void init_amd_k6(struct cpuinfo_x86 *c) | |||
125 | 125 | ||
126 | n = K6_BUG_LOOP; | 126 | n = K6_BUG_LOOP; |
127 | f_vide = vide; | 127 | f_vide = vide; |
128 | d = native_read_tsc(); | 128 | d = rdtsc(); |
129 | while (n--) | 129 | while (n--) |
130 | f_vide(); | 130 | f_vide(); |
131 | d2 = native_read_tsc(); | 131 | d2 = rdtsc(); |
132 | d = d2-d; | 132 | d = d2-d; |
133 | 133 | ||
134 | if (d > 20*K6_BUG_LOOP) | 134 | if (d > 20*K6_BUG_LOOP) |
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index a5283d2d0094..96cceccd11b4 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -125,7 +125,7 @@ void mce_setup(struct mce *m) | |||
125 | { | 125 | { |
126 | memset(m, 0, sizeof(struct mce)); | 126 | memset(m, 0, sizeof(struct mce)); |
127 | m->cpu = m->extcpu = smp_processor_id(); | 127 | m->cpu = m->extcpu = smp_processor_id(); |
128 | m->tsc = native_read_tsc(); | 128 | m->tsc = rdtsc(); |
129 | /* We hope get_seconds stays lockless */ | 129 | /* We hope get_seconds stays lockless */ |
130 | m->time = get_seconds(); | 130 | m->time = get_seconds(); |
131 | m->cpuvendor = boot_cpu_data.x86_vendor; | 131 | m->cpuvendor = boot_cpu_data.x86_vendor; |
@@ -1784,7 +1784,7 @@ static void collect_tscs(void *data) | |||
1784 | { | 1784 | { |
1785 | unsigned long *cpu_tsc = (unsigned long *)data; | 1785 | unsigned long *cpu_tsc = (unsigned long *)data; |
1786 | 1786 | ||
1787 | cpu_tsc[smp_processor_id()] = native_read_tsc(); | 1787 | cpu_tsc[smp_processor_id()] = rdtsc(); |
1788 | } | 1788 | } |
1789 | 1789 | ||
1790 | static int mce_apei_read_done; | 1790 | static int mce_apei_read_done; |
diff --git a/arch/x86/kernel/espfix_64.c b/arch/x86/kernel/espfix_64.c index 334a2a9c034d..67315cd0132c 100644 --- a/arch/x86/kernel/espfix_64.c +++ b/arch/x86/kernel/espfix_64.c | |||
@@ -110,7 +110,7 @@ static void init_espfix_random(void) | |||
110 | */ | 110 | */ |
111 | if (!arch_get_random_long(&rand)) { | 111 | if (!arch_get_random_long(&rand)) { |
112 | /* The constant is an arbitrary large prime */ | 112 | /* The constant is an arbitrary large prime */ |
113 | rand = native_read_tsc(); | 113 | rand = rdtsc(); |
114 | rand *= 0xc345c6b72fd16123UL; | 114 | rand *= 0xc345c6b72fd16123UL; |
115 | } | 115 | } |
116 | 116 | ||
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index cc390fe69b71..f75c5908c7a6 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -735,7 +735,7 @@ static int hpet_clocksource_register(void) | |||
735 | 735 | ||
736 | /* Verify whether hpet counter works */ | 736 | /* Verify whether hpet counter works */ |
737 | t1 = hpet_readl(HPET_COUNTER); | 737 | t1 = hpet_readl(HPET_COUNTER); |
738 | start = native_read_tsc(); | 738 | start = rdtsc(); |
739 | 739 | ||
740 | /* | 740 | /* |
741 | * We don't know the TSC frequency yet, but waiting for | 741 | * We don't know the TSC frequency yet, but waiting for |
@@ -745,7 +745,7 @@ static int hpet_clocksource_register(void) | |||
745 | */ | 745 | */ |
746 | do { | 746 | do { |
747 | rep_nop(); | 747 | rep_nop(); |
748 | now = native_read_tsc(); | 748 | now = rdtsc(); |
749 | } while ((now - start) < 200000UL); | 749 | } while ((now - start) < 200000UL); |
750 | 750 | ||
751 | if (t1 == hpet_readl(HPET_COUNTER)) { | 751 | if (t1 == hpet_readl(HPET_COUNTER)) { |
diff --git a/arch/x86/kernel/trace_clock.c b/arch/x86/kernel/trace_clock.c index bd8f4d41bd56..67efb8c96fc4 100644 --- a/arch/x86/kernel/trace_clock.c +++ b/arch/x86/kernel/trace_clock.c | |||
@@ -15,7 +15,7 @@ u64 notrace trace_clock_x86_tsc(void) | |||
15 | u64 ret; | 15 | u64 ret; |
16 | 16 | ||
17 | rdtsc_barrier(); | 17 | rdtsc_barrier(); |
18 | ret = native_read_tsc(); | 18 | ret = rdtsc(); |
19 | 19 | ||
20 | return ret; | 20 | return ret; |
21 | } | 21 | } |
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c index e66f5dcaeb63..21d6e04e3e82 100644 --- a/arch/x86/kernel/tsc.c +++ b/arch/x86/kernel/tsc.c | |||
@@ -248,7 +248,7 @@ static void set_cyc2ns_scale(unsigned long cpu_khz, int cpu) | |||
248 | 248 | ||
249 | data = cyc2ns_write_begin(cpu); | 249 | data = cyc2ns_write_begin(cpu); |
250 | 250 | ||
251 | tsc_now = native_read_tsc(); | 251 | tsc_now = rdtsc(); |
252 | ns_now = cycles_2_ns(tsc_now); | 252 | ns_now = cycles_2_ns(tsc_now); |
253 | 253 | ||
254 | /* | 254 | /* |
@@ -290,7 +290,7 @@ u64 native_sched_clock(void) | |||
290 | } | 290 | } |
291 | 291 | ||
292 | /* read the Time Stamp Counter: */ | 292 | /* read the Time Stamp Counter: */ |
293 | tsc_now = native_read_tsc(); | 293 | tsc_now = rdtsc(); |
294 | 294 | ||
295 | /* return the value in ns */ | 295 | /* return the value in ns */ |
296 | return cycles_2_ns(tsc_now); | 296 | return cycles_2_ns(tsc_now); |