Lines Matching +full:ecx +full:- +full:1000
1 // SPDX-License-Identifier: GPL-2.0-only
3 * intel_powerclamp.c - package c-state idle injection
5 * Copyright (c) 2012-2023, Intel Corporation.
16 * cpu in non-irq context does not reduce irq. for majority of the
56 /* Idle ratio observed using package C-state counters */
91 pr_err("Out of recommended range %lu, between 6-25ms\n", in duration_set()
93 ret = -EINVAL; in duration_set()
98 duration = clamp(new_duration, 6ul, 25ul) * 1000; in duration_set()
110 ret = sysfs_emit(buf, "%d\n", duration / 1000); in duration_get()
138 return -ENOMEM; in allocate_copy_idle_injection_mask()
164 ret = -EAGAIN; in cpumask_set()
178 ret = -EINVAL; in cpumask_set()
202 return -ENODEV; in cpumask_get()
225 ret = -EAGAIN; in max_idle_set()
234 ret = -EINVAL; in max_idle_set()
245 ret = -EINVAL; in max_idle_set()
263 …RM_DESC(max_idle, "maximum injected idle time to the total CPU time ratio in percent range:1-100");
291 pr_err("Out of recommended window size %lu, between 2-10\n", in window_size_set()
293 ret = -EINVAL; in window_size_set()
317 unsigned int eax, ebx, ecx, edx; in find_target_mwait() local
325 cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); in find_target_mwait()
327 if (!(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) || in find_target_mwait()
328 !(ecx & CPUID5_ECX_INTERRUPT_BREAK)) in find_target_mwait()
339 (highest_subcstate - 1); in find_target_mwait()
371 while (info->msr_index) { in has_pkg_state_counter()
372 if (!rdmsrl_safe(info->msr_index, &val)) in has_pkg_state_counter()
386 while (info->msr_index) { in pkg_state_counter()
387 if (!info->skip) { in pkg_state_counter()
388 if (!rdmsrl_safe(info->msr_index, &val)) in pkg_state_counter()
391 info->skip = true; in pkg_state_counter()
414 } else if (ratio == MAX_TARGET_RATIO - 1 && in get_compensation()
416 cal_data[ratio - 1].confidence >= CONFIDENCE_OK && in get_compensation()
417 cal_data[ratio - 2].confidence >= CONFIDENCE_OK) { in get_compensation()
419 cal_data[ratio - 1].steady_comp + in get_compensation()
420 cal_data[ratio - 2].steady_comp) / 3; in get_compensation()
422 cal_data[ratio - 1].confidence >= CONFIDENCE_OK && in get_compensation()
425 cal_data[ratio - 1].steady_comp + in get_compensation()
431 comp = MAX_TARGET_RATIO - ratio - 1; in get_compensation()
444 if (d->confidence >= CONFIDENCE_OK) in adjust_compensation()
447 delta = powerclamp_data.target_ratio - current_ratio; in adjust_compensation()
450 if (d->steady_comp) in adjust_compensation()
451 d->steady_comp = in adjust_compensation()
452 roundup(delta+d->steady_comp, 2)/2; in adjust_compensation()
454 d->steady_comp = delta; in adjust_compensation()
455 d->confidence++; in adjust_compensation()
473 else if (tsc_now-tsc_last) { in powerclamp_adjust_controls()
474 val64 = 100*(msr_now-msr_last); in powerclamp_adjust_controls()
475 do_div(val64, (tsc_now-tsc_last)); in powerclamp_adjust_controls()
508 * c-states, thus we need to compensate the injected idle ratio in get_run_time()
516 runtime = duration * 100 / compensated_ratio - duration; in get_run_time()
543 if (tsc_now - tsc_last) { in poll_pkg_cstate()
544 val64 = 100 * (msr_now - msr_last); in poll_pkg_cstate()
545 do_div(val64, (tsc_now - tsc_last)); in poll_pkg_cstate()
627 return -EAGAIN; in powerclamp_idle_injection_register()
705 (unsigned long) (max_idle - 1)); in powerclamp_set_cur_state()
753 return -ENODEV; in powerclamp_probe()
758 pr_info("No package C-state available\n"); in powerclamp_probe()
759 return -ENODEV; in powerclamp_probe()
817 return -ENODEV; in powerclamp_init()
849 MODULE_DESCRIPTION("Package Level C-state Idle Injection for Intel CPUs");