OSDN Git Service

Merge drm/drm-next into drm-misc-next
[uclinux-h8/linux.git] / drivers / gpu / drm / i915 / i915_debugfs.c
index a63d084..9bad6a3 100644 (file)
@@ -943,30 +943,30 @@ static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
 static ssize_t gpu_state_read(struct file *file, char __user *ubuf,
                              size_t count, loff_t *pos)
 {
-       struct i915_gpu_state *error = file->private_data;
-       struct drm_i915_error_state_buf str;
+       struct i915_gpu_state *error;
        ssize_t ret;
-       loff_t tmp;
+       void *buf;
 
+       error = file->private_data;
        if (!error)
                return 0;
 
-       ret = i915_error_state_buf_init(&str, error->i915, count, *pos);
-       if (ret)
-               return ret;
+       /* Bounce buffer required because of kernfs __user API convenience. */
+       buf = kmalloc(count, GFP_KERNEL);
+       if (!buf)
+               return -ENOMEM;
 
-       ret = i915_error_state_to_str(&str, error);
-       if (ret)
+       ret = i915_gpu_state_copy_to_buffer(error, buf, *pos, count);
+       if (ret <= 0)
                goto out;
 
-       tmp = 0;
-       ret = simple_read_from_buffer(ubuf, count, &tmp, str.buf, str.bytes);
-       if (ret < 0)
-               goto out;
+       if (!copy_to_user(ubuf, buf, ret))
+               *pos += ret;
+       else
+               ret = -EFAULT;
 
-       *pos = str.start + ret;
 out:
-       i915_error_state_buf_release(&str);
+       kfree(buf);
        return ret;
 }
 
@@ -3368,13 +3368,15 @@ static int i915_shared_dplls_info(struct seq_file *m, void *unused)
 
 static int i915_wa_registers(struct seq_file *m, void *unused)
 {
-       struct i915_workarounds *wa = &node_to_i915(m->private)->workarounds;
-       int i;
+       struct drm_i915_private *i915 = node_to_i915(m->private);
+       const struct i915_wa_list *wal = &i915->engine[RCS]->ctx_wa_list;
+       struct i915_wa *wa;
+       unsigned int i;
 
-       seq_printf(m, "Workarounds applied: %d\n", wa->count);
-       for (i = 0; i < wa->count; ++i)
+       seq_printf(m, "Workarounds applied: %u\n", wal->count);
+       for (i = 0, wa = wal->list; i < wal->count; i++, wa++)
                seq_printf(m, "0x%X: 0x%08X, mask: 0x%08X\n",
-                          wa->reg[i].addr, wa->reg[i].value, wa->reg[i].mask);
+                          i915_mmio_reg_offset(wa->reg), wa->val, wa->mask);
 
        return 0;
 }
@@ -3434,31 +3436,32 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
 {
        struct drm_i915_private *dev_priv = node_to_i915(m->private);
        struct drm_device *dev = &dev_priv->drm;
-       struct skl_ddb_allocation *ddb;
        struct skl_ddb_entry *entry;
-       enum pipe pipe;
-       int plane;
+       struct intel_crtc *crtc;
 
        if (INTEL_GEN(dev_priv) < 9)
                return -ENODEV;
 
        drm_modeset_lock_all(dev);
 
-       ddb = &dev_priv->wm.skl_hw.ddb;
-
        seq_printf(m, "%-15s%8s%8s%8s\n", "", "Start", "End", "Size");
 
-       for_each_pipe(dev_priv, pipe) {
+       for_each_intel_crtc(&dev_priv->drm, crtc) {
+               struct intel_crtc_state *crtc_state =
+                       to_intel_crtc_state(crtc->base.state);
+               enum pipe pipe = crtc->pipe;
+               enum plane_id plane_id;
+
                seq_printf(m, "Pipe %c\n", pipe_name(pipe));
 
-               for_each_universal_plane(dev_priv, pipe, plane) {
-                       entry = &ddb->plane[pipe][plane];
-                       seq_printf(m, "  Plane%-8d%8u%8u%8u\n", plane + 1,
+               for_each_plane_id_on_crtc(crtc, plane_id) {
+                       entry = &crtc_state->wm.skl.plane_ddb_y[plane_id];
+                       seq_printf(m, "  Plane%-8d%8u%8u%8u\n", plane_id + 1,
                                   entry->start, entry->end,
                                   skl_ddb_entry_size(entry));
                }
 
-               entry = &ddb->plane[pipe][PLANE_CURSOR];
+               entry = &crtc_state->wm.skl.plane_ddb_y[PLANE_CURSOR];
                seq_printf(m, "  %-13s%8u%8u%8u\n", "Cursor", entry->start,
                           entry->end, skl_ddb_entry_size(entry));
        }
@@ -4585,6 +4588,13 @@ static int i915_hpd_storm_ctl_show(struct seq_file *m, void *data)
        struct drm_i915_private *dev_priv = m->private;
        struct i915_hotplug *hotplug = &dev_priv->hotplug;
 
+       /* Synchronize with everything first in case there's been an HPD
+        * storm, but we haven't finished handling it in the kernel yet
+        */
+       synchronize_irq(dev_priv->drm.irq);
+       flush_work(&dev_priv->hotplug.dig_port_work);
+       flush_work(&dev_priv->hotplug.hotplug_work);
+
        seq_printf(m, "Threshold: %d\n", hotplug->hpd_storm_threshold);
        seq_printf(m, "Detected: %s\n",
                   yesno(delayed_work_pending(&hotplug->reenable_work)));