Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'pm-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixes from Rafael Wysocki:
"These address two issues in the TPMI module of the Intel RAPL power
capping driver and one issue in the processor part of the Intel
int340x thermal driver, update a CPU ID list and register definitions
needed for RAPL PL4 support and remove some unused code.

Specifics:

- Fix the TPMI_RAPL_REG_DOMAIN_INFO register offset in the TPMI part
of the Intel RAPL power capping driver, make it ignore minor
hardware version mismatches (which only indicate exposing
additional features) and update register definitions in it to
enable PL4 support (Zhang Rui)

- Add Arrow Lake-U to the list of processors supporting PL4 in the
MSR part of the Intel RAPL power capping driver (Sumeet Pawnikar)

- Remove excess pci_disable_device() calls from the processor part of
the int340x thermal driver to address a warning triggered during
module unload and remove unused CPU hotplug code related to RAPL
support from it (Zhang Rui)"

* tag 'pm-6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
thermal: intel: int340x: processor: Add MMIO RAPL PL4 support
thermal: intel: int340x: processor: Remove MMIO RAPL CPU hotplug support
powercap: intel_rapl_msr: Add PL4 support for Arrowlake-U
powercap: intel_rapl_tpmi: Ignore minor version change
thermal: intel: int340x: processor: Fix warning during module unload
powercap: intel_rapl_tpmi: Fix bogus register reading

