28 #include <linux/device.h>
29 #include <linux/module.h>
30 #include <linux/stat.h>
51 struct drm_minor *dminor =
container_of(kdev,
struct drm_minor, kdev);
58 struct drm_minor *dminor =
container_of(kdev,
struct drm_minor, kdev);
66 struct drm_minor *dminor =
container_of(kdev,
struct drm_minor, kdev);
74 struct drm_minor *dminor =
container_of(kdev,
struct drm_minor, kdev);
85 &dev_attr_rc6_enable.attr,
86 &dev_attr_rc6_residency_ms.attr,
87 &dev_attr_rc6p_residency_ms.attr,
88 &dev_attr_rc6pp_residency_ms.attr,
113 i915_l3_read(
struct file *filp,
struct kobject *kobj,
115 loff_t offset,
size_t count)
118 struct drm_minor *dminor =
container_of(dev,
struct drm_minor, kdev);
124 ret = l3_access_valid(drm_dev, offset);
135 for (i = offset; count >= 4 && i <
GEN7_L3LOG_SIZE; i += 4, count -= 4)
146 i915_l3_write(
struct file *filp,
struct kobject *kobj,
148 loff_t offset,
size_t count)
151 struct drm_minor *dminor =
container_of(dev,
struct drm_minor, kdev);
157 ret = l3_access_valid(drm_dev, offset);
165 if (!dev_priv->
mm.l3_remap_info) {
185 dev_priv->
mm.l3_remap_info =
temp;
187 memcpy(dev_priv->
mm.l3_remap_info + (offset/4),
200 .
size = GEN7_L3LOG_SIZE,
201 .
read = i915_l3_read,
202 .
write = i915_l3_write,
226 struct drm_minor *minor =
container_of(kdev,
struct drm_minor, kdev);
243 const char *buf,
size_t count)
245 struct drm_minor *minor =
container_of(kdev,
struct drm_minor, kdev);
248 u32 val, rp_state_cap, hw_max, hw_min;
251 ret = kstrtou32(buf, 0, &val);
262 hw_max = (rp_state_cap & 0xff);
263 hw_min = ((rp_state_cap & 0xff0000) >> 16);
265 if (val < hw_min || val > hw_max || val < dev_priv->
rps.min_delay) {
270 if (dev_priv->
rps.cur_delay > val)
273 dev_priv->
rps.max_delay =
val;
282 struct drm_minor *minor =
container_of(kdev,
struct drm_minor, kdev);
299 const char *buf,
size_t count)
301 struct drm_minor *minor =
container_of(kdev,
struct drm_minor, kdev);
304 u32 val, rp_state_cap, hw_max, hw_min;
307 ret = kstrtou32(buf, 0, &val);
318 hw_max = (rp_state_cap & 0xff);
319 hw_min = ((rp_state_cap & 0xff0000) >> 16);
321 if (val < hw_min || val > hw_max || val > dev_priv->
rps.max_delay) {
326 if (dev_priv->
rps.cur_delay < val)
329 dev_priv->
rps.min_delay =
val;
350 struct drm_minor *minor =
container_of(kdev,
struct drm_minor, kdev);
362 if (attr == &dev_attr_gt_RP0_freq_mhz) {
364 }
else if (attr == &dev_attr_gt_RP1_freq_mhz) {
366 }
else if (attr == &dev_attr_gt_RPn_freq_mhz) {
374 static const struct attribute *gen6_attrs[] = {
375 &dev_attr_gt_cur_freq_mhz.attr,
376 &dev_attr_gt_max_freq_mhz.attr,
377 &dev_attr_gt_min_freq_mhz.attr,
378 &dev_attr_gt_RP0_freq_mhz.attr,
379 &dev_attr_gt_RP1_freq_mhz.attr,
380 &dev_attr_gt_RPn_freq_mhz.attr,
393 DRM_ERROR(
"RC6 residency sysfs setup failed\n");
399 DRM_ERROR(
"l3 parity sysfs setup failed\n");
405 DRM_ERROR(
"gen6 sysfs setup failed\n");