cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

cpuidle.h (2260B)


      1/* SPDX-License-Identifier: GPL-2.0 */
      2/*
      3 * cpuidle.h - The internal header file
      4 */
      5
      6#ifndef __DRIVER_CPUIDLE_H
      7#define __DRIVER_CPUIDLE_H
      8
      9/* For internal use only */
     10extern char param_governor[];
     11extern struct cpuidle_governor *cpuidle_curr_governor;
     12extern struct cpuidle_governor *cpuidle_prev_governor;
     13extern struct list_head cpuidle_governors;
     14extern struct list_head cpuidle_detected_devices;
     15extern struct mutex cpuidle_lock;
     16extern spinlock_t cpuidle_driver_lock;
     17extern int cpuidle_disabled(void);
     18extern int cpuidle_enter_state(struct cpuidle_device *dev,
     19		struct cpuidle_driver *drv, int next_state);
     20
     21/* idle loop */
     22extern void cpuidle_install_idle_handler(void);
     23extern void cpuidle_uninstall_idle_handler(void);
     24
     25/* governors */
     26extern struct cpuidle_governor *cpuidle_find_governor(const char *str);
     27extern int cpuidle_switch_governor(struct cpuidle_governor *gov);
     28
     29/* sysfs */
     30
     31struct device;
     32
     33extern int cpuidle_add_interface(struct device *dev);
     34extern void cpuidle_remove_interface(struct device *dev);
     35extern int cpuidle_add_device_sysfs(struct cpuidle_device *device);
     36extern void cpuidle_remove_device_sysfs(struct cpuidle_device *device);
     37extern int cpuidle_add_sysfs(struct cpuidle_device *dev);
     38extern void cpuidle_remove_sysfs(struct cpuidle_device *dev);
     39
     40#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
     41bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state);
     42int cpuidle_coupled_state_verify(struct cpuidle_driver *drv);
     43int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
     44		struct cpuidle_driver *drv, int next_state);
     45int cpuidle_coupled_register_device(struct cpuidle_device *dev);
     46void cpuidle_coupled_unregister_device(struct cpuidle_device *dev);
     47#else
     48static inline
     49bool cpuidle_state_is_coupled(struct cpuidle_driver *drv, int state)
     50{
     51	return false;
     52}
     53
     54static inline int cpuidle_coupled_state_verify(struct cpuidle_driver *drv)
     55{
     56	return 0;
     57}
     58
     59static inline int cpuidle_enter_state_coupled(struct cpuidle_device *dev,
     60		struct cpuidle_driver *drv, int next_state)
     61{
     62	return -1;
     63}
     64
     65static inline int cpuidle_coupled_register_device(struct cpuidle_device *dev)
     66{
     67	return 0;
     68}
     69
     70static inline void cpuidle_coupled_unregister_device(struct cpuidle_device *dev)
     71{
     72}
     73#endif
     74
     75#endif /* __DRIVER_CPUIDLE_H */