drm/i915/gem: manual conversion to struct drm_device logging macros.
authorWambui Karuga <wambui.karugax@gmail.com>
Wed, 22 Jan 2020 12:57:50 +0000 (15:57 +0300)
committerJani Nikula <jani.nikula@intel.com>
Mon, 27 Jan 2020 09:07:06 +0000 (11:07 +0200)
Convert most of the remaining uses of the printk based logging macros to
the new struct drm_device based logging macros in drm/i915/gem.
This also involves extracting the struct drm_i915_private device
from various types, and using it in the various macros.

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Wambui Karuga <wambui.karugax@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200122125750.9737-3-wambui.karugax@gmail.com
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
drivers/gpu/drm/i915/gem/i915_gem_pages.c

index 2516040b1c436ccd6431dbaa6a45cd5aabc99f0d..da1ba8feeedc3fdb5d5fb76183e87924180c828b 100644 (file)
@@ -1415,6 +1415,7 @@ set_engines__load_balance(struct i915_user_extension __user *base, void *data)
        struct i915_context_engines_load_balance __user *ext =
                container_of_user(base, typeof(*ext), base);
        const struct set_engines *set = data;
+       struct drm_i915_private *i915 = set->ctx->i915;
        struct intel_engine_cs *stack[16];
        struct intel_engine_cs **siblings;
        struct intel_context *ce;
@@ -1422,24 +1423,25 @@ set_engines__load_balance(struct i915_user_extension __user *base, void *data)
        unsigned int n;
        int err;
 
-       if (!HAS_EXECLISTS(set->ctx->i915))
+       if (!HAS_EXECLISTS(i915))
                return -ENODEV;
 
-       if (USES_GUC_SUBMISSION(set->ctx->i915))
+       if (USES_GUC_SUBMISSION(i915))
                return -ENODEV; /* not implement yet */
 
        if (get_user(idx, &ext->engine_index))
                return -EFAULT;
 
        if (idx >= set->engines->num_engines) {
-               DRM_DEBUG("Invalid placement value, %d >= %d\n",
-                         idx, set->engines->num_engines);
+               drm_dbg(&i915->drm, "Invalid placement value, %d >= %d\n",
+                       idx, set->engines->num_engines);
                return -EINVAL;
        }
 
        idx = array_index_nospec(idx, set->engines->num_engines);
        if (set->engines->engines[idx]) {
-               DRM_DEBUG("Invalid placement[%d], already occupied\n", idx);
+               drm_dbg(&i915->drm,
+                       "Invalid placement[%d], already occupied\n", idx);
                return -EEXIST;
        }
 
@@ -1471,12 +1473,13 @@ set_engines__load_balance(struct i915_user_extension __user *base, void *data)
                        goto out_siblings;
                }
 
