c - Detect Power8 runtime environment and in-core crypto through getauxval? -
i'm on gcc112, little-endian power8 machine running linux. power8 has in-core crypto providing aes, sha , few other useful features. i'm trying determine availability of features @ runtime using getauxval
. use case distros building "minimum" capable machine, , need swap-in faster function @ runtime.
the dump of hwcaps.h
shown below, lacks specific bits power8, aes, sha , others. however, believe power8 isa 2.07, , isa 2.07 has bit ppc_feature2_arch_2_07
.
the thing not clear on is, power8 in-core crypto optional arm's crypto under armv8. can't find document states requirement, , don't have membership openpower access isa documents. (another possibility is, stated missed in docs).
is possible use getauxval
query runtime environment features? if not, how determine feature availability @ runtime? cpu probing alternative available?
maybe more generally, how determine power6, power7 , power8 runtime environments?
auxv.h
empty. header file includes hwcaps.h
.
$ cat /usr/include/bits/hwcap.h ... /* bit numbers must match in kernel's asm/cputable.h. */ /* feature definitions in at_hwcap. */ #define ppc_feature_32 0x80000000 /* 32-bit mode. */ #define ppc_feature_64 0x40000000 /* 64-bit mode. */ #define ppc_feature_601_instr 0x20000000 /* 601 chip, old power isa. */ #define ppc_feature_has_altivec 0x10000000 /* simd/vector unit. */ #define ppc_feature_has_fpu 0x08000000 /* floating point unit. */ #define ppc_feature_has_mmu 0x04000000 /* memory management unit. */ #define ppc_feature_has_4xxmac 0x02000000 /* 4xx multiply accumulator. */ #define ppc_feature_unified_cache 0x01000000 /* unified i/d cache. */ #define ppc_feature_has_spe 0x00800000 /* signal processing ext. */ #define ppc_feature_has_efp_single 0x00400000 /* spe float. */ #define ppc_feature_has_efp_double 0x00200000 /* spe double. */ #define ppc_feature_no_tb 0x00100000 /* 601/403gx have no timebase */ #define ppc_feature_power4 0x00080000 /* power4 isa 2.00 */ #define ppc_feature_power5 0x00040000 /* power5 isa 2.02 */ #define ppc_feature_power5_plus 0x00020000 /* power5+ isa 2.03 */ #define ppc_feature_cell_be 0x00010000 /* cell broadband engine */ #define ppc_feature_booke 0x00008000 /* isa category embedded */ #define ppc_feature_smt 0x00004000 /* simultaneous multi-threading */ #define ppc_feature_icache_snoop 0x00002000 #define ppc_feature_arch_2_05 0x00001000 /* isa 2.05 */ #define ppc_feature_pa6t 0x00000800 /* pa semi 6t core */ #define ppc_feature_has_dfp 0x00000400 /* decimal fp unit */ #define ppc_feature_power6_ext 0x00000200 /* p6 + mffgpr/mftgpr */ #define ppc_feature_arch_2_06 0x00000100 /* isa 2.06 */ #define ppc_feature_has_vsx 0x00000080 /* p7 vector extension. */ #define ppc_feature_pseries_perfmon_compat 0x00000040 #define ppc_feature_true_le 0x00000002 #define ppc_feature_ppc_le 0x00000001 /* feature definitions in at_hwcap2. */ #define ppc_feature2_arch_2_07 0x80000000 /* isa 2.07 */ #define ppc_feature2_has_htm 0x40000000 /* hardware transactional memory */ #define ppc_feature2_has_dscr 0x20000000 /* data stream control register */ #define ppc_feature2_has_ebb 0x10000000 /* event base branching */ #define ppc_feature2_has_isel 0x08000000 /* integer select */ #define ppc_feature2_has_tar 0x04000000 /* target address register */
i'd getauxval()
best way this; hwcap
& hwcap2
values determining hardware features. missing list ppc_feature2_vec_crypto
, indicates presence of vector crypto instructions, sounds 1 need.
as side note: don't want detect processor implementations, processor features. specifically, check individual feature, rather trying check process provides feature. (eg., detect vec_crypto
directly, rather trying check power8, , assume that implies crypto functionality).
as bit of detail, linux's cputable entries specify hwcap
/hwcap2
values. using power8 example:
#define common_user2_power8 (ppc_feature2_arch_2_07 | \ ppc_feature2_htm_comp | \ ppc_feature2_htm_nosc_comp | \ ppc_feature2_dscr | \ ppc_feature2_isel | ppc_feature2_tar | \ ppc_feature2_vec_crypto)
that's arch/powerpc/include/asm/cputable.h
in kernel (which provides actual hwcap bits can set in aux vector).
finally, i'm sure don't need openpower foundation member download isa (latest 3.0b) - need account on website.
Comments
Post a Comment