• Home
  • Raw
  • Download

Lines Matching +full:p +full:- +full:states

1 // SPDX-License-Identifier: GPL-2.0-only
34 * - as those shrink to nr_cpu_bits (which is dependent on possible_cpu), which
39 /* Mutex to protect the acpi_ids_done - for CPU hotplug use. */
47 /* Which ACPI P-State dependencies for a enumerated processor */
55 .u.set_pminfo.id = _pr->acpi_id, in push_cxx_to_hypervisor()
63 dst_cx_states = kcalloc(_pr->power.count, in push_cxx_to_hypervisor()
66 return -ENOMEM; in push_cxx_to_hypervisor()
68 for (ok = 0, i = 1; i <= _pr->power.count; i++) { in push_cxx_to_hypervisor()
69 cx = &_pr->power.states[i]; in push_cxx_to_hypervisor()
70 if (!cx->valid) in push_cxx_to_hypervisor()
75 dst_cx->reg.space_id = ACPI_ADR_SPACE_SYSTEM_IO; in push_cxx_to_hypervisor()
76 if (cx->entry_method == ACPI_CSTATE_SYSTEMIO) { in push_cxx_to_hypervisor()
77 dst_cx->reg.bit_width = 8; in push_cxx_to_hypervisor()
78 dst_cx->reg.bit_offset = 0; in push_cxx_to_hypervisor()
79 dst_cx->reg.access_size = 1; in push_cxx_to_hypervisor()
81 dst_cx->reg.space_id = ACPI_ADR_SPACE_FIXED_HARDWARE; in push_cxx_to_hypervisor()
82 if (cx->entry_method == ACPI_CSTATE_FFH) { in push_cxx_to_hypervisor()
84 dst_cx->reg.bit_offset = 2; in push_cxx_to_hypervisor()
85 dst_cx->reg.bit_width = 1; /* VENDOR_INTEL */ in push_cxx_to_hypervisor()
87 dst_cx->reg.access_size = 0; in push_cxx_to_hypervisor()
89 dst_cx->reg.address = cx->address; in push_cxx_to_hypervisor()
91 dst_cx->type = cx->type; in push_cxx_to_hypervisor()
92 dst_cx->latency = cx->latency; in push_cxx_to_hypervisor()
94 dst_cx->dpcnt = 0; in push_cxx_to_hypervisor()
95 set_xen_guest_handle(dst_cx->dp, NULL); in push_cxx_to_hypervisor()
98 pr_debug("No _Cx for ACPI CPU %u\n", _pr->acpi_id); in push_cxx_to_hypervisor()
100 return -EINVAL; in push_cxx_to_hypervisor()
103 op.u.set_pminfo.power.flags.bm_control = _pr->flags.bm_control; in push_cxx_to_hypervisor()
104 op.u.set_pminfo.power.flags.bm_check = _pr->flags.bm_check; in push_cxx_to_hypervisor()
105 op.u.set_pminfo.power.flags.has_cst = _pr->flags.has_cst; in push_cxx_to_hypervisor()
107 _pr->flags.power_setup_done; in push_cxx_to_hypervisor()
109 set_xen_guest_handle(op.u.set_pminfo.power.states, dst_cx_states); in push_cxx_to_hypervisor()
115 pr_debug("ACPI CPU%u - C-states uploaded.\n", _pr->acpi_id); in push_cxx_to_hypervisor()
116 for (i = 1; i <= _pr->power.count; i++) { in push_cxx_to_hypervisor()
117 cx = &_pr->power.states[i]; in push_cxx_to_hypervisor()
118 if (!cx->valid) in push_cxx_to_hypervisor()
121 cx->type, cx->desc, (u32)cx->latency); in push_cxx_to_hypervisor()
123 } else if ((ret != -EINVAL) && (ret != -ENOSYS)) in push_cxx_to_hypervisor()
124 /* EINVAL means the ACPI ID is incorrect - meaning the ACPI in push_cxx_to_hypervisor()
125 * table is referencing a non-existing CPU - which can happen in push_cxx_to_hypervisor()
128 ret, _pr->acpi_id); in push_cxx_to_hypervisor()
144 dst_states = kcalloc(_pr->performance->state_count, in xen_copy_pss_data()
147 return ERR_PTR(-ENOMEM); in xen_copy_pss_data()
149 dst_perf->state_count = _pr->performance->state_count; in xen_copy_pss_data()
150 for (i = 0; i < _pr->performance->state_count; i++) { in xen_copy_pss_data()
152 memcpy(&(dst_states[i]), &(_pr->performance->states[i]), in xen_copy_pss_data()
168 dst->shared_type = _pr->performance->shared_type; in xen_copy_psd_data()
170 pdomain = &(_pr->performance->domain_info); in xen_copy_psd_data()
175 if (pdomain->num_processors <= 1) { in xen_copy_psd_data()
176 if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ALL) in xen_copy_psd_data()
177 dst->shared_type = CPUFREQ_SHARED_TYPE_ALL; in xen_copy_psd_data()
178 else if (pdomain->coord_type == DOMAIN_COORD_TYPE_HW_ALL) in xen_copy_psd_data()
179 dst->shared_type = CPUFREQ_SHARED_TYPE_HW; in xen_copy_psd_data()
180 else if (pdomain->coord_type == DOMAIN_COORD_TYPE_SW_ANY) in xen_copy_psd_data()
181 dst->shared_type = CPUFREQ_SHARED_TYPE_ANY; in xen_copy_psd_data()
184 memcpy(&(dst->domain_info), pdomain, sizeof(struct acpi_psd_package)); in xen_copy_psd_data()
194 dst_pct->descriptor = pct->descriptor; in xen_copy_pct_data()
195 dst_pct->length = pct->length; in xen_copy_pct_data()
196 dst_pct->space_id = pct->space_id; in xen_copy_pct_data()
197 dst_pct->bit_width = pct->bit_width; in xen_copy_pct_data()
198 dst_pct->bit_offset = pct->bit_offset; in xen_copy_pct_data()
199 dst_pct->reserved = pct->reserved; in xen_copy_pct_data()
200 dst_pct->address = pct->address; in xen_copy_pct_data()
209 .u.set_pminfo.id = _pr->acpi_id, in push_pxx_to_hypervisor()
217 dst_perf->platform_limit = _pr->performance_platform_limit; in push_pxx_to_hypervisor()
218 dst_perf->flags |= XEN_PX_PPC; in push_pxx_to_hypervisor()
219 xen_copy_pct_data(&(_pr->performance->control_register), in push_pxx_to_hypervisor()
220 &dst_perf->control_register); in push_pxx_to_hypervisor()
221 xen_copy_pct_data(&(_pr->performance->status_register), in push_pxx_to_hypervisor()
222 &dst_perf->status_register); in push_pxx_to_hypervisor()
223 dst_perf->flags |= XEN_PX_PCT; in push_pxx_to_hypervisor()
226 set_xen_guest_handle(dst_perf->states, dst_states); in push_pxx_to_hypervisor()
227 dst_perf->flags |= XEN_PX_PSS; in push_pxx_to_hypervisor()
230 dst_perf->flags |= XEN_PX_PSD; in push_pxx_to_hypervisor()
232 if (dst_perf->flags != (XEN_PX_PSD | XEN_PX_PSS | XEN_PX_PCT | XEN_PX_PPC)) { in push_pxx_to_hypervisor()
233 pr_warn("ACPI CPU%u missing some P-state data (%x), skipping\n", in push_pxx_to_hypervisor()
234 _pr->acpi_id, dst_perf->flags); in push_pxx_to_hypervisor()
235 ret = -ENODEV; in push_pxx_to_hypervisor()
246 perf = _pr->performance; in push_pxx_to_hypervisor()
247 pr_debug("ACPI CPU%u - P-states uploaded.\n", _pr->acpi_id); in push_pxx_to_hypervisor()
248 for (i = 0; i < perf->state_count; i++) { in push_pxx_to_hypervisor()
250 (i == perf->state ? '*' : ' '), i, in push_pxx_to_hypervisor()
251 (u32) perf->states[i].core_frequency, in push_pxx_to_hypervisor()
252 (u32) perf->states[i].power, in push_pxx_to_hypervisor()
253 (u32) perf->states[i].transition_latency); in push_pxx_to_hypervisor()
255 } else if ((ret != -EINVAL) && (ret != -ENOSYS)) in push_pxx_to_hypervisor()
256 /* EINVAL means the ACPI ID is incorrect - meaning the ACPI in push_pxx_to_hypervisor()
257 * table is referencing a non-existing CPU - which can happen in push_pxx_to_hypervisor()
260 ret, _pr->acpi_id); in push_pxx_to_hypervisor()
272 if (__test_and_set_bit(_pr->acpi_id, acpi_ids_done)) { in upload_pm_data()
274 return -EBUSY; in upload_pm_data()
276 if (_pr->flags.power) in upload_pm_data()
279 if (_pr->performance && _pr->performance->states) in upload_pm_data()
296 info->xen_cpuid = 0; in get_max_acpi_id()
305 info->xen_cpuid = i; in get_max_acpi_id()
309 max_acpi_id = max(info->acpi_id, max_acpi_id); in get_max_acpi_id()
366 nr_acpi_bits - 1, acpi_id); in read_acpi_id()
374 /* It has P-state dependencies */ in read_acpi_id()
386 /* .. and it has a C-state */ in read_acpi_id()
395 return -ENODEV; in check_acpi_ids()
406 return -ENOMEM; in check_acpi_ids()
411 return -ENOMEM; in check_acpi_ids()
419 return -ENOMEM; in check_acpi_ids()
431 pr_backup->acpi_id = i; in check_acpi_ids()
432 /* Mask out C-states if there are no _CST or PBLK */ in check_acpi_ids()
433 pr_backup->flags.power = test_bit(i, acpi_id_cst_present); in check_acpi_ids()
434 /* num_entries is non-zero if we evaluated _PSD */ in check_acpi_ids()
436 memcpy(&pr_backup->performance->domain_info, in check_acpi_ids()
457 ->shared_cpu_map); in free_acpi_perf_data()
505 * xen_upload_processor_pm_data() calls non-atomic code. in xen_acpi_processor_resume()
524 return -ENODEV; in xen_acpi_processor_init()
529 return -ENOMEM; in xen_acpi_processor_init()
535 return -ENOMEM; in xen_acpi_processor_init()
539 &per_cpu_ptr(acpi_perf_data, i)->shared_cpu_map, in xen_acpi_processor_init()
541 rc = -ENOMEM; in xen_acpi_processor_init()
558 pr->performance = perf; in xen_acpi_processor_init()
597 MODULE_DESCRIPTION("Xen ACPI Processor P-states (and Cx) driver which uploads PM data to Xen hyperv…