+40 -52
+1
drivers/powercap/intel_rapl_msr.c
··· 147 147 X86_MATCH_VFM(INTEL_RAPTORLAKE_P, NULL), 148 148 X86_MATCH_VFM(INTEL_METEORLAKE, NULL), 149 149 X86_MATCH_VFM(INTEL_METEORLAKE_L, NULL), 150 + X86_MATCH_VFM(INTEL_ARROWLAKE_U, NULL), 150 151 {} 151 152 }; 152 153
+15 -4
drivers/powercap/intel_rapl_tpmi.c
··· 15 15 #include <linux/module.h> 16 16 #include <linux/slab.h> 17 17 18 - #define TPMI_RAPL_VERSION 1 18 + #define TPMI_RAPL_MAJOR_VERSION 0 19 + #define TPMI_RAPL_MINOR_VERSION 1 19 20 20 21 /* 1 header + 10 registers + 5 reserved. 8 bytes for each. */ 21 22 #define TPMI_RAPL_DOMAIN_SIZE 128 ··· 155 154 tpmi_domain_size = tpmi_domain_header >> 16 & 0xff; 156 155 tpmi_domain_flags = tpmi_domain_header >> 32 & 0xffff; 157 156 158 - if (tpmi_domain_version != TPMI_RAPL_VERSION) { 159 - pr_warn(FW_BUG "Unsupported version:%d\n", tpmi_domain_version); 157 + if (tpmi_domain_version == TPMI_VERSION_INVALID) { 158 + pr_warn(FW_BUG "Invalid version\n"); 160 159 return -ENODEV; 161 160 } 161 + 162 + if (TPMI_MAJOR_VERSION(tpmi_domain_version) != TPMI_RAPL_MAJOR_VERSION) { 163 + pr_warn(FW_BUG "Unsupported major version:%ld\n", 164 + TPMI_MAJOR_VERSION(tpmi_domain_version)); 165 + return -ENODEV; 166 + } 167 + 168 + if (TPMI_MINOR_VERSION(tpmi_domain_version) > TPMI_RAPL_MINOR_VERSION) 169 + pr_info("Ignore: Unsupported minor version:%ld\n", 170 + TPMI_MINOR_VERSION(tpmi_domain_version)); 162 171 163 172 /* Domain size: in unit of 128 Bytes */ 164 173 if (tpmi_domain_size != 1) { ··· 192 181 pr_warn(FW_BUG "System domain must support Domain Info register\n"); 193 182 return -ENODEV; 194 183 } 195 - tpmi_domain_info = readq(trp->base + offset + TPMI_RAPL_REG_DOMAIN_INFO); 184 + tpmi_domain_info = readq(trp->base + offset + TPMI_RAPL_REG_DOMAIN_INFO * 8); 196 185 if (!(tpmi_domain_info & TPMI_RAPL_DOMAIN_ROOT)) 197 186 return 0; 198 187 domain_type = RAPL_DOMAIN_PLATFORM;
-2
drivers/thermal/intel/int340x_thermal/processor_thermal_device_pci.c
··· 416 416 if (!pci_info->no_legacy) 417 417 proc_thermal_remove(proc_priv); 418 418 proc_thermal_mmio_remove(pdev, proc_priv); 419 - pci_disable_device(pdev); 420 419 421 420 return ret; 422 421 } ··· 437 438 proc_thermal_mmio_remove(pdev, pci_info->proc_priv); 438 439 if (!pci_info->no_legacy) 439 440 proc_thermal_remove(proc_priv); 440 - pci_disable_device(pdev); 441 441 } 442 442 443 443 #ifdef CONFIG_PM_SLEEP
+24 -46
drivers/thermal/intel/int340x_thermal/processor_thermal_rapl.c
··· 13 13 14 14 static const struct rapl_mmio_regs rapl_mmio_default = { 15 15 .reg_unit = 0x5938, 16 - .regs[RAPL_DOMAIN_PACKAGE] = { 0x59a0, 0x593c, 0x58f0, 0, 0x5930}, 16 + .regs[RAPL_DOMAIN_PACKAGE] = { 0x59a0, 0x593c, 0x58f0, 0, 0x5930, 0x59b0}, 17 17 .regs[RAPL_DOMAIN_DRAM] = { 0x58e0, 0x58e8, 0x58ec, 0, 0}, 18 - .limits[RAPL_DOMAIN_PACKAGE] = BIT(POWER_LIMIT2), 18 + .limits[RAPL_DOMAIN_PACKAGE] = BIT(POWER_LIMIT2) | BIT(POWER_LIMIT4), 19 19 .limits[RAPL_DOMAIN_DRAM] = BIT(POWER_LIMIT2), 20 20 }; 21 - 22 - static int rapl_mmio_cpu_online(unsigned int cpu) 23 - { 24 - struct rapl_package *rp; 25 - 26 - /* mmio rapl supports package 0 only for now */ 27 - if (topology_physical_package_id(cpu)) 28 - return 0; 29 - 30 - rp = rapl_find_package_domain_cpuslocked(cpu, &rapl_mmio_priv, true); 31 - if (!rp) { 32 - rp = rapl_add_package_cpuslocked(cpu, &rapl_mmio_priv, true); 33 - if (IS_ERR(rp)) 34 - return PTR_ERR(rp); 35 - } 36 - cpumask_set_cpu(cpu, &rp->cpumask); 37 - return 0; 38 - } 39 - 40 - static int rapl_mmio_cpu_down_prep(unsigned int cpu) 41 - { 42 - struct rapl_package *rp; 43 - int lead_cpu; 44 - 45 - rp = rapl_find_package_domain_cpuslocked(cpu, &rapl_mmio_priv, true); 46 - if (!rp) 47 - return 0; 48 - 49 - cpumask_clear_cpu(cpu, &rp->cpumask); 50 - lead_cpu = cpumask_first(&rp->cpumask); 51 - if (lead_cpu >= nr_cpu_ids) 52 - rapl_remove_package_cpuslocked(rp); 53 - else if (rp->lead_cpu == cpu) 54 - rp->lead_cpu = lead_cpu; 55 - return 0; 56 - } 57 21 58 22 static int rapl_mmio_read_raw(int cpu, struct reg_action *ra) 59 23 { ··· 46 82 int proc_thermal_rapl_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv) 47 83 { 48 84 const struct rapl_mmio_regs *rapl_regs = &rapl_mmio_default; 85 + struct rapl_package *rp; 49 86 enum rapl_domain_reg_id reg; 50 87 enum rapl_domain_type domain; 51 88 int ret; ··· 74 109 return PTR_ERR(rapl_mmio_priv.control_type); 75 110 } 76 111 77 - ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "powercap/rapl:online", 78 - rapl_mmio_cpu_online, rapl_mmio_cpu_down_prep); 79 - if (ret < 0) { 80 - powercap_unregister_control_type(rapl_mmio_priv.control_type); 81 - rapl_mmio_priv.control_type = NULL; 82 - return ret; 112 + /* Register a RAPL package device for package 0 which is always online */ 113 + rp = rapl_find_package_domain(0, &rapl_mmio_priv, false); 114 + if (rp) { 115 + ret = -EEXIST; 116 + goto err; 83 117 } 84 - rapl_mmio_priv.pcap_rapl_online = ret; 118 + 119 + rp = rapl_add_package(0, &rapl_mmio_priv, false); 120 + if (IS_ERR(rp)) { 121 + ret = PTR_ERR(rp); 122 + goto err; 123 + } 85 124 86 125 return 0; 126 + 127 + err: 128 + powercap_unregister_control_type(rapl_mmio_priv.control_type); 129 + rapl_mmio_priv.control_type = NULL; 130 + return ret; 87 131 } 88 132 EXPORT_SYMBOL_GPL(proc_thermal_rapl_add); 89 133 90 134 void proc_thermal_rapl_remove(void) 91 135 { 136 + struct rapl_package *rp; 137 + 92 138 if (IS_ERR_OR_NULL(rapl_mmio_priv.control_type)) 93 139 return; 94 140 95 - cpuhp_remove_state(rapl_mmio_priv.pcap_rapl_online); 141 + rp = rapl_find_package_domain(0, &rapl_mmio_priv, false); 142 + if (rp) 143 + rapl_remove_package(rp); 96 144 powercap_unregister_control_type(rapl_mmio_priv.control_type); 97 145 } 98 146 EXPORT_SYMBOL_GPL(proc_thermal_rapl_remove);