Lines Matching +full:cx +full:- +full:supply

1 // SPDX-License-Identifier: GPL-2.0-only
7 * https://lore.kernel.org/lkml/1322673664-14642-6-git-send-email-konrad.wilk@oracle.com
35 * - as those shrink to nr_cpu_bits (which is dependent on possible_cpu), which
40 /* Mutex to protect the acpi_ids_done - for CPU hotplug use. */
48 /* Which ACPI P-State dependencies for a enumerated processor */
56 .u.set_pminfo.id = _pr->acpi_id, in push_cxx_to_hypervisor()
60 struct acpi_processor_cx *cx; in push_cxx_to_hypervisor() local
64 dst_cx_states = kcalloc(_pr->power.count, in push_cxx_to_hypervisor()
67 return -ENOMEM; in push_cxx_to_hypervisor()
69 for (ok = 0, i = 1; i <= _pr->power.count; i++) { in push_cxx_to_hypervisor()
70 cx = &_pr->power.states[i]; in push_cxx_to_hypervisor()
71 if (!cx->valid) in push_cxx_to_hypervisor()
76 dst_cx->reg.space_id = ACPI_ADR_SPACE_SYSTEM_IO; in push_cxx_to_hypervisor()
77 if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { in push_cxx_to_hypervisor()
78 dst_cx->reg.bit_width = 8; in push_cxx_to_hypervisor()
79 dst_cx->reg.bit_offset = 0; in push_cxx_to_hypervisor()
80 dst_cx->reg.access_size = 1; in push_cxx_to_hypervisor()
82 dst_cx->reg.space_id = ACPI_ADR_SPACE_FIXED_HARDWARE; in push_cxx_to_hypervisor()
83 if (cx->entry_method == ACPI_CSTATE_FFH) { in push_cxx_to_hypervisor()
85 dst_cx->reg.bit_offset = 2; in push_cxx_to_hypervisor()
86 dst_cx->reg.bit_width = 1; /* VENDOR_INTEL */ in push_cxx_to_hypervisor()
88 dst_cx->reg.access_size = 0; in push_cxx_to_hypervisor()
90 dst_cx->reg.address = cx->address; in push_cxx_to_hypervisor()
92 dst_cx->type = cx->type; in push_cxx_to_hypervisor()
93 dst_cx->latency = cx->latency; in push_cxx_to_hypervisor()
95 dst_cx->dpcnt = 0; in push_cxx_to_hypervisor()
96 set_xen_guest_handle(dst_cx->dp, NULL); in push_cxx_to_hypervisor()
99 pr_debug("No _Cx for ACPI CPU %u\n", _pr->acpi_id); in push_cxx_to_hypervisor()
101 return -EINVAL; in push_cxx_to_hypervisor()
104 op.u.set_pminfo.power.flags.bm_control = _pr->flags.bm_control; in push_cxx_to_hypervisor()
105 op.u.set_pminfo.power.flags.bm_check = _pr->flags.bm_check; in push_cxx_to_hypervisor()
106 op.u.set_pminfo.power.flags.has_cst = _pr->flags.has_cst; in push_cxx_to_hypervisor()
108 _pr->flags.power_setup_done; in push_cxx_to_hypervisor()
116 pr_debug("ACPI CPU%u - C-states uploaded.\n", _pr->acpi_id); in push_cxx_to_hypervisor()
117 for (i = 1; i <= _pr->power.count; i++) { in push_cxx_to_hypervisor()
118 cx = &_pr->power.states[i]; in push_cxx_to_hypervisor()
119 if (!cx->valid) in push_cxx_to_hypervisor()
122 cx->type, cx->desc, (u32)cx->latency); in push_cxx_to_hypervisor()
124 } else if ((ret != -EINVAL) && (ret != -ENOSYS)) in push_cxx_to_hypervisor()
125 /* EINVAL means the ACPI ID is incorrect - meaning the ACPI in push_cxx_to_hypervisor()
126 * table is referencing a non-existing CPU - which can happen in push_cxx_to_hypervisor()
128 pr_err("(CX): Hypervisor error (%d) for ACPI CPU%u\n", in push_cxx_to_hypervisor()
129 ret, _pr->acpi_id); in push_cxx_to_hypervisor()
145 dst_states = kcalloc(_pr->performance->state_count, in xen_copy_pss_data()
148 return ERR_PTR(-ENOMEM); in xen_copy_pss_data()
150 dst_perf->state_count = _pr->performance->state_count; in xen_copy_pss_data()
151 for (i = 0; i < _pr->performance->state_count; i++) { in xen_copy_pss_data()
153 memcpy(&(dst_states[i]), &(_pr->performance->states[i]), in xen_copy_pss_data()
169 dst->shared_type = _pr->performance->shared_type; in xen_copy_psd_data()
171 pdomain = &(_pr->performance->domain_info); in xen_copy_psd_data()
176 if (pdomain->num_processors <= 1) { in xen_copy_psd_data()
177 if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL) in xen_copy_psd_data()
178 dst->shared_type = CPUFREQ_SHARED_TYPE_ALL; in xen_copy_psd_data()
179 else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) in xen_copy_psd_data()
180 dst->shared_type = CPUFREQ_SHARED_TYPE_HW; in xen_copy_psd_data()
181 else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) in xen_copy_psd_data()
182 dst->shared_type = CPUFREQ_SHARED_TYPE_ANY; in xen_copy_psd_data()
185 memcpy(&(dst->domain_info), pdomain, sizeof(struct acpi_psd_package)); in xen_copy_psd_data()
195 dst_pct->descriptor = pct->descriptor; in xen_copy_pct_data()
196 dst_pct->length = pct->length; in xen_copy_pct_data()
197 dst_pct->space_id = pct->space_id; in xen_copy_pct_data()
198 dst_pct->bit_width = pct->bit_width; in xen_copy_pct_data()
199 dst_pct->bit_offset = pct->bit_offset; in xen_copy_pct_data()
200 dst_pct->reserved = pct->reserved; in xen_copy_pct_data()
201 dst_pct->address = pct->address; in xen_copy_pct_data()
210 .u.set_pminfo.id = _pr->acpi_id, in push_pxx_to_hypervisor()
218 dst_perf->platform_limit = _pr->performance_platform_limit; in push_pxx_to_hypervisor()
219 dst_perf->flags |= XEN_PX_PPC; in push_pxx_to_hypervisor()
220 xen_copy_pct_data(&(_pr->performance->control_register), in push_pxx_to_hypervisor()
221 &dst_perf->control_register); in push_pxx_to_hypervisor()
222 xen_copy_pct_data(&(_pr->performance->status_register), in push_pxx_to_hypervisor()
223 &dst_perf->status_register); in push_pxx_to_hypervisor()
224 dst_perf->flags |= XEN_PX_PCT; in push_pxx_to_hypervisor()
227 set_xen_guest_handle(dst_perf->states, dst_states); in push_pxx_to_hypervisor()
228 dst_perf->flags |= XEN_PX_PSS; in push_pxx_to_hypervisor()
231 dst_perf->flags |= XEN_PX_PSD; in push_pxx_to_hypervisor()
233 if (dst_perf->flags != (XEN_PX_PSD | XEN_PX_PSS | XEN_PX_PCT | XEN_PX_PPC)) { in push_pxx_to_hypervisor()
234 pr_warn("ACPI CPU%u missing some P-state data (%x), skipping\n", in push_pxx_to_hypervisor()
235 _pr->acpi_id, dst_perf->flags); in push_pxx_to_hypervisor()
236 ret = -ENODEV; in push_pxx_to_hypervisor()
247 perf = _pr->performance; in push_pxx_to_hypervisor()
248 pr_debug("ACPI CPU%u - P-states uploaded.\n", _pr->acpi_id); in push_pxx_to_hypervisor()
249 for (i = 0; i < perf->state_count; i++) { in push_pxx_to_hypervisor()
251 (i == perf->state ? '*' : ' '), i, in push_pxx_to_hypervisor()
252 (u32) perf->states[i].core_frequency, in push_pxx_to_hypervisor()
253 (u32) perf->states[i].power, in push_pxx_to_hypervisor()
254 (u32) perf->states[i].transition_latency); in push_pxx_to_hypervisor()
256 } else if ((ret != -EINVAL) && (ret != -ENOSYS)) in push_pxx_to_hypervisor()
257 /* EINVAL means the ACPI ID is incorrect - meaning the ACPI in push_pxx_to_hypervisor()
258 * table is referencing a non-existing CPU - which can happen in push_pxx_to_hypervisor()
261 ret, _pr->acpi_id); in push_pxx_to_hypervisor()
273 if (__test_and_set_bit(_pr->acpi_id, acpi_ids_done)) { in upload_pm_data()
275 return -EBUSY; in upload_pm_data()
277 if (_pr->flags.power) in upload_pm_data()
280 if (_pr->performance && _pr->performance->states) in upload_pm_data()
297 info->xen_cpuid = 0; in get_max_acpi_id()
306 info->xen_cpuid = i; in get_max_acpi_id()
310 max_acpi_id = max(info->acpi_id, max_acpi_id); in get_max_acpi_id()
319 * The user can supply 'xen_max_vcpus=X' on the Xen hypervisor line
367 nr_acpi_bits - 1, acpi_id); in read_acpi_id()
375 /* It has P-state dependencies */ in read_acpi_id()
387 /* .. and it has a C-state */ in read_acpi_id()
396 return -ENODEV; in check_acpi_ids()
407 return -ENOMEM; in check_acpi_ids()
412 return -ENOMEM; in check_acpi_ids()
420 return -ENOMEM; in check_acpi_ids()
432 pr_backup->acpi_id = i; in check_acpi_ids()
433 /* Mask out C-states if there are no _CST or PBLK */ in check_acpi_ids()
434 pr_backup->flags.power = test_bit(i, acpi_id_cst_present); in check_acpi_ids()
435 /* num_entries is non-zero if we evaluated _PSD */ in check_acpi_ids()
437 memcpy(&pr_backup->performance->domain_info, in check_acpi_ids()
458 ->shared_cpu_map); in free_acpi_perf_data()
503 * xen_upload_processor_pm_data() calls non-atomic code. in xen_acpi_processor_resume()
522 return -ENODEV; in xen_acpi_processor_init()
527 return -ENOMEM; in xen_acpi_processor_init()
533 return -ENOMEM; in xen_acpi_processor_init()
537 &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map, in xen_acpi_processor_init()
539 rc = -ENOMEM; in xen_acpi_processor_init()
556 pr->performance = perf; in xen_acpi_processor_init()
595 MODULE_DESCRIPTION("Xen ACPI Processor P-states (and Cx) driver which uploads PM data to Xen hyperv…