-               siblings[n] = intel_engine_lookup_user(set->ctx->i915,
+               siblings[n] = intel_engine_lookup_user(i915,
                                                       ci.engine_class,
                                                       ci.engine_instance);
                if (!siblings[n]) {
-                       DRM_DEBUG("Invalid sibling[%d]: { class:%d, inst:%d }\n",
-                                 n, ci.engine_class, ci.engine_instance);
+                       drm_dbg(&i915->drm,
+                               "Invalid sibling[%d]: { class:%d, inst:%d }\n",
+                               n, ci.engine_class, ci.engine_instance);
                        err = -EINVAL;
                        goto out_siblings;
                }
@@ -1509,6 +1512,7 @@ set_engines__bond(struct i915_user_extension __user *base, void *data)
        struct i915_context_engines_bond __user *ext =
                container_of_user(base, typeof(*ext), base);
        const struct set_engines *set = data;
+       struct drm_i915_private *i915 = set->ctx->i915;
        struct i915_engine_class_instance ci;
        struct intel_engine_cs *virtual;
        struct intel_engine_cs *master;
@@ -1519,14 +1523,15 @@ set_engines__bond(struct i915_user_extension __user *base, void *data)
                return -EFAULT;
 
        if (idx >= set->engines->num_engines) {
-               DRM_DEBUG("Invalid index for virtual engine: %d >= %d\n",
-                         idx, set->engines->num_engines);
+               drm_dbg(&i915->drm,
+                       "Invalid index for virtual engine: %d >= %d\n",
+                       idx, set->engines->num_engines);
                return -EINVAL;
        }
 
        idx = array_index_nospec(idx, set->engines->num_engines);
        if (!set->engines->engines[idx]) {
-               DRM_DEBUG("Invalid engine at %d\n", idx);
+               drm_dbg(&i915->drm, "Invalid engine at %d\n", idx);
                return -EINVAL;
        }
        virtual = set->engines->engines[idx]->engine;
@@ -1544,11 +1549,12 @@ set_engines__bond(struct i915_user_extension __user *base, void *data)
        if (copy_from_user(&ci, &ext->master, sizeof(ci)))
                return -EFAULT;
 
-       master = intel_engine_lookup_user(set->ctx->i915,
+       master = intel_engine_lookup_user(i915,
                                          ci.engine_class, ci.engine_instance);
        if (!master) {
-               DRM_DEBUG("Unrecognised master engine: { class:%u, instance:%u }\n",
-                         ci.engine_class, ci.engine_instance);
+               drm_dbg(&i915->drm,
+                       "Unrecognised master engine: { class:%u, instance:%u }\n",
+                       ci.engine_class, ci.engine_instance);
                return -EINVAL;
        }
 
@@ -1561,12 +1567,13 @@ set_engines__bond(struct i915_user_extension __user *base, void *data)
                if (copy_from_user(&ci, &ext->engines[n], sizeof(ci)))
                        return -EFAULT;
 
-               bond = intel_engine_lookup_user(set->ctx->i915,
+               bond = intel_engine_lookup_user(i915,
                                                ci.engine_class,
                                                ci.engine_instance);
                if (!bond) {
-                       DRM_DEBUG("Unrecognised engine[%d] for bonding: { class:%d, instance: %d }\n",
-                                 n, ci.engine_class, ci.engine_instance);
+                       drm_dbg(&i915->drm,
+                               "Unrecognised engine[%d] for bonding: { class:%d, instance: %d }\n",
+                               n, ci.engine_class, ci.engine_instance);
                        return -EINVAL;
                }
 
index 61c0a837f163441f02075924de9f494fa1c4414b..cae0581d7e47f75bfbf01cc11bee0fb2190b945d 100644 (file)
@@ -1924,7 +1924,7 @@ static int i915_reset_gen7_sol_offsets(struct i915_request *rq)
        int i;
 
        if (!IS_GEN(rq->i915, 7) || rq->engine->id != RCS0) {
-               DRM_DEBUG("sol reset is gen7/rcs only\n");
+               drm_dbg(&rq->i915->drm, "sol reset is gen7/rcs only\n");
                return -EINVAL;
        }
 
@@ -2847,6 +2847,7 @@ int
 i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
                          struct drm_file *file)
 {
+       struct drm_i915_private *i915 = to_i915(dev);
        struct drm_i915_gem_execbuffer *args = data;
        struct drm_i915_gem_execbuffer2 exec2;
        struct drm_i915_gem_exec_object *exec_list = NULL;
@@ -2856,7 +2857,7 @@ i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
        int err;
 
        if (!check_buffer_count(count)) {
-               DRM_DEBUG("execbuf2 with %zd buffers\n", count);
+               drm_dbg(&i915->drm, "execbuf2 with %zd buffers\n", count);
                return -EINVAL;
        }
 
@@ -2881,8 +2882,9 @@ i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
        exec2_list = kvmalloc_array(count + 1, eb_element_size(),
                                    __GFP_NOWARN | GFP_KERNEL);
        if (exec_list == NULL || exec2_list == NULL) {
-               DRM_DEBUG("Failed to allocate exec list for %d buffers\n",
-                         args->buffer_count);
+               drm_dbg(&i915->drm,
+                       "Failed to allocate exec list for %d buffers\n",
+                       args->buffer_count);
                kvfree(exec_list);
                kvfree(exec2_list);
                return -ENOMEM;
@@ -2891,8 +2893,8 @@ i915_gem_execbuffer_ioctl(struct drm_device *dev, void *data,
                             u64_to_user_ptr(args->buffers_ptr),
                             sizeof(*exec_list) * count);
        if (err) {
-               DRM_DEBUG("copy %d exec entries failed %d\n",
-                         args->buffer_count, err);
+               drm_dbg(&i915->drm, "copy %d exec entries failed %d\n",
+                       args->buffer_count, err);
                kvfree(exec_list);
                kvfree(exec2_list);
                return -EFAULT;
@@ -2939,6 +2941,7 @@ int
 i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
                           struct drm_file *file)
 {
+       struct drm_i915_private *i915 = to_i915(dev);
        struct drm_i915_gem_execbuffer2 *args = data;
        struct drm_i915_gem_exec_object2 *exec2_list;
        struct drm_syncobj **fences = NULL;
@@ -2946,7 +2949,7 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
        int err;
 
        if (!check_buffer_count(count)) {
-               DRM_DEBUG("execbuf2 with %zd buffers\n", count);
+               drm_dbg(&i915->drm, "execbuf2 with %zd buffers\n", count);
                return -EINVAL;
        }
 
@@ -2958,14 +2961,14 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data,
        exec2_list = kvmalloc_array(count + 1, eb_element_size(),
                                    __GFP_NOWARN | GFP_KERNEL);
        if (exec2_list == NULL) {
-               DRM_DEBUG("Failed to allocate exec list for %zd buffers\n",
-                         count);
+               drm_dbg(&i915->drm, "Failed to allocate exec list for %zd buffers\n",
+                       count);
                return -ENOMEM;
        }
        if (copy_from_user(exec2_list,
                           u64_to_user_ptr(args->buffers_ptr),
                           sizeof(*exec2_list) * count)) {
-               DRM_DEBUG("copy %zd exec entries failed\n", count);
+               drm_dbg(&i915->drm, "copy %zd exec entries failed\n", count);
                kvfree(exec2_list);
                return -EFAULT;
        }
index 54aca5c9101e03fa0a53cfe503a6c379dc9881ed..24f4cadea1149fd3aa921cf8b30b743f3853c92d 100644 (file)
@@ -83,10 +83,12 @@ void __i915_gem_object_set_pages(struct drm_i915_gem_object *obj,
 
 int ____i915_gem_object_get_pages(struct drm_i915_gem_object *obj)
 {
+       struct drm_i915_private *i915 = to_i915(obj->base.dev);
        int err;
 
        if (unlikely(obj->mm.madv != I915_MADV_WILLNEED)) {
-               DRM_DEBUG("Attempting to obtain a purgeable object\n");
+               drm_dbg(&i915->drm,
+                       "Attempting to obtain a purgeable object\n");
                return -EFAULT;
        }