drm/i915: Differentiate between LLC or snooped for the user
authorChris Wilson <chris@chris-wilson.co.uk>
Fri, 22 Aug 2014 13:41:39 +0000 (14:41 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 3 Sep 2014 09:04:25 +0000 (11:04 +0200)
Rather than describing an object as either "snooped or LLC", we can do
better as we should know what machine we are running on!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_debugfs.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gpu_error.c
drivers/gpu/drm/i915/i915_sysfs.c

index 8246cfea9abb4b7d48bb534b14a148273c39b34a..d06c823b0745af16ac7eb920e2dfc6a9bd290f71 100644 (file)
@@ -136,7 +136,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
                   obj->last_read_seqno,
                   obj->last_write_seqno,
                   obj->last_fenced_seqno,
-                  i915_cache_level_str(obj->cache_level),
+                  i915_cache_level_str(to_i915(obj->base.dev), obj->cache_level),
                   obj->dirty ? " dirty" : "",
                   obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");
        if (obj->base.name)
@@ -933,7 +933,7 @@ static ssize_t i915_error_state_read(struct file *file, char __user *userbuf,
        ssize_t ret_count = 0;
        int ret;
 
-       ret = i915_error_state_buf_init(&error_str, count, *pos);
+       ret = i915_error_state_buf_init(&error_str, to_i915(error_priv->dev), count, *pos);
        if (ret)
                return ret;
 
index de334d78e07ce685f2c7265277de55295e606d56..71e36d2b993e61ac13e0e026c779d1d33f5d9707 100644 (file)
@@ -1168,6 +1168,7 @@ struct i915_gem_mm {
 };
 
 struct drm_i915_error_state_buf {
+       struct drm_i915_private *i915;
        unsigned bytes;
        unsigned size;
        int err;
@@ -2666,6 +2667,7 @@ void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
 int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
                            const struct i915_error_state_file_priv *error);
 int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb,
+                             struct drm_i915_private *i915,
                              size_t count, loff_t pos);
 static inline void i915_error_state_buf_release(
        struct drm_i915_error_state_buf *eb)
@@ -2680,7 +2682,7 @@ void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
 void i915_destroy_error_state(struct drm_device *dev);
 
 void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone);
-const char *i915_cache_level_str(int type);
+const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
 
 /* i915_cmd_parser.c */
 int i915_cmd_parser_get_version(void);
index 22698d44b38d9a28606485af050bedb7a2ad5f8d..2c87a797213f4e94305be2846bd9a7caa5765d51 100644 (file)
@@ -208,7 +208,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
                err_puts(m, err->userptr ? " userptr" : "");
                err_puts(m, err->ring != -1 ? " " : "");
                err_puts(m, ring_str(err->ring));
-               err_puts(m, i915_cache_level_str(err->cache_level));
+               err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
 
                if (err->name)
                        err_printf(m, " (name: %d)", err->name);
@@ -494,9 +494,11 @@ out:
 }
 
 int i915_error_state_buf_init(struct drm_i915_error_state_buf *ebuf,
+                             struct drm_i915_private *i915,
                              size_t count, loff_t pos)
 {
        memset(ebuf, 0, sizeof(*ebuf));
+       ebuf->i915 = i915;
 
        /* We need to have enough room to store any i915_error_state printf
         * so that we can move it to start position.
@@ -1355,11 +1357,11 @@ void i915_destroy_error_state(struct drm_device *dev)
                kref_put(&error->ref, i915_error_state_free);
 }
 
-const char *i915_cache_level_str(int type)
+const char *i915_cache_level_str(struct drm_i915_private *i915, int type)
 {
        switch (type) {
        case I915_CACHE_NONE: return " uncached";
-       case I915_CACHE_LLC: return " snooped or LLC";
+       case I915_CACHE_LLC: return HAS_LLC(i915) ? " LLC" : " snooped";
        case I915_CACHE_L3_LLC: return " L3+LLC";
        case I915_CACHE_WT: return " WT";
        default: return "";
index ae7fd8fc27f05cab33eea39739c96f816f156fe9..503847f18fdd5a1252403ca44d85de7daab6fa82 100644 (file)
@@ -540,7 +540,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
 
        memset(&error_priv, 0, sizeof(error_priv));
 
-       ret = i915_error_state_buf_init(&error_str, count, off);
+       ret = i915_error_state_buf_init(&error_str, to_i915(dev), count, off);
        if (ret)
                return ret;