proc: fix timerslack_ns CAP_SYS_NICE check when adjusting self
[cascardo/linux.git] / kernel / up.c
index 1760bf3..ee81ac9 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/kernel.h>
 #include <linux/export.h>
 #include <linux/smp.h>
+#include <linux/hypervisor.h>
 
 int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
                                int wait)
@@ -82,3 +83,20 @@ void on_each_cpu_cond(bool (*cond_func)(int cpu, void *info),
        preempt_enable();
 }
 EXPORT_SYMBOL(on_each_cpu_cond);
+
+int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys)
+{
+       int ret;
+
+       if (cpu != 0)
+               return -ENXIO;
+
+       if (phys)
+               hypervisor_pin_vcpu(0);
+       ret = func(par);
+       if (phys)
+               hypervisor_pin_vcpu(-1);
+
+       return ret;
+}
+EXPORT_SYMBOL_GPL(smp_call_on_cpu);