Lines Matching +full:ecx +full:- +full:1000

1 // SPDX-License-Identifier: GPL-2.0-only
93 * - cpu hotplug: Read serialized by cpu hotplug lock
96 * - Other callsites: Must hold pkg_temp_lock
112 ret = intel_tcc_get_temp(zonedev->cpu, &val, true); in sys_get_curr_temp()
116 *temp = val * 1000; in sys_get_curr_temp()
126 unsigned int trip_index = THERMAL_TRIP_PRIV_TO_INT(trip->priv); in sys_set_trip_temp()
130 tj_max = intel_tcc_get_tjmax(zonedev->cpu); in sys_set_trip_temp()
133 tj_max *= 1000; in sys_set_trip_temp()
135 val = (tj_max - temp)/1000; in sys_set_trip_temp()
138 return -EINVAL; in sys_set_trip_temp()
140 ret = rdmsr_on_cpu(zonedev->cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, in sys_set_trip_temp()
166 return wrmsr_on_cpu(zonedev->cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, in sys_set_trip_temp()
225 zonedev->work_scheduled = false; in pkg_temp_thermal_threshold_work_fn()
228 tzone = zonedev->tzone; in pkg_temp_thermal_threshold_work_fn()
263 if (zonedev && !zonedev->work_scheduled) { in pkg_thermal_notify()
264 zonedev->work_scheduled = true; in pkg_thermal_notify()
265 pkg_thermal_schedule_work(zonedev->cpu, &zonedev->work); in pkg_thermal_notify()
297 tj_max - thres_reg_value * 1000 : THERMAL_TEMP_INVALID; in pkg_temp_thermal_trips_init()
314 u32 eax, ebx, ecx, edx; in pkg_temp_thermal_device_add() local
320 return -ENOMEM; in pkg_temp_thermal_device_add()
322 cpuid(6, &eax, &ebx, &ecx, &edx); in pkg_temp_thermal_device_add()
325 return -ENODEV; in pkg_temp_thermal_device_add()
332 tj_max *= 1000; in pkg_temp_thermal_device_add()
336 return -ENOMEM; in pkg_temp_thermal_device_add()
342 INIT_DELAYED_WORK(&zonedev->work, pkg_temp_thermal_threshold_work_fn); in pkg_temp_thermal_device_add()
343 zonedev->cpu = cpu; in pkg_temp_thermal_device_add()
344 zonedev->tzone = thermal_zone_device_register_with_trips("x86_pkg_temp", in pkg_temp_thermal_device_add()
347 if (IS_ERR(zonedev->tzone)) { in pkg_temp_thermal_device_add()
348 err = PTR_ERR(zonedev->tzone); in pkg_temp_thermal_device_add()
351 err = thermal_zone_device_enable(zonedev->tzone); in pkg_temp_thermal_device_add()
356 rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, zonedev->msr_pkg_therm_low, in pkg_temp_thermal_device_add()
357 zonedev->msr_pkg_therm_high); in pkg_temp_thermal_device_add()
359 cpumask_set_cpu(cpu, &zonedev->cpumask); in pkg_temp_thermal_device_add()
367 thermal_zone_device_unregister(zonedev->tzone); in pkg_temp_thermal_device_add()
382 target = cpumask_any_but(&zonedev->cpumask, cpu); in pkg_thermal_cpu_offline()
383 cpumask_clear_cpu(cpu, &zonedev->cpumask); in pkg_thermal_cpu_offline()
390 struct thermal_zone_device *tzone = zonedev->tzone; in pkg_thermal_cpu_offline()
399 zonedev->tzone = NULL; in pkg_thermal_cpu_offline()
413 was_target = zonedev->cpu == cpu; in pkg_thermal_cpu_offline()
414 zonedev->cpu = target; in pkg_thermal_cpu_offline()
426 zonedev->msr_pkg_therm_low, zonedev->msr_pkg_therm_high); in pkg_thermal_cpu_offline()
433 if (zonedev->work_scheduled && was_target) { in pkg_thermal_cpu_offline()
439 cancel_delayed_work_sync(&zonedev->work); in pkg_thermal_cpu_offline()
447 if (!lastcpu && zonedev->work_scheduled) in pkg_thermal_cpu_offline()
448 pkg_thermal_schedule_work(target, &zonedev->work); in pkg_thermal_cpu_offline()
467 return -ENODEV; in pkg_thermal_cpu_online()
471 cpumask_set_cpu(cpu, &zonedev->cpumask); in pkg_thermal_cpu_online()
488 return -ENODEV; in pkg_temp_thermal_init()
494 return -ENOMEM; in pkg_temp_thermal_init()