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
108 * tj-max is interesting because threshold is set relative to this
121 *tj_max = val * 1000; in get_tj_max()
123 return val ? 0 : -EINVAL; in get_tj_max()
128 struct zone_device *zonedev = tzd->devdata; in sys_get_curr_temp()
131 rdmsr_on_cpu(zonedev->cpu, MSR_IA32_PACKAGE_THERM_STATUS, in sys_get_curr_temp()
134 *temp = zonedev->tj_max - ((eax >> 16) & 0x7f) * 1000; in sys_get_curr_temp()
138 return -EINVAL; in sys_get_curr_temp()
144 struct zone_device *zonedev = tzd->devdata; in sys_get_trip_temp()
150 return -EINVAL; in sys_get_trip_temp()
160 ret = rdmsr_on_cpu(zonedev->cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, in sys_get_trip_temp()
167 *temp = zonedev->tj_max - thres_reg_value * 1000; in sys_get_trip_temp()
178 struct zone_device *zonedev = tzd->devdata; in sys_set_trip_temp()
182 if (trip >= MAX_NUMBER_OF_TRIPS || temp >= zonedev->tj_max) in sys_set_trip_temp()
183 return -EINVAL; in sys_set_trip_temp()
185 ret = rdmsr_on_cpu(zonedev->cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, in sys_set_trip_temp()
207 l |= (zonedev->tj_max - temp)/1000 << shift; in sys_set_trip_temp()
211 return wrmsr_on_cpu(zonedev->cpu, MSR_IA32_PACKAGE_THERM_INTERRUPT, in sys_set_trip_temp()
280 zonedev->work_scheduled = false; in pkg_temp_thermal_threshold_work_fn()
286 tzone = zonedev->tzone; in pkg_temp_thermal_threshold_work_fn()
322 if (zonedev && !zonedev->work_scheduled) { in pkg_thermal_notify()
323 zonedev->work_scheduled = true; in pkg_thermal_notify()
324 pkg_thermal_schedule_work(zonedev->cpu, &zonedev->work); in pkg_thermal_notify()
334 u32 tj_max, eax, ebx, ecx, edx; in pkg_temp_thermal_device_add() local
339 return -ENOMEM; in pkg_temp_thermal_device_add()
341 cpuid(6, &eax, &ebx, &ecx, &edx); in pkg_temp_thermal_device_add()
344 return -ENODEV; in pkg_temp_thermal_device_add()
354 return -ENOMEM; in pkg_temp_thermal_device_add()
356 INIT_DELAYED_WORK(&zonedev->work, pkg_temp_thermal_threshold_work_fn); in pkg_temp_thermal_device_add()
357 zonedev->cpu = cpu; in pkg_temp_thermal_device_add()
358 zonedev->tj_max = tj_max; in pkg_temp_thermal_device_add()
359 zonedev->tzone = thermal_zone_device_register("x86_pkg_temp", in pkg_temp_thermal_device_add()
363 if (IS_ERR(zonedev->tzone)) { in pkg_temp_thermal_device_add()
364 err = PTR_ERR(zonedev->tzone); in pkg_temp_thermal_device_add()
368 err = thermal_zone_device_enable(zonedev->tzone); in pkg_temp_thermal_device_add()
370 thermal_zone_device_unregister(zonedev->tzone); in pkg_temp_thermal_device_add()
375 rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, zonedev->msr_pkg_therm_low, in pkg_temp_thermal_device_add()
376 zonedev->msr_pkg_therm_high); in pkg_temp_thermal_device_add()
378 cpumask_set_cpu(cpu, &zonedev->cpumask); in pkg_temp_thermal_device_add()
394 target = cpumask_any_but(&zonedev->cpumask, cpu); in pkg_thermal_cpu_offline()
395 cpumask_clear_cpu(cpu, &zonedev->cpumask); in pkg_thermal_cpu_offline()
402 struct thermal_zone_device *tzone = zonedev->tzone; in pkg_thermal_cpu_offline()
411 zonedev->tzone = NULL; in pkg_thermal_cpu_offline()
425 was_target = zonedev->cpu == cpu; in pkg_thermal_cpu_offline()
426 zonedev->cpu = target; in pkg_thermal_cpu_offline()
438 zonedev->msr_pkg_therm_low, zonedev->msr_pkg_therm_high); in pkg_thermal_cpu_offline()
445 if (zonedev->work_scheduled && was_target) { in pkg_thermal_cpu_offline()
451 cancel_delayed_work_sync(&zonedev->work); in pkg_thermal_cpu_offline()
459 if (!lastcpu && zonedev->work_scheduled) in pkg_thermal_cpu_offline()
460 pkg_thermal_schedule_work(target, &zonedev->work); in pkg_thermal_cpu_offline()
478 return -ENODEV; in pkg_thermal_cpu_online()
482 cpumask_set_cpu(cpu, &zonedev->cpumask); in pkg_thermal_cpu_online()
499 return -ENODEV; in pkg_temp_thermal_init()
505 return -ENOMEM; in pkg_temp_thermal_init()