aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlauber de Oliveira Costa <gcosta@redhat.com>2008-01-30 07:32:05 -0500
committerIngo Molnar <mingo@elte.hu>2008-01-30 07:32:05 -0500
commite5aaac443635c7c6f842f0bf8169f71f3236d574 (patch)
tree6be4f1a7cd3e0b1614ea2bbeefcea42d9b1fffc9
parentf72a9ef979c5a828c64deb88ebba743f7d899907 (diff)
x86: provide paravirtualized hook for rdtscp
This patch adds a field in pv_cpu_ops for a paravirtualized hook for rdtscp, needed for x86_64. Signed-off-by: Glauber de Oliveira Costa <gcosta@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--arch/x86/kernel/paravirt.c1
-rw-r--r--include/asm-x86/paravirt.h22
2 files changed, 23 insertions, 0 deletions
diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index 1a170877f46c..072c1a08efe6 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -374,6 +374,7 @@ struct pv_cpu_ops pv_cpu_ops = {
374 .write_msr = native_write_msr_safe, 374 .write_msr = native_write_msr_safe,
375 .read_tsc = native_read_tsc, 375 .read_tsc = native_read_tsc,
376 .read_pmc = native_read_pmc, 376 .read_pmc = native_read_pmc,
377 .read_tscp = native_read_tscp,
377 .load_tr_desc = native_load_tr_desc, 378 .load_tr_desc = native_load_tr_desc,
378 .set_ldt = native_set_ldt, 379 .set_ldt = native_set_ldt,
379 .load_gdt = native_load_gdt, 380 .load_gdt = native_load_gdt,
diff --git a/include/asm-x86/paravirt.h b/include/asm-x86/paravirt.h
index 66290f58e939..8f7984319c30 100644
--- a/include/asm-x86/paravirt.h
+++ b/include/asm-x86/paravirt.h
@@ -120,6 +120,7 @@ struct pv_cpu_ops {
120 120
121 u64 (*read_tsc)(void); 121 u64 (*read_tsc)(void);
122 u64 (*read_pmc)(int counter); 122 u64 (*read_pmc)(int counter);
123 unsigned long long (*read_tscp)(unsigned int *aux);
123 124
124 /* These two are jmp to, not actually called. */ 125 /* These two are jmp to, not actually called. */
125 void (*irq_enable_syscall_ret)(void); 126 void (*irq_enable_syscall_ret)(void);
@@ -668,6 +669,27 @@ static inline unsigned long long paravirt_read_pmc(int counter)
668 high = _l >> 32; \ 669 high = _l >> 32; \
669} while(0) 670} while(0)
670 671
672static inline unsigned long long paravirt_rdtscp(unsigned int *aux)
673{
674 return PVOP_CALL1(u64, pv_cpu_ops.read_tscp, aux);
675}
676
677#define rdtscp(low, high, aux) \
678do { \
679 int __aux; \
680 unsigned long __val = paravirt_rdtscp(&__aux); \
681 (low) = (u32)__val; \
682 (high) = (u32)(__val >> 32); \
683 (aux) = __aux; \
684} while (0)
685
686#define rdtscpll(val, aux) \
687do { \
688 unsigned long __aux; \
689 val = paravirt_rdtscp(&__aux); \
690 (aux) = __aux; \
691} while (0)
692
671static inline void load_TR_desc(void) 693static inline void load_TR_desc(void)
672{ 694{
673 PVOP_VCALL0(pv_cpu_ops.load_tr_desc); 695 PVOP_VCALL0(pv_cpu_ops.load_tr_desc);