diff options
-rw-r--r-- | compel/arch/aarch64/src/lib/cpu.c | 9 | ||||
-rw-r--r-- | compel/arch/arm/src/lib/cpu.c | 9 | ||||
-rw-r--r-- | compel/arch/ppc64/src/lib/cpu.c | 9 | ||||
-rw-r--r-- | compel/arch/s390/src/lib/cpu.c | 9 | ||||
-rw-r--r-- | compel/arch/x86/src/lib/cpu.c | 12 | ||||
-rw-r--r-- | compel/include/uapi/cpu.h | 1 |
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); |