mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-26 14:14:01 +08:00
Power management fixes for 5.3-rc2
- Initialize the power capping subsystem and the RAPL driver earlier in case the int340X thermal driver is built-in and attempts to register an MMIO interface for RAPL which must not happen before the requisite infrastructure is ready (Zhang Rui). - Fix the int340X thermal driver's RAPL MMIO interface registration error path (Rafael Wysocki). - Fix possible use-after-free in the pasemi cpufreq driver (Wen Yang). -----BEGIN PGP SIGNATURE----- iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl05cMUSHHJqd0Byand5 c29ja2kubmV0AAoJEILEb/54YlRxcnMP/0ZDUXOYREsqx50wFA5psJrfA0jUKgVP Phao4BAsztLpW88BFxXQppMEsRNhdOZm46U9gGxKRGiCFIe+pZWzr2bfZsp+IhAS jwaoMcOl3OOcBzT1UwJVcZ1AJTIYQzcyfFi+oaqYck+n9MdfAe85KPM88NUjn6JP EbxIdr2SjhzUOrm+OYi4NSFzH0jbq0LcujT7AEPYxFtvOs0kM7U/m93McTpVwTzG 3lzL93P3S0MYpdwmtrkAQs3Z2U+72SNWubSeS9NL6YXfQi/Y4QefZ0HBzIb5VuUC xYBvnF3U6ggQdLByqT6FVp82BJOs5Qbopvk8rEutom/eZeCtQfJFVSwCiCUdBfxp pVkx8a1PJS9cvyHJtir99sRFrG8zZswlhou+9Cn/2CKFG1qMbOYop/jV6qou0R5a q0f+9pAil2PRFHbGkFiYd2JwIAsTA/13Bst5fLp2xzoQiLtBNysUg6QDDT3L2flv 21TLY2LXzaVCKg8xeMFV9KivyGZ8s1yC3TZQpPPDZx+v5kgSJNp9XXY1JHFpmeSr gqYgykSnHkDMGTUYRPTrp+eRR60tn72p8aCllKZRnm2Ng7droLAMRAUPF19LBWRY yuKsPHvu5Hha+3MrFxWKs7tRPTyTi0mhk7BngrIY+T5hf4hlCbheMeNCTw9vtn5E xdiLyhitI6tm =dGSn -----END PGP SIGNATURE----- Merge tag 'pm-5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm Pull power management fixes from Rafael Wysocki "These fix two issues related to the RAPL MMIO interface support added recently and one cpufreq driver issue. Specifics: - Initialize the power capping subsystem and the RAPL driver earlier in case the int340X thermal driver is built-in and attempts to register an MMIO interface for RAPL which must not happen before the requisite infrastructure is ready (Zhang Rui) - Fix the int340X thermal driver's RAPL MMIO interface registration error path (Rafael Wysocki) - Fix possible use-after-free in the pasemi cpufreq driver (Wen Yang)" * tag 'pm-5.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: cpufreq/pasemi: fix use-after-free in pas_cpufreq_cpu_init() int340X/processor_thermal_device: Fix proc_thermal_rapl_remove() powercap: Invoke powercap_init() and rapl_init() earlier
This commit is contained in:
commit
6789f873ed
@ -131,11 +131,19 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
int err = -ENODEV;
|
||||
|
||||
cpu = of_get_cpu_node(policy->cpu, NULL);
|
||||
|
||||
of_node_put(cpu);
|
||||
if (!cpu)
|
||||
goto out;
|
||||
|
||||
max_freqp = of_get_property(cpu, "clock-frequency", NULL);
|
||||
of_node_put(cpu);
|
||||
if (!max_freqp) {
|
||||
err = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* we need the freq in kHz */
|
||||
max_freq = *max_freqp / 1000;
|
||||
|
||||
dn = of_find_compatible_node(NULL, NULL, "1682m-sdc");
|
||||
if (!dn)
|
||||
dn = of_find_compatible_node(NULL, NULL,
|
||||
@ -171,16 +179,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
}
|
||||
|
||||
pr_debug("init cpufreq on CPU %d\n", policy->cpu);
|
||||
|
||||
max_freqp = of_get_property(cpu, "clock-frequency", NULL);
|
||||
if (!max_freqp) {
|
||||
err = -EINVAL;
|
||||
goto out_unmap_sdcpwr;
|
||||
}
|
||||
|
||||
/* we need the freq in kHz */
|
||||
max_freq = *max_freqp / 1000;
|
||||
|
||||
pr_debug("max clock-frequency is at %u kHz\n", max_freq);
|
||||
pr_debug("initializing frequency table\n");
|
||||
|
||||
@ -199,9 +197,6 @@ static int pas_cpufreq_cpu_init(struct cpufreq_policy *policy)
|
||||
cpufreq_generic_init(policy, pas_freqs, get_gizmo_latency());
|
||||
return 0;
|
||||
|
||||
out_unmap_sdcpwr:
|
||||
iounmap(sdcpwr_mapbase);
|
||||
|
||||
out_unmap_sdcasr:
|
||||
iounmap(sdcasr_mapbase);
|
||||
out:
|
||||
|
@ -1454,7 +1454,7 @@ static void __exit rapl_exit(void)
|
||||
unregister_pm_notifier(&rapl_pm_notifier);
|
||||
}
|
||||
|
||||
module_init(rapl_init);
|
||||
fs_initcall(rapl_init);
|
||||
module_exit(rapl_exit);
|
||||
|
||||
MODULE_DESCRIPTION("Intel Runtime Average Power Limit (RAPL) common code");
|
||||
|
@ -671,7 +671,7 @@ static int __init powercap_init(void)
|
||||
return class_register(&powercap_class);
|
||||
}
|
||||
|
||||
device_initcall(powercap_init);
|
||||
fs_initcall(powercap_init);
|
||||
|
||||
MODULE_DESCRIPTION("PowerCap sysfs Driver");
|
||||
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
|
||||
|
@ -487,6 +487,7 @@ static int proc_thermal_rapl_add(struct pci_dev *pdev,
|
||||
rapl_mmio_cpu_online, rapl_mmio_cpu_down_prep);
|
||||
if (ret < 0) {
|
||||
powercap_unregister_control_type(rapl_mmio_priv.control_type);
|
||||
rapl_mmio_priv.control_type = NULL;
|
||||
return ret;
|
||||
}
|
||||
rapl_mmio_priv.pcap_rapl_online = ret;
|
||||
@ -496,6 +497,9 @@ static int proc_thermal_rapl_add(struct pci_dev *pdev,
|
||||
|
||||
static void proc_thermal_rapl_remove(void)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(rapl_mmio_priv.control_type))
|
||||
return;
|
||||
|
||||
cpuhp_remove_state(rapl_mmio_priv.pcap_rapl_online);
|
||||
powercap_unregister_control_type(rapl_mmio_priv.control_type);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user