Merge tag 'drm-intel-next-2015-02-14' of git://anongit.freedesktop.org/drm-intel...
[cascardo/linux.git] / drivers / gpu / drm / i915 / i915_drv.c
index 7643300..4badb23 100644 (file)
@@ -369,6 +369,19 @@ static const struct intel_device_info intel_skylake_info = {
        IVB_CURSOR_OFFSETS,
 };
 
+static const struct intel_device_info intel_skylake_gt3_info = {
+       .is_preliminary = 1,
+       .is_skylake = 1,
+       .gen = 9, .num_pipes = 3,
+       .need_gfx_hws = 1, .has_hotplug = 1,
+       .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
+       .has_llc = 1,
+       .has_ddi = 1,
+       .has_fbc = 1,
+       GEN_DEFAULT_PIPEOFFSETS,
+       IVB_CURSOR_OFFSETS,
+};
+
 /*
  * Make sure any device matches here are from most specific to most
  * general.  For example, since the Quanta match is based on the subsystem
@@ -406,7 +419,9 @@ static const struct intel_device_info intel_skylake_info = {
        INTEL_BDW_GT3M_IDS(&intel_broadwell_gt3m_info), \
        INTEL_BDW_GT3D_IDS(&intel_broadwell_gt3d_info), \
        INTEL_CHV_IDS(&intel_cherryview_info),  \
-       INTEL_SKL_IDS(&intel_skylake_info)
+       INTEL_SKL_GT1_IDS(&intel_skylake_info), \
+       INTEL_SKL_GT2_IDS(&intel_skylake_info), \
+       INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info)      \
 
 static const struct pci_device_id pciidlist[] = {              /* aka */
        INTEL_PCI_IDS,
@@ -835,6 +850,8 @@ int i915_reset(struct drm_device *dev)
                return ret;
        }
 
+       intel_overlay_reset(dev_priv);
+
        /* Ok, now get things going again... */
 
        /*
@@ -934,8 +951,7 @@ static int i915_pm_suspend(struct device *dev)
 
 static int i915_pm_suspend_late(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+       struct drm_device *drm_dev = dev_to_i915(dev)->dev;
 
        /*
         * We have a suspedn ordering issue with the snd-hda driver also
@@ -954,8 +970,7 @@ static int i915_pm_suspend_late(struct device *dev)
 
 static int i915_pm_resume_early(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+       struct drm_device *drm_dev = dev_to_i915(dev)->dev;
 
        if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
                return 0;
@@ -965,8 +980,7 @@ static int i915_pm_resume_early(struct device *dev)
 
 static int i915_pm_resume(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct drm_device *drm_dev = pci_get_drvdata(pdev);
+       struct drm_device *drm_dev = dev_to_i915(dev)->dev;
 
        if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF)
                return 0;
@@ -1293,7 +1307,9 @@ static int vlv_suspend_complete(struct drm_i915_private *dev_priv)
        err = vlv_allow_gt_wake(dev_priv, false);
        if (err)
                goto err2;
-       vlv_save_gunit_s0ix_state(dev_priv);
+
+       if (!IS_CHERRYVIEW(dev_priv->dev))
+               vlv_save_gunit_s0ix_state(dev_priv);
 
        err = vlv_force_gfx_clock(dev_priv, false);
        if (err)
@@ -1324,7 +1340,8 @@ static int vlv_resume_prepare(struct drm_i915_private *dev_priv,
         */
        ret = vlv_force_gfx_clock(dev_priv, true);
 
-       vlv_restore_gunit_s0ix_state(dev_priv);
+       if (!IS_CHERRYVIEW(dev_priv->dev))
+               vlv_restore_gunit_s0ix_state(dev_priv);
 
        err = vlv_allow_gt_wake(dev_priv, true);
        if (!ret)
@@ -1357,8 +1374,6 @@ static int intel_runtime_suspend(struct device *device)
        if (WARN_ON_ONCE(!HAS_RUNTIME_PM(dev)))
                return -ENODEV;
 
-       assert_force_wake_inactive(dev_priv);
-
        DRM_DEBUG_KMS("Suspending device\n");
 
        /*
@@ -1396,7 +1411,8 @@ static int intel_runtime_suspend(struct device *device)
                return ret;
        }
 
-       del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
+       cancel_delayed_work_sync(&dev_priv->gpu_error.hangcheck_work);
+       intel_uncore_forcewake_reset(dev, false);
        dev_priv->pm.suspended = true;
 
        /*
@@ -1424,6 +1440,8 @@ static int intel_runtime_suspend(struct device *device)
                intel_opregion_notify_adapter(dev, PCI_D3hot);
        }
 
+       assert_forcewakes_inactive(dev_priv);
+
        DRM_DEBUG_KMS("Device suspended\n");
        return 0;
 }
@@ -1627,22 +1645,26 @@ static int __init i915_init(void)
 
        if (!(driver.driver_features & DRIVER_MODESET)) {
                driver.get_vblank_timestamp = NULL;
-#ifndef CONFIG_DRM_I915_UMS
                /* Silently fail loading to not upset userspace. */
                DRM_DEBUG_DRIVER("KMS and UMS disabled.\n");
                return 0;
-#endif
        }
 
+       /*
+        * FIXME: Note that we're lying to the DRM core here so that we can get access
+        * to the atomic ioctl and the atomic properties.  Only plane operations on
+        * a single CRTC will actually work.
+        */
+       if (i915.nuclear_pageflip)
+               driver.driver_features |= DRIVER_ATOMIC;
+
        return drm_pci_init(&driver, &i915_pci_driver);
 }
 
 static void __exit i915_exit(void)
 {
-#ifndef CONFIG_DRM_I915_UMS
        if (!(driver.driver_features & DRIVER_MODESET))
                return; /* Never loaded a driver. */
-#endif
 
        drm_pci_exit(&driver, &i915_pci_driver);
 }