Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-07-19 15:47:37 +0300
committerAndrei Vagin <avagin@gmail.com>2018-10-30 19:27:55 +0300
commitdd4c0c6b22d3e3ede23cff9ac43786f5f00948ec (patch)
treed83806621b97752328550e238fa97c4767fc75a4
parentd25af82cc05b9f98d6be7ce4623aaa1381a156ab (diff)
compel: fpu -- Add compel_fpu_feature_offset helper
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Reviewed-by: Dmitry Safonov <0x7f454c46@gmail.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
-rw-r--r--compel/arch/aarch64/src/lib/cpu.c9
-rw-r--r--compel/arch/arm/src/lib/cpu.c9
-rw-r--r--compel/arch/ppc64/src/lib/cpu.c9
-rw-r--r--compel/arch/s390/src/lib/cpu.c9
-rw-r--r--compel/arch/x86/src/lib/cpu.c12
-rw-r--r--compel/include/uapi/cpu.h1
6 files changed, 49 insertions, 0 deletions
diff --git a/compel/arch/aarch64/src/lib/cpu.c b/compel/arch/aarch64/src/lib/cpu.c
index e82988879..15a49c420 100644
--- a/compel/arch/aarch64/src/lib/cpu.c
+++ b/compel/arch/aarch64/src/lib/cpu.c
@@ -46,6 +46,15 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
+uint32_t compel_fpu_feature_offset(unsigned int feature)
+{
+ if (!rt_info_done) {
+ compel_cpuid(&rt_info);
+ rt_info_done = true;
+ }
+ return 0;
+}
+
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
diff --git a/compel/arch/arm/src/lib/cpu.c b/compel/arch/arm/src/lib/cpu.c
index e82988879..15a49c420 100644
--- a/compel/arch/arm/src/lib/cpu.c
+++ b/compel/arch/arm/src/lib/cpu.c
@@ -46,6 +46,15 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
+uint32_t compel_fpu_feature_offset(unsigned int feature)
+{
+ if (!rt_info_done) {
+ compel_cpuid(&rt_info);
+ rt_info_done = true;
+ }
+ return 0;
+}
+
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
diff --git a/compel/arch/ppc64/src/lib/cpu.c b/compel/arch/ppc64/src/lib/cpu.c
index a9be1fd6b..d0e366e71 100644
--- a/compel/arch/ppc64/src/lib/cpu.c
+++ b/compel/arch/ppc64/src/lib/cpu.c
@@ -60,6 +60,15 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
+uint32_t compel_fpu_feature_offset(unsigned int feature)
+{
+ if (!rt_info_done) {
+ compel_cpuid(&rt_info);
+ rt_info_done = true;
+ }
+ return 0;
+}
+
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
diff --git a/compel/arch/s390/src/lib/cpu.c b/compel/arch/s390/src/lib/cpu.c
index bb32affe8..98503b191 100644
--- a/compel/arch/s390/src/lib/cpu.c
+++ b/compel/arch/s390/src/lib/cpu.c
@@ -51,6 +51,15 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
+uint32_t compel_fpu_feature_offset(unsigned int feature)
+{
+ if (!rt_info_done) {
+ compel_cpuid(&rt_info);
+ rt_info_done = true;
+ }
+ return 0;
+}
+
uint32_t compel_fpu_feature_size(unsigned int feature)
{
if (!rt_info_done) {
diff --git a/compel/arch/x86/src/lib/cpu.c b/compel/arch/x86/src/lib/cpu.c
index dd5524d81..d422f91fd 100644
--- a/compel/arch/x86/src/lib/cpu.c
+++ b/compel/arch/x86/src/lib/cpu.c
@@ -466,6 +466,18 @@ uint32_t compel_fpu_feature_size(unsigned int feature)
return 0;
}
+uint32_t compel_fpu_feature_offset(unsigned int feature)
+{
+ if (!rt_info_done) {
+ compel_cpuid(&rt_info);
+ rt_info_done = true;
+ }
+ if (feature >= FIRST_EXTENDED_XFEATURE &&
+ feature < XFEATURE_MAX)
+ return rt_info.xstate_offsets[feature];
+ return 0;
+}
+
void compel_cpu_clear_feature(unsigned int feature)
{
if (!rt_info_done) {
diff --git a/compel/include/uapi/cpu.h b/compel/include/uapi/cpu.h
index c82f8abb6..6f827d447 100644
--- a/compel/include/uapi/cpu.h
+++ b/compel/include/uapi/cpu.h
@@ -10,6 +10,7 @@ extern int compel_cpuid(compel_cpuinfo_t *info);
extern bool compel_cpu_has_feature(unsigned int feature);
extern bool compel_fpu_has_feature(unsigned int feature);
extern uint32_t compel_fpu_feature_size(unsigned int feature);
+extern uint32_t compel_fpu_feature_offset(unsigned int feature);
extern void compel_cpu_clear_feature(unsigned int feature);
extern void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c);