static void update_cpu_mhz(void *arg) { unsigned long mhz; struct cpu_info *c; mhz = __ecag(ECAG_CPU_ATTRIBUTE, 0); c = this_cpu_ptr(&cpu_info); c->cpu_mhz_dynamic = mhz >> 32; c->cpu_mhz_static = mhz & 0xffffffff; }
/* Get the CPU speed, try sampling facility first and CPU attributes second. */ static void cf_diag_get_cpu_speed(void) { if (cpum_sf_avail()) { /* Sampling facility first */ struct hws_qsi_info_block si; memset(&si, 0, sizeof(si)); if (!qsi(&si)) { cf_diag_cpu_speed = si.cpu_speed; return; } } if (test_facility(34)) { /* CPU speed extract static part */ unsigned long mhz = __ecag(ECAG_CPU_ATTRIBUTE, 0); if (mhz != -1UL) cf_diag_cpu_speed = mhz & 0xffffffff; } }
void __init cpu_detect_mhz_feature(void) { if (test_facility(34) && __ecag(ECAG_CPU_ATTRIBUTE, 0) != -1UL) machine_has_cpu_mhz = 1; }