#include <drm/drm_device.h>
#include <linux/sysfs.h>
#include <linux/printk.h>
#include "i915_drv.h"
#include "i915_reg.h"
#include "i915_sysfs.h"
#include "intel_gt.h"
#include "intel_gt_print.h"
#include "intel_gt_regs.h"
#include "intel_gt_sysfs.h"
#include "intel_gt_sysfs_pm.h"
#include "intel_pcode.h"
#include "intel_rc6.h"
#include "intel_rps.h"
enum intel_gt_sysfs_op { … };
static int
sysfs_gt_attribute_w_func(struct kobject *kobj, struct attribute *attr,
int (func)(struct intel_gt *gt, u32 val), u32 val)
{ … }
static u32
sysfs_gt_attribute_r_func(struct kobject *kobj, struct attribute *attr,
u32 (func)(struct intel_gt *gt),
enum intel_gt_sysfs_op op)
{ … }
#define sysfs_gt_attribute_r_min_func(d, a, f) …
#define sysfs_gt_attribute_r_max_func(d, a, f) …
#define INTEL_GT_SYSFS_SHOW(_name, _attr_type) …
#define INTEL_GT_SYSFS_STORE(_name, _func) …
#define INTEL_GT_SYSFS_SHOW_MAX(_name) …
#define INTEL_GT_SYSFS_SHOW_MIN(_name) …
#define INTEL_GT_ATTR_RW(_name) …
#define INTEL_GT_ATTR_RO(_name) …
#define INTEL_GT_DUAL_ATTR_RW(_name) …
#define INTEL_GT_DUAL_ATTR_RO(_name) …
static u32 get_residency(struct intel_gt *gt, enum intel_rc6_res_type id)
{ … }
static ssize_t rc6_enable_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
static ssize_t rc6_enable_dev_show(struct device *dev,
struct device_attribute *attr,
char *buff)
{ … }
static u32 __rc6_residency_ms_show(struct intel_gt *gt)
{ … }
static u32 __rc6p_residency_ms_show(struct intel_gt *gt)
{ … }
static u32 __rc6pp_residency_ms_show(struct intel_gt *gt)
{ … }
static u32 __media_rc6_residency_ms_show(struct intel_gt *gt)
{ … }
INTEL_GT_SYSFS_SHOW_MIN(rc6_residency_ms);
INTEL_GT_SYSFS_SHOW_MIN(rc6p_residency_ms);
INTEL_GT_SYSFS_SHOW_MIN(rc6pp_residency_ms);
INTEL_GT_SYSFS_SHOW_MIN(media_rc6_residency_ms);
INTEL_GT_DUAL_ATTR_RO(…);
INTEL_GT_DUAL_ATTR_RO(…);
INTEL_GT_DUAL_ATTR_RO(…);
INTEL_GT_DUAL_ATTR_RO(…);
INTEL_GT_DUAL_ATTR_RO(…);
static struct attribute *rc6_attrs[] = …;
static struct attribute *rc6p_attrs[] = …;
static struct attribute *media_rc6_attrs[] = …;
static struct attribute *rc6_dev_attrs[] = …;
static struct attribute *rc6p_dev_attrs[] = …;
static struct attribute *media_rc6_dev_attrs[] = …;
static const struct attribute_group rc6_attr_group[] = …;
static const struct attribute_group rc6p_attr_group[] = …;
static const struct attribute_group media_rc6_attr_group[] = …;
static int __intel_gt_sysfs_create_group(struct kobject *kobj,
const struct attribute_group *grp)
{ … }
static void intel_sysfs_rc6_init(struct intel_gt *gt, struct kobject *kobj)
{ … }
static u32 __act_freq_mhz_show(struct intel_gt *gt)
{ … }
static u32 __cur_freq_mhz_show(struct intel_gt *gt)
{ … }
static u32 __boost_freq_mhz_show(struct intel_gt *gt)
{ … }
static int __boost_freq_mhz_store(struct intel_gt *gt, u32 val)
{ … }
static u32 __RP0_freq_mhz_show(struct intel_gt *gt)
{ … }
static u32 __RPn_freq_mhz_show(struct intel_gt *gt)
{ … }
static u32 __RP1_freq_mhz_show(struct intel_gt *gt)
{ … }
static u32 __max_freq_mhz_show(struct intel_gt *gt)
{ … }
static int __set_max_freq(struct intel_gt *gt, u32 val)
{ … }
static u32 __min_freq_mhz_show(struct intel_gt *gt)
{ … }
static int __set_min_freq(struct intel_gt *gt, u32 val)
{ … }
static u32 __vlv_rpe_freq_mhz_show(struct intel_gt *gt)
{ … }
INTEL_GT_SYSFS_SHOW_MAX(act_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(boost_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(cur_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(RP0_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(RP1_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(RPn_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(max_freq_mhz);
INTEL_GT_SYSFS_SHOW_MIN(min_freq_mhz);
INTEL_GT_SYSFS_SHOW_MAX(vlv_rpe_freq_mhz);
INTEL_GT_SYSFS_STORE(boost_freq_mhz, __boost_freq_mhz_store);
INTEL_GT_SYSFS_STORE(max_freq_mhz, __set_max_freq);
INTEL_GT_SYSFS_STORE(min_freq_mhz, __set_min_freq);
#define INTEL_GT_RPS_SYSFS_ATTR(_name, _mode, _show, _store, _show_dev, _store_dev) …
#define INTEL_GT_RPS_SYSFS_ATTR_RO(_name) …
#define INTEL_GT_RPS_SYSFS_ATTR_RW(_name) …
INTEL_GT_RPS_SYSFS_ATTR_RO(…);
INTEL_GT_RPS_SYSFS_ATTR_RO(…);
INTEL_GT_RPS_SYSFS_ATTR_RW(…);
INTEL_GT_RPS_SYSFS_ATTR_RO(…);
INTEL_GT_RPS_SYSFS_ATTR_RO(…);
INTEL_GT_RPS_SYSFS_ATTR_RO(…);
INTEL_GT_RPS_SYSFS_ATTR_RW(…);
INTEL_GT_RPS_SYSFS_ATTR_RW(…);
INTEL_GT_RPS_SYSFS_ATTR_RO(…);
#define GEN6_ATTR(p, s) …
#define GEN6_RPS_ATTR …
#define GEN6_GT_ATTR …
static const struct attribute * const gen6_rps_attrs[] = …;
static const struct attribute * const gen6_gt_attrs[] = …;
static ssize_t punit_req_freq_mhz_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
static ssize_t slpc_ignore_eff_freq_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
static ssize_t slpc_ignore_eff_freq_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buff, size_t count)
{ … }
struct intel_gt_bool_throttle_attr { … };
static ssize_t throttle_reason_bool_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
#define INTEL_GT_RPS_BOOL_ATTR_RO(sysfs_func__, mask__) …
INTEL_GT_ATTR_RO(…);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_status, GT0_PERF_LIMIT_REASONS_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_pl1, POWER_LIMIT_1_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_pl2, POWER_LIMIT_2_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_pl4, POWER_LIMIT_4_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_thermal, THERMAL_LIMIT_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_prochot, PROCHOT_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_ratl, RATL_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_vr_thermalert, VR_THERMALERT_MASK);
static INTEL_GT_RPS_BOOL_ATTR_RO(throttle_reason_vr_tdc, VR_TDC_MASK);
static const struct attribute *throttle_reason_attrs[] = …;
#define U8_8_VAL_MASK …
#define U8_8_SCALE_TO_VALUE …
static ssize_t freq_factor_scale_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
static u32 media_ratio_mode_to_factor(u32 mode)
{ … }
static ssize_t media_freq_factor_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
static ssize_t media_freq_factor_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buff, size_t count)
{ … }
static ssize_t media_RP0_freq_mhz_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
static ssize_t media_RPn_freq_mhz_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buff)
{ … }
INTEL_GT_ATTR_RW(…);
static struct kobj_attribute attr_media_freq_factor_scale = …;
INTEL_GT_ATTR_RO(…);
INTEL_GT_ATTR_RO(…);
INTEL_GT_ATTR_RW(…);
static const struct attribute *media_perf_power_attrs[] = …;
static ssize_t
rps_up_threshold_pct_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static ssize_t
rps_up_threshold_pct_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{ … }
static struct kobj_attribute rps_up_threshold_pct = …;
static ssize_t
rps_down_threshold_pct_show(struct kobject *kobj, struct kobj_attribute *attr,
char *buf)
{ … }
static ssize_t
rps_down_threshold_pct_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t count)
{ … }
static struct kobj_attribute rps_down_threshold_pct = …;
static const struct attribute * const gen6_gt_rps_attrs[] = …;
static ssize_t
default_min_freq_mhz_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute default_min_freq_mhz = …;
static ssize_t
default_max_freq_mhz_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf)
{ … }
static struct kobj_attribute default_max_freq_mhz = …;
static ssize_t
default_rps_up_threshold_pct_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute default_rps_up_threshold_pct = …;
static ssize_t
default_rps_down_threshold_pct_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{ … }
static struct kobj_attribute default_rps_down_threshold_pct = …;
static const struct attribute * const rps_defaults_attrs[] = …;
static int intel_sysfs_rps_init(struct intel_gt *gt, struct kobject *kobj)
{ … }
void intel_gt_sysfs_pm_init(struct intel_gt *gt, struct kobject *kobj)
{ … }