Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 87be28aa authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ingo Molnar
Browse files

x86/asm/tsc: Replace rdtscll() with native_read_tsc()



Now that the ->read_tsc() paravirt hook is gone, rdtscll() is
just a wrapper around native_read_tsc(). Unwrap it.

Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
Signed-off-by: default avatarBorislav 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/d2449ae62c1b1fb90195bcfb19ef4a35883a04dc.1434501121.git.luto@kernel.org


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 9261e050
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ static unsigned long get_random_long(void)


	if (has_cpuflag(X86_FEATURE_TSC)) {
	if (has_cpuflag(X86_FEATURE_TSC)) {
		debug_putstr(" RDTSC");
		debug_putstr(" RDTSC");
		rdtscll(raw);
		raw = native_read_tsc();


		random ^= raw;
		random ^= raw;
		use_i8254 = false;
		use_i8254 = false;
+0 −3
Original line number Original line Diff line number Diff line
@@ -192,9 +192,6 @@ do { \
#define rdtscl(low)						\
#define rdtscl(low)						\
	((low) = (u32)native_read_tsc())
	((low) = (u32)native_read_tsc())


#define rdtscll(val)						\
	((val) = native_read_tsc())

#define rdtscp(low, high, aux)					\
#define rdtscp(low, high, aux)					\
do {                                                            \
do {                                                            \
	unsigned long long _val = native_read_tscp(&(aux));     \
	unsigned long long _val = native_read_tscp(&(aux));     \
+1 −4
Original line number Original line Diff line number Diff line
@@ -21,15 +21,12 @@ extern void disable_TSC(void);


static inline cycles_t get_cycles(void)
static inline cycles_t get_cycles(void)
{
{
	unsigned long long ret = 0;

#ifndef CONFIG_X86_TSC
#ifndef CONFIG_X86_TSC
	if (!cpu_has_tsc)
	if (!cpu_has_tsc)
		return 0;
		return 0;
#endif
#endif
	rdtscll(ret);


	return ret;
	return native_read_tsc();
}
}


extern void tsc_init(void);
extern void tsc_init(void);
+2 −2
Original line number Original line Diff line number Diff line
@@ -263,7 +263,7 @@ static int apbt_clocksource_register(void)


	/* Verify whether apbt counter works */
	/* Verify whether apbt counter works */
	t1 = dw_apb_clocksource_read(clocksource_apbt);
	t1 = dw_apb_clocksource_read(clocksource_apbt);
	rdtscll(start);
	start = native_read_tsc();


	/*
	/*
	 * We don't know the TSC frequency yet, but waiting for
	 * We don't know the TSC frequency yet, but waiting for
@@ -273,7 +273,7 @@ static int apbt_clocksource_register(void)
	 */
	 */
	do {
	do {
		rep_nop();
		rep_nop();
		rdtscll(now);
		now = native_read_tsc();
	} while ((now - start) < 200000UL);
	} while ((now - start) < 200000UL);


	/* APBT is the only always on clocksource, it has to work! */
	/* APBT is the only always on clocksource, it has to work! */
+4 −4
Original line number Original line Diff line number Diff line
@@ -457,7 +457,7 @@ static int lapic_next_deadline(unsigned long delta,
{
{
	u64 tsc;
	u64 tsc;


	rdtscll(tsc);
	tsc = native_read_tsc();
	wrmsrl(MSR_IA32_TSC_DEADLINE, tsc + (((u64) delta) * TSC_DIVISOR));
	wrmsrl(MSR_IA32_TSC_DEADLINE, tsc + (((u64) delta) * TSC_DIVISOR));
	return 0;
	return 0;
}
}
@@ -592,7 +592,7 @@ static void __init lapic_cal_handler(struct clock_event_device *dev)
	unsigned long pm = acpi_pm_read_early();
	unsigned long pm = acpi_pm_read_early();


	if (cpu_has_tsc)
	if (cpu_has_tsc)
		rdtscll(tsc);
		tsc = native_read_tsc();


	switch (lapic_cal_loops++) {
	switch (lapic_cal_loops++) {
	case 0:
	case 0:
@@ -1209,7 +1209,7 @@ void setup_local_APIC(void)
	long long max_loops = cpu_khz ? cpu_khz : 1000000;
	long long max_loops = cpu_khz ? cpu_khz : 1000000;


	if (cpu_has_tsc)
	if (cpu_has_tsc)
		rdtscll(tsc);
		tsc = native_read_tsc();


	if (disable_apic) {
	if (disable_apic) {
		disable_ioapic_support();
		disable_ioapic_support();
@@ -1293,7 +1293,7 @@ void setup_local_APIC(void)
		}
		}
		if (queued) {
		if (queued) {
			if (cpu_has_tsc && cpu_khz) {
			if (cpu_has_tsc && cpu_khz) {
				rdtscll(ntsc);
				ntsc = native_read_tsc();
				max_loops = (cpu_khz << 10) - (ntsc - tsc);
				max_loops = (cpu_khz << 10) - (ntsc - tsc);
			} else
			} else
				max_loops--;
				max_loops--;
Loading