Commit c18aa3e7 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Andrei Vagin

compel: add compel_ prefix to cpu_has_feature

travis-ci: success for compel uapi cleanups
Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Reviewed-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent adaa7979
...@@ -18,7 +18,7 @@ void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { } ...@@ -18,7 +18,7 @@ void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; } int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_cpuid(compel_cpuinfo_t *info) { return 0; } int compel_cpuid(compel_cpuinfo_t *info) { return 0; }
bool cpu_has_feature(unsigned int feature) bool compel_cpu_has_feature(unsigned int feature)
{ {
if (!rt_info_done) { if (!rt_info_done) {
compel_cpuid(&rt_info); compel_cpuid(&rt_info);
......
...@@ -18,7 +18,7 @@ void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { } ...@@ -18,7 +18,7 @@ void compel_clear_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { }
int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; } int compel_test_cpu_cap(compel_cpuinfo_t *info, unsigned int feature) { return 0; }
int compel_cpuid(compel_cpuinfo_t *info) { return 0; } int compel_cpuid(compel_cpuinfo_t *info) { return 0; }
bool cpu_has_feature(unsigned int feature) bool compel_cpu_has_feature(unsigned int feature)
{ {
if (!rt_info_done) { if (!rt_info_done) {
compel_cpuid(&rt_info); compel_cpuid(&rt_info);
......
...@@ -32,7 +32,7 @@ int compel_cpuid(compel_cpuinfo_t *info) ...@@ -32,7 +32,7 @@ int compel_cpuid(compel_cpuinfo_t *info)
return 0; return 0;
} }
bool cpu_has_feature(unsigned int feature) bool compel_cpu_has_feature(unsigned int feature)
{ {
if (!rt_info_done) { if (!rt_info_done) {
compel_cpuid(&rt_info); compel_cpuid(&rt_info);
......
...@@ -178,7 +178,7 @@ int compel_cpuid(compel_cpuinfo_t *c) ...@@ -178,7 +178,7 @@ int compel_cpuid(compel_cpuinfo_t *c)
return 0; return 0;
} }
bool cpu_has_feature(unsigned int feature) bool compel_cpu_has_feature(unsigned int feature)
{ {
if (!rt_info_done) { if (!rt_info_done) {
compel_cpuid(&rt_info); compel_cpuid(&rt_info);
......
...@@ -157,7 +157,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *ar ...@@ -157,7 +157,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *ar
} }
} }
if (!cpu_has_feature(X86_FEATURE_FPU)) if (!compel_cpu_has_feature(X86_FEATURE_FPU))
goto out; goto out;
/* /*
...@@ -167,7 +167,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *ar ...@@ -167,7 +167,7 @@ int get_task_regs(pid_t pid, user_regs_struct_t regs, save_regs_t save, void *ar
pr_info("Dumping GP/FPU registers for %d\n", pid); pr_info("Dumping GP/FPU registers for %d\n", pid);
if (cpu_has_feature(X86_FEATURE_OSXSAVE)) { if (compel_cpu_has_feature(X86_FEATURE_OSXSAVE)) {
iov.iov_base = &xsave; iov.iov_base = &xsave;
iov.iov_len = sizeof(xsave); iov.iov_len = sizeof(xsave);
......
...@@ -6,6 +6,6 @@ ...@@ -6,6 +6,6 @@
#include <compel/asm/cpu.h> #include <compel/asm/cpu.h>
extern int compel_cpuid(compel_cpuinfo_t *info); extern int compel_cpuid(compel_cpuinfo_t *info);
extern bool cpu_has_feature(unsigned int feature); extern bool compel_cpu_has_feature(unsigned int feature);
#endif /* UAPI_COMPEL_CPU_H__ */ #endif /* UAPI_COMPEL_CPU_H__ */
...@@ -41,17 +41,17 @@ int cpu_init(void) ...@@ -41,17 +41,17 @@ int cpu_init(void)
* Make sure that at least FPU is onboard * Make sure that at least FPU is onboard
* and fxsave is supported. * and fxsave is supported.
*/ */
if (cpu_has_feature(X86_FEATURE_FPU)) { if (compel_cpu_has_feature(X86_FEATURE_FPU)) {
if (!cpu_has_feature(X86_FEATURE_FXSR)) { if (!compel_cpu_has_feature(X86_FEATURE_FXSR)) {
pr_err("missing support fxsave/restore insns\n"); pr_err("missing support fxsave/restore insns\n");
return -1; return -1;
} }
} }
pr_debug("fpu:%d fxsr:%d xsave:%d\n", pr_debug("fpu:%d fxsr:%d xsave:%d\n",
!!cpu_has_feature(X86_FEATURE_FPU), !!compel_cpu_has_feature(X86_FEATURE_FPU),
!!cpu_has_feature(X86_FEATURE_FXSR), !!compel_cpu_has_feature(X86_FEATURE_FXSR),
!!cpu_has_feature(X86_FEATURE_OSXSAVE)); !!compel_cpu_has_feature(X86_FEATURE_OSXSAVE));
return 0; return 0;
} }
...@@ -222,7 +222,7 @@ static int cpu_validate_features(CpuinfoX86Entry *img_x86_entry) ...@@ -222,7 +222,7 @@ static int cpu_validate_features(CpuinfoX86Entry *img_x86_entry)
#define __mismatch_fpu_bit(__bit) \ #define __mismatch_fpu_bit(__bit) \
(test_bit(__bit, (void *)img_x86_entry->capability) && \ (test_bit(__bit, (void *)img_x86_entry->capability) && \
!cpu_has_feature(__bit)) !compel_cpu_has_feature(__bit))
if (__mismatch_fpu_bit(X86_FEATURE_FPU) || if (__mismatch_fpu_bit(X86_FEATURE_FPU) ||
__mismatch_fpu_bit(X86_FEATURE_FXSR) || __mismatch_fpu_bit(X86_FEATURE_FXSR) ||
__mismatch_fpu_bit(X86_FEATURE_OSXSAVE)) { __mismatch_fpu_bit(X86_FEATURE_OSXSAVE)) {
......
...@@ -129,7 +129,7 @@ int save_task_regs(void *x, user_regs_struct_t *regs, user_fpregs_struct_t *fpre ...@@ -129,7 +129,7 @@ int save_task_regs(void *x, user_regs_struct_t *regs, user_fpregs_struct_t *fpre
assign_array(core->thread_info->fpregs, fpregs->i387, st_space); assign_array(core->thread_info->fpregs, fpregs->i387, st_space);
assign_array(core->thread_info->fpregs, fpregs->i387, xmm_space); assign_array(core->thread_info->fpregs, fpregs->i387, xmm_space);
if (cpu_has_feature(X86_FEATURE_OSXSAVE)) { if (compel_cpu_has_feature(X86_FEATURE_OSXSAVE)) {
BUG_ON(core->thread_info->fpregs->xsave->n_ymmh_space != ARRAY_SIZE(fpregs->ymmh.ymmh_space)); BUG_ON(core->thread_info->fpregs->xsave->n_ymmh_space != ARRAY_SIZE(fpregs->ymmh.ymmh_space));
assign_reg(core->thread_info->fpregs->xsave, fpregs->xsave_hdr, xstate_bv); assign_reg(core->thread_info->fpregs->xsave, fpregs->xsave_hdr, xstate_bv);
...@@ -162,14 +162,14 @@ int arch_alloc_thread_info(CoreEntry *core) ...@@ -162,14 +162,14 @@ int arch_alloc_thread_info(CoreEntry *core)
ThreadInfoX86 *ti = NULL; ThreadInfoX86 *ti = NULL;
with_fpu = cpu_has_feature(X86_FEATURE_FPU); with_fpu = compel_cpu_has_feature(X86_FEATURE_FPU);
sz = sizeof(ThreadInfoX86) + sizeof(UserX86RegsEntry) + sz = sizeof(ThreadInfoX86) + sizeof(UserX86RegsEntry) +
GDT_ENTRY_TLS_NUM*sizeof(UserDescT) + GDT_ENTRY_TLS_NUM*sizeof(UserDescT) +
GDT_ENTRY_TLS_NUM*sizeof(UserDescT*); GDT_ENTRY_TLS_NUM*sizeof(UserDescT*);
if (with_fpu) { if (with_fpu) {
sz += sizeof(UserX86FpregsEntry); sz += sizeof(UserX86FpregsEntry);
with_xsave = cpu_has_feature(X86_FEATURE_OSXSAVE); with_xsave = compel_cpu_has_feature(X86_FEATURE_OSXSAVE);
if (with_xsave) if (with_xsave)
sz += sizeof(UserX86XsaveEntry); sz += sizeof(UserX86XsaveEntry);
} }
...@@ -250,7 +250,7 @@ static bool valid_xsave_frame(CoreEntry *core) ...@@ -250,7 +250,7 @@ static bool valid_xsave_frame(CoreEntry *core)
return false; return false;
} }
if (cpu_has_feature(X86_FEATURE_OSXSAVE)) { if (compel_cpu_has_feature(X86_FEATURE_OSXSAVE)) {
if (core->thread_info->fpregs->xsave && if (core->thread_info->fpregs->xsave &&
core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) { core->thread_info->fpregs->xsave->n_ymmh_space < ARRAY_SIZE(x->ymmh.ymmh_space)) {
pr_err("Corruption in FPU ymmh_space area " pr_err("Corruption in FPU ymmh_space area "
...@@ -336,7 +336,7 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core) ...@@ -336,7 +336,7 @@ int restore_fpu(struct rt_sigframe *sigframe, CoreEntry *core)
assign_array(x->i387, core->thread_info->fpregs, st_space); assign_array(x->i387, core->thread_info->fpregs, st_space);
assign_array(x->i387, core->thread_info->fpregs, xmm_space); assign_array(x->i387, core->thread_info->fpregs, xmm_space);
if (cpu_has_feature(X86_FEATURE_OSXSAVE)) { if (compel_cpu_has_feature(X86_FEATURE_OSXSAVE)) {
struct fpx_sw_bytes *fpx_sw = (void *)&x->i387.sw_reserved; struct fpx_sw_bytes *fpx_sw = (void *)&x->i387.sw_reserved;
void *magic2; void *magic2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment