Merge tag 'drm-intel-next-fixes-2018-06-08-2' of git://anongit.freedesktop.org/drm...
authorDave Airlie <airlied@redhat.com>
Fri, 8 Jun 2018 20:34:39 +0000 (06:34 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 8 Jun 2018 20:34:51 +0000 (06:34 +1000)
First batch of i915 fixes for v4.18:
- gvt fixes that missed v4.17, potentially need to be backported
- eDP resolution regression revert
- remove broken nv12 special casing
- remove stale asserts from find active requests

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/87y3fp4h15.fsf@intel.com
15 files changed:
drivers/gpu/drm/i915/gvt/cmd_parser.c
drivers/gpu/drm/i915/gvt/display.h
drivers/gpu/drm/i915/gvt/handlers.c
drivers/gpu/drm/i915/gvt/kvmgt.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/intel_ddi.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_dp.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_dsi.c
drivers/gpu/drm/i915/intel_dvo.c
drivers/gpu/drm/i915/intel_engine_cs.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_panel.c
drivers/gpu/drm/i915/intel_pm.c

index 718ca08f95751af6303f1eb1b651f14cafe3ddc4..b51c05d03f14a1790ba43e70065af6acd74887ef 100644 (file)
@@ -2909,6 +2909,7 @@ static int init_cmd_table(struct intel_gvt *gvt)
                if (info) {
                        gvt_err("%s %s duplicated\n", e->info->name,
                                        info->name);
+                       kfree(e);
                        return -EEXIST;
                }
 
index b46b86892d58f1a39199369ee044d603e3d77eb7..ea7c1c525b8c36f8b57ed6bec9d05d6e13432cce 100644 (file)
@@ -67,7 +67,7 @@
 #define AUX_NATIVE_REPLY_NAK    (0x1 << 4)
 #define AUX_NATIVE_REPLY_DEFER  (0x2 << 4)
 
-#define AUX_BURST_SIZE          16
+#define AUX_BURST_SIZE          20
 
 /* DPCD addresses */
 #define DPCD_REV                       0x000
index 4b6532fb789a21d55505c0321c98708b5a290e45..bcbc47a88a7006a06107005b0faad5c02820c215 100644 (file)
@@ -903,11 +903,14 @@ static int dp_aux_ch_ctl_mmio_write(struct intel_vgpu *vgpu,
                }
 
                /*
-                * Write request format: (command + address) occupies
-                * 3 bytes, followed by (len + 1) bytes of data.
+                * Write request format: Headr (command + address + size) occupies
+                * 4 bytes, followed by (len + 1) bytes of data. See details at
+                * intel_dp_aux_transfer().
                 */
-               if (WARN_ON((len + 4) > AUX_BURST_SIZE))
+               if ((len + 1 + 4) > AUX_BURST_SIZE) {
+                       gvt_vgpu_err("dp_aux_header: len %d is too large\n", len);
                        return -EINVAL;
+               }
 
                /* unpack data from vreg to buf */
                for (t = 0; t < 4; t++) {
@@ -971,8 +974,10 @@ static int dp_aux_ch_ctl_mmio_write(struct intel_vgpu *vgpu,
                /*
                 * Read reply format: ACK (1 byte) plus (len + 1) bytes of data.
                 */
-               if (WARN_ON((len + 2) > AUX_BURST_SIZE))
+               if ((len + 2) > AUX_BURST_SIZE) {
+                       gvt_vgpu_err("dp_aux_header: len %d is too large\n", len);
                        return -EINVAL;
+               }
 
                /* read from virtual DPCD to vreg */
                /* first 4 bytes: [ACK][addr][addr+1][addr+2] */
index 1466d8769ec9facfc73c9ae4db922d0e09944840..df4e4a07db3d6809fa741e7c19c88e754700734e 100644 (file)
@@ -123,6 +123,12 @@ static int gvt_dma_map_page(struct intel_vgpu *vgpu, unsigned long gfn,
                return -EINVAL;
        }
 
+       if (!pfn_valid(pfn)) {
+               gvt_vgpu_err("pfn 0x%lx is not mem backed\n", pfn);
+               vfio_unpin_pages(mdev_dev(vgpu->vdev.mdev), &gfn, 1);
+               return -EINVAL;
+       }
+
        /* Setup DMA mapping. */
        page = pfn_to_page(pfn);
        *dma_addr = dma_map_page(dev, page, 0, PAGE_SIZE,
@@ -583,6 +589,17 @@ out:
        return ret;
 }
 
+static void intel_vgpu_release_msi_eventfd_ctx(struct intel_vgpu *vgpu)
+{
+       struct eventfd_ctx *trigger;
+
+       trigger = vgpu->vdev.msi_trigger;
+       if (trigger) {
+               eventfd_ctx_put(trigger);
+               vgpu->vdev.msi_trigger = NULL;
+       }
+}
+
 static void __intel_vgpu_release(struct intel_vgpu *vgpu)
 {
        struct kvmgt_guest_info *info;
@@ -607,6 +624,8 @@ static void __intel_vgpu_release(struct intel_vgpu *vgpu)
        info = (struct kvmgt_guest_info *)vgpu->handle;
        kvmgt_guest_exit(info);
 
+       intel_vgpu_release_msi_eventfd_ctx(vgpu);
+
        vgpu->vdev.kvm = NULL;
        vgpu->handle = 0;
 }
@@ -987,7 +1006,8 @@ static int intel_vgpu_set_msi_trigger(struct intel_vgpu *vgpu,
                        return PTR_ERR(trigger);
                }
                vgpu->vdev.msi_trigger = trigger;
-       }
+       } else if ((flags & VFIO_IRQ_SET_DATA_NONE) && !count)
+               intel_vgpu_release_msi_eventfd_ctx(vgpu);
 
        return 0;
 }
@@ -1592,6 +1612,18 @@ static int kvmgt_inject_msi(unsigned long handle, u32 addr, u16 data)
        info = (struct kvmgt_guest_info *)handle;
        vgpu = info->vgpu;
 
+       /*
+        * When guest is poweroff, msi_trigger is set to NULL, but vgpu's
+        * config and mmio register isn't restored to default during guest
+        * poweroff. If this vgpu is still used in next vm, this vgpu's pipe
+        * may be enabled, then once this vgpu is active, it will get inject
+        * vblank interrupt request. But msi_trigger is null until msi is
+        * enabled by guest. so if msi_trigger is null, success is still
+        * returned and don't inject interrupt into guest.
+        */
+       if (vgpu->vdev.msi_trigger == NULL)
+               return 0;
+
        if (eventfd_signal(vgpu->vdev.msi_trigger, 1) == 1)
                return 0;
 
index 0a2070112b66e79360479e53db54da4e0503b58d..3704f4c0c2c970c31b0c6031050b20126e7ae2a9 100644 (file)
@@ -2972,23 +2972,22 @@ i915_gem_find_active_request(struct intel_engine_cs *engine)
        struct i915_request *request, *active = NULL;
        unsigned long flags;
 
-       /* We are called by the error capture and reset at a random
-        * point in time. In particular, note that neither is crucially
-        * ordered with an interrupt. After a hang, the GPU is dead and we
-        * assume that no more writes can happen (we waited long enough for
-        * all writes that were in transaction to be flushed) - adding an
+       /*
+        * We are called by the error capture, reset and to dump engine
+        * state at random points in time. In particular, note that neither is
+        * crucially ordered with an interrupt. After a hang, the GPU is dead
+        * and we assume that no more writes can happen (we waited long enough
+        * for all writes that were in transaction to be flushed) - adding an
         * extra delay for a recent interrupt is pointless. Hence, we do
         * not need an engine->irq_seqno_barrier() before the seqno reads.
+        * At all other times, we must assume the GPU is still running, but
+        * we only care about the snapshot of this moment.
         */
        spin_lock_irqsave(&engine->timeline.lock, flags);
        list_for_each_entry(request, &engine->timeline.requests, link) {
                if (__i915_request_completed(request, request->global_seqno))
                        continue;
 
-               GEM_BUG_ON(request->engine != engine);
-               GEM_BUG_ON(test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
-                                   &request->fence.flags));
-
                active = request;
                break;
        }
index b98ac0541f190271b71bbd9cdd7b6c690419bf2a..f4a8598a2d392d607e8d17338f1ff251bc7c627b 100644 (file)
@@ -2453,12 +2453,13 @@ void icl_map_plls_to_ports(struct drm_crtc *crtc,
        for_each_new_connector_in_state(old_state, conn, conn_state, i) {
                struct intel_encoder *encoder =
                        to_intel_encoder(conn_state->best_encoder);
-               enum port port = encoder->port;
+               enum port port;
                uint32_t val;
 
                if (conn_state->crtc != crtc)
                        continue;
 
+               port = encoder->port;
                mutex_lock(&dev_priv->dpll_lock);
 
                val = I915_READ(DPCLKA_CFGCR0_ICL);
@@ -2490,11 +2491,12 @@ void icl_unmap_plls_to_ports(struct drm_crtc *crtc,
        for_each_old_connector_in_state(old_state, conn, old_conn_state, i) {
                struct intel_encoder *encoder =
                        to_intel_encoder(old_conn_state->best_encoder);
-               enum port port = encoder->port;
+               enum port port;
 
                if (old_conn_state->crtc != crtc)
                        continue;
 
+               port = encoder->port;
                mutex_lock(&dev_priv->dpll_lock);
                I915_WRITE(DPCLKA_CFGCR0_ICL,
                           I915_READ(DPCLKA_CFGCR0_ICL) |
index ad588d5641988cc22bfef337abd49898b8d5c211..dee3a8e659f1d6c9dbe2040abd6e2ba42020070a 100644 (file)
@@ -3690,11 +3690,6 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
        plane_color_ctl |= glk_plane_color_ctl_alpha(fb->format->format);
 
        if (intel_format_is_yuv(fb->format->format)) {
-               if (fb->format->format == DRM_FORMAT_NV12) {
-                       plane_color_ctl |=
-                               PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
-                       goto out;
-               }
                if (plane_state->base.color_encoding == DRM_COLOR_YCBCR_BT709)
                        plane_color_ctl |= PLANE_COLOR_CSC_MODE_YUV709_TO_RGB709;
                else
@@ -3703,7 +3698,7 @@ u32 glk_plane_color_ctl(const struct intel_crtc_state *crtc_state,
                if (plane_state->base.color_range == DRM_COLOR_YCBCR_FULL_RANGE)
                        plane_color_ctl |= PLANE_COLOR_YUV_RANGE_CORRECTION_DISABLE;
        }
-out:
+
        return plane_color_ctl;
 }
 
index dde92e4af5d34b7234dbc369e4719237b926a325..8320f0e8e3bef8587b94a908bf87f3eecdf63fc5 100644 (file)
@@ -1679,23 +1679,6 @@ static int intel_dp_compute_bpp(struct intel_dp *intel_dp,
        return bpp;
 }
 
-static bool intel_edp_compare_alt_mode(struct drm_display_mode *m1,
-                                      struct drm_display_mode *m2)
-{
-       bool bres = false;
-
-       if (m1 && m2)
-               bres = (m1->hdisplay == m2->hdisplay &&
-                       m1->hsync_start == m2->hsync_start &&
-                       m1->hsync_end == m2->hsync_end &&
-                       m1->htotal == m2->htotal &&
-                       m1->vdisplay == m2->vdisplay &&
-                       m1->vsync_start == m2->vsync_start &&
-                       m1->vsync_end == m2->vsync_end &&
-                       m1->vtotal == m2->vtotal);
-       return bres;
-}
-
 /* Adjust link config limits based on compliance test requests. */
 static void
 intel_dp_adjust_compliance_config(struct intel_dp *intel_dp,
@@ -1860,16 +1843,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
                pipe_config->has_audio = intel_conn_state->force_audio == HDMI_AUDIO_ON;
 
        if (intel_dp_is_edp(intel_dp) && intel_connector->panel.fixed_mode) {
-               struct drm_display_mode *panel_mode =
-                       intel_connector->panel.alt_fixed_mode;
-               struct drm_display_mode *req_mode = &pipe_config->base.mode;
-
-               if (!intel_edp_compare_alt_mode(req_mode, panel_mode))
-                       panel_mode = intel_connector->panel.fixed_mode;
-
-               drm_mode_debug_printmodeline(panel_mode);
-
-               intel_fixed_panel_mode(panel_mode, adjusted_mode);
+               intel_fixed_panel_mode(intel_connector->panel.fixed_mode,
+                                      adjusted_mode);
 
                if (INTEL_GEN(dev_priv) >= 9) {
                        int ret;
@@ -6159,7 +6134,6 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct drm_connector *connector = &intel_connector->base;
        struct drm_display_mode *fixed_mode = NULL;
-       struct drm_display_mode *alt_fixed_mode = NULL;
        struct drm_display_mode *downclock_mode = NULL;
        bool has_dpcd;
        struct drm_display_mode *scan;
@@ -6214,14 +6188,13 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
        }
        intel_connector->edid = edid;
 
-       /* prefer fixed mode from EDID if available, save an alt mode also */
+       /* prefer fixed mode from EDID if available */
        list_for_each_entry(scan, &connector->probed_modes, head) {
                if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
                        fixed_mode = drm_mode_duplicate(dev, scan);
                        downclock_mode = intel_dp_drrs_init(
                                                intel_connector, fixed_mode);
-               } else if (!alt_fixed_mode) {
-                       alt_fixed_mode = drm_mode_duplicate(dev, scan);
+                       break;
                }
        }
 
@@ -6258,8 +6231,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
                              pipe_name(pipe));
        }
 
-       intel_panel_init(&intel_connector->panel, fixed_mode, alt_fixed_mode,
-                        downclock_mode);
+       intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode);
        intel_connector->panel.backlight.power = intel_edp_backlight_power;
        intel_panel_setup_backlight(connector, pipe);
 
index d7dbca1aabffbdaeea5eb349e7459e733a0fbeff..0361130500a6f7fc0786b343c2193c1629fbb39f 100644 (file)
@@ -277,7 +277,6 @@ struct intel_encoder {
 
 struct intel_panel {
        struct drm_display_mode *fixed_mode;
-       struct drm_display_mode *alt_fixed_mode;
        struct drm_display_mode *downclock_mode;
 
        /* backlight */
@@ -1850,7 +1849,6 @@ void intel_overlay_reset(struct drm_i915_private *dev_priv);
 /* intel_panel.c */
 int intel_panel_init(struct intel_panel *panel,
                     struct drm_display_mode *fixed_mode,
-                    struct drm_display_mode *alt_fixed_mode,
                     struct drm_display_mode *downclock_mode);
 void intel_panel_fini(struct intel_panel *panel);
 void intel_fixed_panel_mode(const struct drm_display_mode *fixed_mode,
index 51a1d6868b1eac8f69d5db8b9b496fbf38cc4295..cf39ca90d887872ddb2de5e011041f785fda3996 100644 (file)
@@ -1846,7 +1846,7 @@ void intel_dsi_init(struct drm_i915_private *dev_priv)
        connector->display_info.width_mm = fixed_mode->width_mm;
        connector->display_info.height_mm = fixed_mode->height_mm;
 
-       intel_panel_init(&intel_connector->panel, fixed_mode, NULL, NULL);
+       intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
        intel_panel_setup_backlight(connector, INVALID_PIPE);
 
        intel_dsi_add_properties(intel_connector);
index eb0c559b27156c0a49e31d342e865e7e88d1ea15..a70d767313aa10e198338e2e7472592827dfa347 100644 (file)
@@ -536,7 +536,7 @@ void intel_dvo_init(struct drm_i915_private *dev_priv)
                         */
                        intel_panel_init(&intel_connector->panel,
                                         intel_dvo_get_current_mode(intel_encoder),
-                                        NULL, NULL);
+                                        NULL);
                        intel_dvo->panel_wants_dither = true;
                }
 
index 6bfd7e3ed1524f354cb480df708bb4ae364ec060..1590375f31cb7ee5af71006d4eff6f07a66e5d68 100644 (file)
@@ -1114,7 +1114,7 @@ static void print_request(struct drm_printer *m,
                          const char *prefix)
 {
        const char *name = rq->fence.ops->get_timeline_name(&rq->fence);
-       char buf[80];
+       char buf[80] = "";
        int x = 0;
 
        x = print_sched_attr(rq->i915, &rq->sched.attr, buf, x, sizeof(buf));
index 8691c86f579c7dc2eba793af80cd4ca0ce392595..d8ece907ff545c6b85673bc2fa64214b5ec51d95 100644 (file)
@@ -1140,8 +1140,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv)
 out:
        mutex_unlock(&dev->mode_config.mutex);
 
-       intel_panel_init(&intel_connector->panel, fixed_mode, NULL,
-                        downclock_mode);
+       intel_panel_init(&intel_connector->panel, fixed_mode, downclock_mode);
        intel_panel_setup_backlight(connector, INVALID_PIPE);
 
        lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder);
index 41d00b1603e304ff5694cc2bd8ec8daee80bc80c..b443278e569cedb1f9d7fbe36188eb6a9f67fd70 100644 (file)
@@ -1928,13 +1928,11 @@ intel_panel_init_backlight_funcs(struct intel_panel *panel)
 
 int intel_panel_init(struct intel_panel *panel,
                     struct drm_display_mode *fixed_mode,
-                    struct drm_display_mode *alt_fixed_mode,
                     struct drm_display_mode *downclock_mode)
 {
        intel_panel_init_backlight_funcs(panel);
 
        panel->fixed_mode = fixed_mode;
-       panel->alt_fixed_mode = alt_fixed_mode;
        panel->downclock_mode = downclock_mode;
 
        return 0;
@@ -1948,10 +1946,6 @@ void intel_panel_fini(struct intel_panel *panel)
        if (panel->fixed_mode)
                drm_mode_destroy(intel_connector->base.dev, panel->fixed_mode);
 
-       if (panel->alt_fixed_mode)
-               drm_mode_destroy(intel_connector->base.dev,
-                               panel->alt_fixed_mode);
-
        if (panel->downclock_mode)
                drm_mode_destroy(intel_connector->base.dev,
                                panel->downclock_mode);
index b85229e153c421c49ede59f5efd53af8318ed0fe..53aaaa3e6886d9eb472a1eb5b4f61955e12edc4a 100644 (file)
@@ -5150,7 +5150,6 @@ skl_copy_ddb_for_pipe(struct skl_ddb_values *dst,
               sizeof(dst->ddb.uv_plane[pipe]));
        memcpy(dst->ddb.plane[pipe], src->ddb.plane[pipe],
               sizeof(dst->ddb.plane[pipe]));
-       dst->ddb.enabled_slices = src->ddb.enabled_slices;
 }
 
 static void