[CRIU] [PATCH 08/18] compel: fpu -- Add compel_fpu_feature_size
Cyrill Gorcunov
gorcunov at gmail.com
Thu Jul 19 15:47:36 MSK 2018
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
compel/arch/aarch64/src/lib/cpu.c | 9 +++++++++
compel/arch/arm/src/lib/cpu.c | 9 +++++++++
compel/arch/ppc64/src/lib/cpu.c | 9 +++++++++
compel/arch/s390/src/lib/cpu.c | 9 +++++++++
compel/arch/x86/src/lib/cpu.c | 12 ++++++++++++
compel/include/uapi/cpu.h | 2 ++
6 files changed, 50 insertions(+)
diff --git a/compel/arch/aarch64/src/lib/cpu.c b/compel/arch/aarch64/src/lib/cpu.c
index 38d9cbf4ef6d..e82988879382 100644
--- a/compel/arch/aarch64/src/lib/cpu.c
+++ b/compel/arch/aarch64/src/lib/cpu.c
@@ -37,6 +37,15 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
+uint32_t compel_fpu_feature_size(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 38d9cbf4ef6d..e82988879382 100644
--- a/compel/arch/arm/src/lib/cpu.c
+++ b/compel/arch/arm/src/lib/cpu.c
@@ -37,6 +37,15 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
+uint32_t compel_fpu_feature_size(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 27a21a53ad92..a9be1fd6b258 100644
--- a/compel/arch/ppc64/src/lib/cpu.c
+++ b/compel/arch/ppc64/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_size(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 97ab809b8ae4..bb32affe8d57 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_size(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/x86/src/lib/cpu.c b/compel/arch/x86/src/lib/cpu.c
index 85a936299342..dd5524d810ad 100644
--- a/compel/arch/x86/src/lib/cpu.c
+++ b/compel/arch/x86/src/lib/cpu.c
@@ -454,6 +454,18 @@ bool compel_fpu_has_feature(unsigned int feature)
return compel_test_fpu_cap(&rt_info, feature);
}
+uint32_t compel_fpu_feature_size(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_sizes[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 d858a0b467e6..c82f8abb6d23 100644
--- a/compel/include/uapi/cpu.h
+++ b/compel/include/uapi/cpu.h
@@ -2,12 +2,14 @@
#define UAPI_COMPEL_CPU_H__
#include <stdbool.h>
+#include <stdint.h>
#include <compel/asm/cpu.h>
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 void compel_cpu_clear_feature(unsigned int feature);
extern void compel_cpu_copy_cpuinfo(compel_cpuinfo_t *c);
--
2.14.4
More information about the CRIU
mailing list