]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: provide paravirtualized hook for rdtscp
authorGlauber de Oliveira Costa <gcosta@redhat.com>
Wed, 30 Jan 2008 12:32:05 +0000 (13:32 +0100)
committerIngo Molnar <mingo@elte.hu>
Wed, 30 Jan 2008 12:32:05 +0000 (13:32 +0100)
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>
arch/x86/kernel/paravirt.c
include/asm-x86/paravirt.h

index 1a170877f46cb35442d2ea5198be1938ab695da5..072c1a08efe6b134330a0786837fdd91be7de15b 100644 (file)
@@ -374,6 +374,7 @@ struct pv_cpu_ops pv_cpu_ops = {
        .write_msr = native_write_msr_safe,
        .read_tsc = native_read_tsc,
        .read_pmc = native_read_pmc,
+       .read_tscp = native_read_tscp,
        .load_tr_desc = native_load_tr_desc,
        .set_ldt = native_set_ldt,
        .load_gdt = native_load_gdt,
index 66290f58e9393071e0402107a7a2556a2aa04c7f..8f7984319c30e0c7454d01c726ce6b528371a28f 100644 (file)
@@ -120,6 +120,7 @@ struct pv_cpu_ops {
 
        u64 (*read_tsc)(void);
        u64 (*read_pmc)(int counter);
+       unsigned long long (*read_tscp)(unsigned int *aux);
 
        /* These two are jmp to, not actually called. */
        void (*irq_enable_syscall_ret)(void);
@@ -668,6 +669,27 @@ static inline unsigned long long paravirt_read_pmc(int counter)
        high = _l >> 32;                        \
 } while(0)
 
+static inline unsigned long long paravirt_rdtscp(unsigned int *aux)
+{
+       return PVOP_CALL1(u64, pv_cpu_ops.read_tscp, aux);
+}
+
+#define rdtscp(low, high, aux)                         \
+do {                                                   \
+       int __aux;                                      \
+       unsigned long __val = paravirt_rdtscp(&__aux);  \
+       (low) = (u32)__val;                             \
+       (high) = (u32)(__val >> 32);                    \
+       (aux) = __aux;                                  \
+} while (0)
+
+#define rdtscpll(val, aux)                             \
+do {                                                   \
+       unsigned long __aux;                            \
+       val = paravirt_rdtscp(&__aux);                  \
+       (aux) = __aux;                                  \
+} while (0)
+
 static inline void load_TR_desc(void)
 {
        PVOP_VCALL0(pv_cpu_ops.load_tr_desc);