Lines Matching +full:x +full:- +full:rp
1 // SPDX-License-Identifier: GPL-2.0-only
27 #include <asm/intel-family.h>
60 /* Handles CPU hotplug on multi-socket systems.
65 * per-domain level.
69 struct rapl_package *rp; in rapl_cpu_online() local
71 rp = rapl_find_package_domain(cpu, rapl_msr_priv); in rapl_cpu_online()
72 if (!rp) { in rapl_cpu_online()
73 rp = rapl_add_package(cpu, rapl_msr_priv); in rapl_cpu_online()
74 if (IS_ERR(rp)) in rapl_cpu_online()
75 return PTR_ERR(rp); in rapl_cpu_online()
77 cpumask_set_cpu(cpu, &rp->cpumask); in rapl_cpu_online()
83 struct rapl_package *rp; in rapl_cpu_down_prep() local
86 rp = rapl_find_package_domain(cpu, rapl_msr_priv); in rapl_cpu_down_prep()
87 if (!rp) in rapl_cpu_down_prep()
90 cpumask_clear_cpu(cpu, &rp->cpumask); in rapl_cpu_down_prep()
91 lead_cpu = cpumask_first(&rp->cpumask); in rapl_cpu_down_prep()
93 rapl_remove_package(rp); in rapl_cpu_down_prep()
94 else if (rp->lead_cpu == cpu) in rapl_cpu_down_prep()
95 rp->lead_cpu = lead_cpu; in rapl_cpu_down_prep()
101 u32 msr = (u32)ra->reg; in rapl_msr_read_raw()
103 if (rdmsrl_safe_on_cpu(cpu, msr, &ra->value)) { in rapl_msr_read_raw()
104 pr_debug("failed to read msr 0x%x on cpu %d\n", msr, cpu); in rapl_msr_read_raw()
105 return -EIO; in rapl_msr_read_raw()
107 ra->value &= ra->mask; in rapl_msr_read_raw()
114 u32 msr = (u32)ra->reg; in rapl_msr_update_func()
117 ra->err = rdmsrl_safe(msr, &val); in rapl_msr_update_func()
118 if (ra->err) in rapl_msr_update_func()
121 val &= ~ra->mask; in rapl_msr_update_func()
122 val |= ra->value; in rapl_msr_update_func()
124 ra->err = wrmsrl_safe(msr, val); in rapl_msr_update_func()
135 return ra->err; in rapl_msr_write_raw()
163 pr_err("intel-rapl does not support CPU vendor %d\n", boot_cpu_data.x86_vendor); in rapl_msr_probe()
164 return -ENODEV; in rapl_msr_probe()
166 rapl_msr_priv->read_raw = rapl_msr_read_raw; in rapl_msr_probe()
167 rapl_msr_priv->write_raw = rapl_msr_write_raw; in rapl_msr_probe()
170 rapl_msr_priv->limits[RAPL_DOMAIN_PACKAGE] = 3; in rapl_msr_probe()
171 rapl_msr_priv->regs[RAPL_DOMAIN_PACKAGE][RAPL_DOMAIN_REG_PL4] = in rapl_msr_probe()
176 rapl_msr_priv->control_type = powercap_register_control_type(NULL, "intel-rapl", NULL); in rapl_msr_probe()
177 if (IS_ERR(rapl_msr_priv->control_type)) { in rapl_msr_probe()
179 return PTR_ERR(rapl_msr_priv->control_type); in rapl_msr_probe()
186 rapl_msr_priv->pcap_rapl_online = ret; in rapl_msr_probe()
192 powercap_unregister_control_type(rapl_msr_priv->control_type); in rapl_msr_probe()
198 cpuhp_remove_state(rapl_msr_priv->pcap_rapl_online); in rapl_msr_remove()
199 powercap_unregister_control_type(rapl_msr_priv->control_type); in rapl_msr_remove()