systemcfg.go 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. //go:build aix
  2. // +build aix
  3. package perfstat
  4. import "golang.org/x/sys/unix"
  5. // function Getsystemcfg() is defined in golang.org/x/sys/unix
  6. // we define here just missing constants for the function and some helpers
  7. // Calls to getsystemcfg()
  8. const (
  9. SC_ARCH = 1 /* processor architecture */
  10. SC_IMPL = 2 /* processor implementation */
  11. SC_VERS = 3 /* processor version */
  12. SC_WIDTH = 4 /* width (32 || 64) */
  13. SC_NCPUS = 5 /* 1 = UP, n = n-way MP */
  14. SC_L1C_ATTR = 6 /* L1 cache attributes (bit flags) */
  15. SC_L1C_ISZ = 7 /* size of L1 instruction cache */
  16. SC_L1C_DSZ = 8 /* size of L1 data cache */
  17. SC_L1C_ICA = 9 /* L1 instruction cache associativity */
  18. SC_L1C_DCA = 10 /* L1 data cache associativity */
  19. SC_L1C_IBS = 11 /* L1 instruction cache block size */
  20. SC_L1C_DBS = 12 /* L1 data cache block size */
  21. SC_L1C_ILS = 13 /* L1 instruction cache line size */
  22. SC_L1C_DLS = 14 /* L1 data cache line size */
  23. SC_L2C_SZ = 15 /* size of L2 cache, 0 = No L2 cache */
  24. SC_L2C_AS = 16 /* L2 cache associativity */
  25. SC_TLB_ATTR = 17 /* TLB attributes (bit flags) */
  26. SC_ITLB_SZ = 18 /* entries in instruction TLB */
  27. SC_DTLB_SZ = 19 /* entries in data TLB */
  28. SC_ITLB_ATT = 20 /* instruction tlb associativity */
  29. SC_DTLB_ATT = 21 /* data tlb associativity */
  30. SC_RESRV_SZ = 22 /* size of reservation */
  31. SC_PRI_LC = 23 /* spin lock count in supevisor mode */
  32. SC_PRO_LC = 24 /* spin lock count in problem state */
  33. SC_RTC_TYPE = 25 /* RTC type */
  34. SC_VIRT_AL = 26 /* 1 if hardware aliasing is supported */
  35. SC_CAC_CONG = 27 /* number of page bits for cache synonym */
  36. SC_MOD_ARCH = 28 /* used by system for model determination */
  37. SC_MOD_IMPL = 29 /* used by system for model determination */
  38. SC_XINT = 30 /* used by system for time base conversion */
  39. SC_XFRAC = 31 /* used by system for time base conversion */
  40. SC_KRN_ATTR = 32 /* kernel attributes, see below */
  41. SC_PHYSMEM = 33 /* bytes of OS available memory */
  42. SC_SLB_ATTR = 34 /* SLB attributes */
  43. SC_SLB_SZ = 35 /* size of slb (0 = no slb) */
  44. SC_ORIG_NCPUS = 36 /* original number of CPUs */
  45. SC_MAX_NCPUS = 37 /* max cpus supported by this AIX image */
  46. SC_MAX_REALADDR = 38 /* max supported real memory address +1 */
  47. SC_ORIG_ENT_CAP = 39 /* configured entitled processor capacity at boot required by cross-partition LPAR tools. */
  48. SC_ENT_CAP = 40 /* entitled processor capacity */
  49. SC_DISP_WHE = 41 /* Dispatch wheel time period (TB units) */
  50. SC_CAPINC = 42 /* delta by which capacity can change */
  51. SC_VCAPW = 43 /* priority weight for idle capacity distribution */
  52. SC_SPLP_STAT = 44 /* State of SPLPAR enablement: 0x1 => 1=SPLPAR capable; 0=not, 0x2 => SPLPAR enabled 0=dedicated, 1=shared */
  53. SC_SMT_STAT = 45 /* State of SMT enablement: 0x1 = SMT Capable 0=no/1=yes, 0x2 = SMT Enabled 0=no/1=yes, 0x4 = SMT threads bound true 0=no/1=yes */
  54. SC_SMT_TC = 46 /* Number of SMT Threads per Physical CPU */
  55. SC_VMX_VER = 47 /* RPA defined VMX version: 0 = VMX not available or disabled, 1 = VMX capable, 2 = VMX and VSX capable */
  56. SC_LMB_SZ = 48 /* Size of an LMB on this system. */
  57. SC_MAX_XCPU = 49 /* Number of exclusive cpus on line */
  58. SC_EC_LVL = 50 /* Kernel error checking level */
  59. SC_AME_STAT = 51 /* AME status */
  60. SC_ECO_STAT = 52 /* extended cache options */
  61. SC_DFP_STAT = 53 /* RPA defined DFP version, 0=none/disabled */
  62. SC_VRM_STAT = 54 /* VRM Capable/enabled */
  63. SC_PHYS_IMP = 55 /* physical processor implementation */
  64. SC_PHYS_VER = 56 /* physical processor version */
  65. SC_SPCM_STATUS = 57
  66. SC_SPCM_MAX = 58
  67. SC_TM_VER = 59 /* Transaction Memory version, 0 - not capable */
  68. SC_NX_CAP = 60 /* NX GZIP capable */
  69. SC_PKS_STATE = 61 /* Platform KeyStore */
  70. SC_MMA_VER = 62
  71. )
  72. /* kernel attributes */
  73. /* bit 0/1 meaning */
  74. /* -----------------------------------------*/
  75. /* 31 32-bit kernel / 64-bit kernel */
  76. /* 30 non-LPAR / LPAR */
  77. /* 29 old 64bit ABI / 64bit Large ABI */
  78. /* 28 non-NUMA / NUMA */
  79. /* 27 UP / MP */
  80. /* 26 no DR CPU add / DR CPU add support */
  81. /* 25 no DR CPU rm / DR CPU rm support */
  82. /* 24 no DR MEM add / DR MEM add support */
  83. /* 23 no DR MEM rm / DR MEM rm support */
  84. /* 22 kernel keys disabled / enabled */
  85. /* 21 no recovery / recovery enabled */
  86. /* 20 non-MLS / MLS enabled */
  87. /* 19 enhanced affinity indicator */
  88. /* 18 non-vTPM / vTPM enabled */
  89. /* 17 non-VIOS / VIOS */
  90. // Values for architecture field
  91. const (
  92. ARCH_POWER_RS = 0x0001 /* Power Classic architecture */
  93. ARCH_POWER_PC = 0x0002 /* Power PC architecture */
  94. ARCH_IA64 = 0x0003 /* Intel IA64 architecture */
  95. )
  96. // Values for implementation field for POWER_PC Architectures
  97. const (
  98. IMPL_POWER_RS1 = 0x00001 /* RS1 class CPU */
  99. IMPL_POWER_RSC = 0x00002 /* RSC class CPU */
  100. IMPL_POWER_RS2 = 0x00004 /* RS2 class CPU */
  101. IMPL_POWER_601 = 0x00008 /* 601 class CPU */
  102. IMPL_POWER_603 = 0x00020 /* 603 class CPU */
  103. IMPL_POWER_604 = 0x00010 /* 604 class CPU */
  104. IMPL_POWER_620 = 0x00040 /* 620 class CPU */
  105. IMPL_POWER_630 = 0x00080 /* 630 class CPU */
  106. IMPL_POWER_A35 = 0x00100 /* A35 class CPU */
  107. IMPL_POWER_RS64II = 0x0200 /* RS64-II class CPU */
  108. IMPL_POWER_RS64III = 0x0400 /* RS64-III class CPU */
  109. IMPL_POWER4 = 0x0800 /* 4 class CPU */
  110. IMPL_POWER_RS64IV = IMPL_POWER4 /* 4 class CPU */
  111. IMPL_POWER_MPC7450 = 0x1000 /* MPC7450 class CPU */
  112. IMPL_POWER5 = 0x2000 /* 5 class CPU */
  113. IMPL_POWER6 = 0x4000 /* 6 class CPU */
  114. IMPL_POWER7 = 0x8000 /* 7 class CPU */
  115. IMPL_POWER8 = 0x10000 /* 8 class CPU */
  116. IMPL_POWER9 = 0x20000 /* 9 class CPU */
  117. IMPL_POWER10 = 0x20000 /* 10 class CPU */
  118. )
  119. // Values for implementation field for IA64 Architectures
  120. const (
  121. IMPL_IA64_M1 = 0x0001 /* IA64 M1 class CPU (Itanium) */
  122. IMPL_IA64_M2 = 0x0002 /* IA64 M2 class CPU */
  123. )
  124. // Values for the version field
  125. const (
  126. PV_601 = 0x010001 /* Power PC 601 */
  127. PV_601A = 0x010002 /* Power PC 601 */
  128. PV_603 = 0x060000 /* Power PC 603 */
  129. PV_604 = 0x050000 /* Power PC 604 */
  130. PV_620 = 0x070000 /* Power PC 620 */
  131. PV_630 = 0x080000 /* Power PC 630 */
  132. PV_A35 = 0x090000 /* Power PC A35 */
  133. PV_RS64II = 0x0A0000 /* Power PC RS64II */
  134. PV_RS64III = 0x0B0000 /* Power PC RS64III */
  135. PV_4 = 0x0C0000 /* Power PC 4 */
  136. PV_RS64IV = PV_4 /* Power PC 4 */
  137. PV_MPC7450 = 0x0D0000 /* Power PC MPC7450 */
  138. PV_4_2 = 0x0E0000 /* Power PC 4 */
  139. PV_4_3 = 0x0E0001 /* Power PC 4 */
  140. PV_5 = 0x0F0000 /* Power PC 5 */
  141. PV_5_2 = 0x0F0001 /* Power PC 5 */
  142. PV_5_3 = 0x0F0002 /* Power PC 5 */
  143. PV_6 = 0x100000 /* Power PC 6 */
  144. PV_6_1 = 0x100001 /* Power PC 6 DD1.x */
  145. PV_7 = 0x200000 /* Power PC 7 */
  146. PV_8 = 0x300000 /* Power PC 8 */
  147. PV_9 = 0x400000 /* Power PC 9 */
  148. PV_10 = 0x500000 /* Power PC 10 */
  149. PV_5_Compat = 0x0F8000 /* Power PC 5 */
  150. PV_6_Compat = 0x108000 /* Power PC 6 */
  151. PV_7_Compat = 0x208000 /* Power PC 7 */
  152. PV_8_Compat = 0x308000 /* Power PC 8 */
  153. PV_9_Compat = 0x408000 /* Power PC 9 */
  154. PV_10_Compat = 0x508000 /* Power PC 10 */
  155. PV_RESERVED_2 = 0x0A0000 /* source compatability */
  156. PV_RESERVED_3 = 0x0B0000 /* source compatability */
  157. PV_RS2 = 0x040000 /* Power RS2 */
  158. PV_RS1 = 0x020000 /* Power RS1 */
  159. PV_RSC = 0x030000 /* Power RSC */
  160. PV_M1 = 0x008000 /* Intel IA64 M1 */
  161. PV_M2 = 0x008001 /* Intel IA64 M2 */
  162. )
  163. // Values for rtc_type
  164. const (
  165. RTC_POWER = 1 /* rtc as defined by Power Arch. */
  166. RTC_POWER_PC = 2 /* rtc as defined by Power PC Arch. */
  167. RTC_IA64 = 3 /* rtc as defined by IA64 Arch. */
  168. )
  169. const NX_GZIP_PRESENT = 0x00000001
  170. const (
  171. PKS_STATE_CAPABLE = 1
  172. PKS_STATE_ENABLED = 2
  173. )
  174. // Macros for identifying physical processor
  175. const (
  176. PPI4_1 = 0x35
  177. PPI4_2 = 0x38
  178. PPI4_3 = 0x39
  179. PPI4_4 = 0x3C
  180. PPI4_5 = 0x44
  181. PPI5_1 = 0x3A
  182. PPI5_2 = 0x3B
  183. PPI6_1 = 0x3E
  184. PPI7_1 = 0x3F
  185. PPI7_2 = 0x4A
  186. PPI8_1 = 0x4B
  187. PPI8_2 = 0x4D
  188. PPI9 = 0x4E
  189. PPI9_1 = 0x4E
  190. PPI10_1 = 0x80
  191. )
  192. // Macros for kernel attributes
  193. const (
  194. KERN_TYPE = 0x1
  195. KERN_LPAR = 0x2
  196. KERN_64BIT_LARGE_ABI = 0x4
  197. KERN_NUMA = 0x8
  198. KERN_UPMP = 0x10
  199. KERN_DR_CPU_ADD = 0x20
  200. KERN_DR_CPU_RM = 0x40
  201. KERN_DR_MEM_ADD = 0x80
  202. KERN_DR_MEM_RM = 0x100
  203. KERN_KKEY_ENABLED = 0x200
  204. KERN_RECOVERY = 0x400
  205. KERN_MLS = 0x800
  206. KERN_ENH_AFFINITY = 0x1000
  207. KERN_VTPM = 0x2000
  208. KERN_VIOS = 0x4000
  209. )
  210. // macros for SPLPAR environment.
  211. const (
  212. SPLPAR_CAPABLE = 0x1
  213. SPLPAR_ENABLED = 0x2
  214. SPLPAR_DONATE_CAPABLE = 0x4
  215. )
  216. // Macros for SMT status determination
  217. const (
  218. SMT_CAPABLE = 0x1
  219. SMT_ENABLE = 0x2
  220. SMT_BOUND = 0x4
  221. SMT_ORDER = 0x8
  222. )
  223. // Macros for VRM status determination
  224. const (
  225. VRM_CAPABLE = 0x1
  226. VRM_ENABLE = 0x2
  227. CMOX_CAPABLE = 0x4
  228. )
  229. // Macros for AME status determination
  230. const AME_ENABLE = 0x1
  231. // Macros for extended cache options
  232. const (
  233. ECO_CAPABLE = 0x1
  234. ECO_ENABLE = 0x2
  235. )
  236. // These define blocks of values for model_arch and model_impl that are reserved for OEM use.
  237. const (
  238. MODEL_ARCH_RSPC = 2
  239. MODEL_ARCH_CHRP = 3
  240. MODEL_ARCH_IA64 = 4
  241. MODEL_ARCH_OEM_START = 1024
  242. MODEL_ARCH_OEM_END = 2047
  243. MODEL_IMPL_RS6K_UP_MCA = 1
  244. MODEL_IMPL_RS6K_SMP_MCA = 2
  245. MODEL_IMPL_RSPC_UP_PCI = 3
  246. MODEL_IMPL_RSPC_SMP_PCI = 4
  247. MODEL_IMPL_CHRP_UP_PCI = 5
  248. MODEL_IMPL_CHRP_SMP_PCI = 6
  249. MODEL_IMPL_IA64_COM = 7
  250. MODEL_IMPL_IA64_SOFTSDV = 8
  251. MODEL_IMPL_MAMBO_SIM = 9
  252. MODEL_IMPL_POWER_KVM = 10
  253. MODEL_IMPL_OEM_START = 1024
  254. MODEL_IMPL_OEM_END = 2047
  255. )
  256. // example determining processor compatibilty mode on AIX:
  257. // impl := unix.Getsystemcfg(SC_IMPL)
  258. // if impl&IMPL_POWER8 != 0 {
  259. // // we are running on POWER8
  260. // }
  261. // if impl&IMPL_POWER9 != 0 {
  262. // // we are running on POWER9
  263. // }
  264. func GetCPUImplementation() string {
  265. impl := unix.Getsystemcfg(SC_IMPL)
  266. switch {
  267. case impl&IMPL_POWER4 != 0:
  268. return "POWER4"
  269. case impl&IMPL_POWER5 != 0:
  270. return "POWER5"
  271. case impl&IMPL_POWER6 != 0:
  272. return "POWER6"
  273. case impl&IMPL_POWER7 != 0:
  274. return "POWER7"
  275. case impl&IMPL_POWER8 != 0:
  276. return "POWER8"
  277. case impl&IMPL_POWER9 != 0:
  278. return "POWER9"
  279. case impl&IMPL_POWER10 != 0:
  280. return "Power10"
  281. default:
  282. return "Unknown"
  283. }
  284. }
  285. func POWER10OrNewer() bool {
  286. impl := unix.Getsystemcfg(SC_IMPL)
  287. if impl&IMPL_POWER10 != 0 {
  288. return true
  289. }
  290. return false
  291. }
  292. func POWER10() bool {
  293. impl := unix.Getsystemcfg(SC_IMPL)
  294. if impl&IMPL_POWER10 != 0 {
  295. return true
  296. }
  297. return false
  298. }
  299. func POWER9OrNewer() bool {
  300. impl := unix.Getsystemcfg(SC_IMPL)
  301. if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 {
  302. return true
  303. }
  304. return false
  305. }
  306. func POWER9() bool {
  307. impl := unix.Getsystemcfg(SC_IMPL)
  308. if impl&IMPL_POWER9 != 0 {
  309. return true
  310. }
  311. return false
  312. }
  313. func POWER8OrNewer() bool {
  314. impl := unix.Getsystemcfg(SC_IMPL)
  315. if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 {
  316. return true
  317. }
  318. return false
  319. }
  320. func POWER8() bool {
  321. impl := unix.Getsystemcfg(SC_IMPL)
  322. if impl&IMPL_POWER8 != 0 {
  323. return true
  324. }
  325. return false
  326. }
  327. func POWER7OrNewer() bool {
  328. impl := unix.Getsystemcfg(SC_IMPL)
  329. if impl&IMPL_POWER10 != 0 || impl&IMPL_POWER9 != 0 || impl&IMPL_POWER8 != 0 || impl&IMPL_POWER7 != 0 {
  330. return true
  331. }
  332. return false
  333. }
  334. func POWER7() bool {
  335. impl := unix.Getsystemcfg(SC_IMPL)
  336. if impl&IMPL_POWER7 != 0 {
  337. return true
  338. }
  339. return false
  340. }
  341. func HasTransactionalMemory() bool {
  342. impl := unix.Getsystemcfg(SC_TM_VER)
  343. if impl > 0 {
  344. return true
  345. }
  346. return false
  347. }
  348. func Is64Bit() bool {
  349. impl := unix.Getsystemcfg(SC_WIDTH)
  350. if impl == 64 {
  351. return true
  352. }
  353. return false
  354. }
  355. func IsSMP() bool {
  356. impl := unix.Getsystemcfg(SC_NCPUS)
  357. if impl > 1 {
  358. return true
  359. }
  360. return false
  361. }
  362. func HasVMX() bool {
  363. impl := unix.Getsystemcfg(SC_VMX_VER)
  364. if impl > 0 {
  365. return true
  366. }
  367. return false
  368. }
  369. func HasVSX() bool {
  370. impl := unix.Getsystemcfg(SC_VMX_VER)
  371. if impl > 1 {
  372. return true
  373. }
  374. return false
  375. }
  376. func HasDFP() bool {
  377. impl := unix.Getsystemcfg(SC_DFP_STAT)
  378. if impl > 1 {
  379. return true
  380. }
  381. return false
  382. }
  383. func HasNxGzip() bool {
  384. impl := unix.Getsystemcfg(SC_NX_CAP)
  385. if impl&NX_GZIP_PRESENT > 0 {
  386. return true
  387. }
  388. return false
  389. }
  390. func PksCapable() bool {
  391. impl := unix.Getsystemcfg(SC_PKS_STATE)
  392. if impl&PKS_STATE_CAPABLE > 0 {
  393. return true
  394. }
  395. return false
  396. }
  397. func PksEnabled() bool {
  398. impl := unix.Getsystemcfg(SC_PKS_STATE)
  399. if impl&PKS_STATE_ENABLED > 0 {
  400. return true
  401. }
  402. return false
  403. }
  404. func CPUMode() string {
  405. impl := unix.Getsystemcfg(SC_VERS)
  406. switch impl {
  407. case PV_10, PV_10_Compat:
  408. return "Power10"
  409. case PV_9, PV_9_Compat:
  410. return "POWER9"
  411. case PV_8, PV_8_Compat:
  412. return "POWER8"
  413. case PV_7, PV_7_Compat:
  414. return "POWER7"
  415. default:
  416. return "Unknown"
  417. }
  418. }
  419. func KernelBits() int {
  420. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  421. if impl&KERN_TYPE == KERN_TYPE {
  422. return 64
  423. }
  424. return 32
  425. }
  426. func IsLPAR() bool {
  427. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  428. if impl&KERN_LPAR == KERN_LPAR {
  429. return true
  430. }
  431. return false
  432. }
  433. func CpuAddCapable() bool {
  434. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  435. if impl&KERN_DR_CPU_ADD == KERN_DR_CPU_ADD {
  436. return true
  437. }
  438. return false
  439. }
  440. func CpuRemoveCapable() bool {
  441. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  442. if impl&KERN_DR_CPU_RM == KERN_DR_CPU_RM {
  443. return true
  444. }
  445. return false
  446. }
  447. func MemoryAddCapable() bool {
  448. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  449. if impl&KERN_DR_MEM_ADD == KERN_DR_MEM_ADD {
  450. return true
  451. }
  452. return false
  453. }
  454. func MemoryRemoveCapable() bool {
  455. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  456. if impl&KERN_DR_MEM_RM == KERN_DR_MEM_RM {
  457. return true
  458. }
  459. return false
  460. }
  461. func DLparCapable() bool {
  462. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  463. if impl&(KERN_DR_CPU_ADD|KERN_DR_CPU_RM|KERN_DR_MEM_ADD|KERN_DR_MEM_RM) > 0 {
  464. return true
  465. }
  466. return false
  467. }
  468. func IsNUMA() bool {
  469. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  470. if impl&KERN_NUMA > 0 {
  471. return true
  472. }
  473. return false
  474. }
  475. func KernelKeys() bool {
  476. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  477. if impl&KERN_KKEY_ENABLED > 0 {
  478. return true
  479. }
  480. return false
  481. }
  482. func RecoveryMode() bool {
  483. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  484. if impl&KERN_RECOVERY > 0 {
  485. return true
  486. }
  487. return false
  488. }
  489. func EnhancedAffinity() bool {
  490. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  491. if impl&KERN_ENH_AFFINITY > 0 {
  492. return true
  493. }
  494. return false
  495. }
  496. func VTpmEnabled() bool {
  497. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  498. if impl&KERN_VTPM > 0 {
  499. return true
  500. }
  501. return false
  502. }
  503. func IsVIOS() bool {
  504. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  505. if impl&KERN_VIOS > 0 {
  506. return true
  507. }
  508. return false
  509. }
  510. func MLSEnabled() bool {
  511. impl := unix.Getsystemcfg(SC_KRN_ATTR)
  512. if impl&KERN_MLS > 0 {
  513. return true
  514. }
  515. return false
  516. }
  517. func SPLparCapable() bool {
  518. impl := unix.Getsystemcfg(SC_SPLP_STAT)
  519. if impl&SPLPAR_CAPABLE > 0 {
  520. return true
  521. }
  522. return false
  523. }
  524. func SPLparEnabled() bool {
  525. impl := unix.Getsystemcfg(SC_SPLP_STAT)
  526. if impl&SPLPAR_ENABLED > 0 {
  527. return true
  528. }
  529. return false
  530. }
  531. func DedicatedLpar() bool {
  532. return !SPLparEnabled()
  533. }
  534. func SPLparCapped() bool {
  535. impl := unix.Getsystemcfg(SC_VCAPW)
  536. if impl == 0 {
  537. return true
  538. }
  539. return false
  540. }
  541. func SPLparDonating() bool {
  542. impl := unix.Getsystemcfg(SC_SPLP_STAT)
  543. if impl&SPLPAR_DONATE_CAPABLE > 0 {
  544. return true
  545. }
  546. return false
  547. }
  548. func SmtCapable() bool {
  549. impl := unix.Getsystemcfg(SC_SMT_STAT)
  550. if impl&SMT_CAPABLE > 0 {
  551. return true
  552. }
  553. return false
  554. }
  555. func SmtEnabled() bool {
  556. impl := unix.Getsystemcfg(SC_SMT_STAT)
  557. if impl&SMT_ENABLE > 0 {
  558. return true
  559. }
  560. return false
  561. }
  562. func VrmCapable() bool {
  563. impl := unix.Getsystemcfg(SC_VRM_STAT)
  564. if impl&VRM_CAPABLE > 0 {
  565. return true
  566. }
  567. return false
  568. }
  569. func VrmEnabled() bool {
  570. impl := unix.Getsystemcfg(SC_VRM_STAT)
  571. if impl&VRM_ENABLE > 0 {
  572. return true
  573. }
  574. return false
  575. }
  576. func AmeEnabled() bool {
  577. impl := unix.Getsystemcfg(SC_AME_STAT)
  578. if impl&AME_ENABLE > 0 {
  579. return true
  580. }
  581. return false
  582. }
  583. func EcoCapable() bool {
  584. impl := unix.Getsystemcfg(SC_ECO_STAT)
  585. if impl&ECO_CAPABLE > 0 {
  586. return true
  587. }
  588. return false
  589. }
  590. func EcoEnabled() bool {
  591. impl := unix.Getsystemcfg(SC_ECO_STAT)
  592. if impl&ECO_ENABLE > 0 {
  593. return true
  594. }
  595. return false
  596. }