Lines Matching +full:disable +full:- +full:hibernation +full:- +full:mode

1 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
117 * need high-priority retirement, such as waiting for an explicit in i915_workqueues_init()
120 * It is also used for periodic low-priority events, such as in i915_workqueues_init()
121 * idle-timers and recording error state. in i915_workqueues_init()
127 dev_priv->wq = alloc_ordered_workqueue("i915", 0); in i915_workqueues_init()
128 if (dev_priv->wq == NULL) in i915_workqueues_init()
131 dev_priv->display.hotplug.dp_wq = alloc_ordered_workqueue("i915-dp", 0); in i915_workqueues_init()
132 if (dev_priv->display.hotplug.dp_wq == NULL) in i915_workqueues_init()
141 dev_priv->unordered_wq = alloc_workqueue("i915-unordered", 0, 0); in i915_workqueues_init()
142 if (dev_priv->unordered_wq == NULL) in i915_workqueues_init()
148 destroy_workqueue(dev_priv->display.hotplug.dp_wq); in i915_workqueues_init()
150 destroy_workqueue(dev_priv->wq); in i915_workqueues_init()
152 drm_err(&dev_priv->drm, "Failed to allocate workqueues.\n"); in i915_workqueues_init()
154 return -ENOMEM; in i915_workqueues_init()
159 destroy_workqueue(dev_priv->unordered_wq); in i915_workqueues_cleanup()
160 destroy_workqueue(dev_priv->display.hotplug.dp_wq); in i915_workqueues_cleanup()
161 destroy_workqueue(dev_priv->wq); in i915_workqueues_cleanup()
165 * We don't keep the workarounds for pre-production hardware, so we expect our
169 * Our policy for removing pre-production workarounds is to keep the
170 * current gen workarounds as a guide to the bring-up of the next gen
188 drm_err(&dev_priv->drm, "This is a pre-production stepping. " in intel_detect_preproduction_hw()
196 if (!INTEL_INFO(i915)->gpu_reset_clobbers_display) { in sanitize_gpu()
206 * i915_driver_early_probe - setup state not requiring device access
209 * Initialize everything that is a "SW-only" state, that is state not
220 return -ENODEV; in i915_driver_early_probe()
228 spin_lock_init(&dev_priv->irq_lock); in i915_driver_early_probe()
229 spin_lock_init(&dev_priv->gpu_error.lock); in i915_driver_early_probe()
230 mutex_init(&dev_priv->display.backlight.lock); in i915_driver_early_probe()
232 mutex_init(&dev_priv->sb_lock); in i915_driver_early_probe()
233 cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE); in i915_driver_early_probe()
235 mutex_init(&dev_priv->display.audio.mutex); in i915_driver_early_probe()
236 mutex_init(&dev_priv->display.wm.wm_mutex); in i915_driver_early_probe()
237 mutex_init(&dev_priv->display.pps.mutex); in i915_driver_early_probe()
238 mutex_init(&dev_priv->display.hdcp.hdcp_mutex); in i915_driver_early_probe()
241 intel_runtime_pm_init_early(&dev_priv->runtime_pm); in i915_driver_early_probe()
282 * i915_driver_late_release - cleanup the setup done in
296 cpu_latency_qos_remove_request(&dev_priv->sb_qos); in i915_driver_late_release()
297 mutex_destroy(&dev_priv->sb_lock); in i915_driver_late_release()
299 i915_params_free(&dev_priv->params); in i915_driver_late_release()
303 * i915_driver_mmio_probe - setup device MMIO
307 * initialization sequence. The setup here should avoid any other device-wide
317 return -ENODEV; in i915_driver_mmio_probe()
324 ret = intel_uncore_init_mmio(gt->uncore); in i915_driver_mmio_probe()
328 ret = drmm_add_action_or_reset(&dev_priv->drm, in i915_driver_mmio_probe()
330 gt->uncore); in i915_driver_mmio_probe()
357 * i915_driver_mmio_release - cleanup the setup done in i915_driver_mmio_probe()
366 * i915_set_dma_info - set all relevant PCI dma info as configured for the
378 unsigned int mask_size = INTEL_INFO(i915)->dma_mask_size; in i915_set_dma_info()
387 dma_set_max_seg_size(i915->drm.dev, UINT_MAX); in i915_set_dma_info()
389 ret = dma_set_mask(i915->drm.dev, DMA_BIT_MASK(mask_size)); in i915_set_dma_info()
409 ret = dma_set_coherent_mask(i915->drm.dev, DMA_BIT_MASK(mask_size)); in i915_set_dma_info()
416 drm_err(&i915->drm, "Can't set DMA mask/consistent mask (%d)\n", ret); in i915_set_dma_info()
426 ret = intel_pcode_init(gt->uncore); in i915_pcode_init()
428 drm_err(&gt->i915->drm, "gt%d: intel_pcode_init failed %d\n", id, ret); in i915_pcode_init()
437 * i915_driver_hw_probe - setup state requiring device access
445 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_driver_hw_probe()
449 return -ENODEV; in i915_driver_hw_probe()
456 return -ENXIO; in i915_driver_hw_probe()
470 return -ENXIO; in i915_driver_hw_probe()
489 ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, dev_priv->drm.driver); in i915_driver_hw_probe()
498 * Make sure we probe lmem before we probe stolen-lmem. The BAR size in i915_driver_hw_probe()
511 drm_err(&dev_priv->drm, "failed to enable GGTT\n"); in i915_driver_hw_probe()
527 * properly dead afterwards. So we'll just disable them for all in i915_driver_hw_probe()
528 * pre-gen5 chipsets. in i915_driver_hw_probe()
531 * interrupts even when in MSI mode. This results in spurious in i915_driver_hw_probe()
538 drm_dbg(&dev_priv->drm, "can't enable MSI"); in i915_driver_hw_probe()
564 if (pdev->msi_enabled) in i915_driver_hw_probe()
578 * i915_driver_hw_remove - cleanup the setup done in i915_driver_hw_probe()
583 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_driver_hw_remove()
589 if (pdev->msi_enabled) in i915_driver_hw_remove()
594 * i915_driver_register - register the driver with the rest of the system
611 if (drm_dev_register(&dev_priv->drm, 0)) { in i915_driver_register()
612 drm_err(&dev_priv->drm, in i915_driver_register()
626 intel_pxp_debugfs_register(dev_priv->pxp); in i915_driver_register()
633 intel_runtime_pm_enable(&dev_priv->runtime_pm); in i915_driver_register()
638 drm_err(&dev_priv->drm, "Failed to register vga switcheroo!\n"); in i915_driver_register()
642 * i915_driver_unregister - cleanup the registration done in i915_driver_regiser()
654 intel_runtime_pm_disable(&dev_priv->runtime_pm); in i915_driver_unregister()
670 drm_dev_unplug(&dev_priv->drm); in i915_driver_unregister()
692 intel_platform_name(INTEL_INFO(dev_priv)->platform), in i915_welcome_messages()
694 INTEL_INFO(dev_priv)->platform), in i915_welcome_messages()
703 intel_gt_info_print(&gt->info, &p); in i915_welcome_messages()
707 drm_info(&dev_priv->drm, "DRM_I915_DEBUG enabled\n"); in i915_welcome_messages()
709 drm_info(&dev_priv->drm, "DRM_I915_DEBUG_GEM enabled\n"); in i915_welcome_messages()
711 drm_info(&dev_priv->drm, in i915_welcome_messages()
719 (struct intel_device_info *)ent->driver_data; in i915_driver_create()
722 i915 = devm_drm_dev_alloc(&pdev->dev, &i915_drm_driver, in i915_driver_create()
730 i915_params_copy(&i915->params, &i915_modparams); in i915_driver_create()
733 intel_device_info_driver_create(i915, pdev->device, match_info); in i915_driver_create()
739 * i915_driver_probe - setup chip and create an initial config
744 * - drive output discovery via intel_display_driver_probe()
745 * - initialize the memory manager
746 * - allocate initial config memory
747 * - setup the DRM framebuffer with the allocated memory
770 disable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
810 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
814 i915->do_release = true; in i915_driver_probe()
841 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
853 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in i915_driver_remove()
877 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in i915_driver_remove()
883 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in i915_driver_release()
886 if (!dev_priv->do_release) in i915_driver_release()
920 * i915_driver_lastclose - clean up after all DRM clients have exited
924 * mode setting case, we want to restore the kernel's initial mode (just
927 * Additionally, in the non-mode setting case, we'll tear down the GTT
942 struct drm_i915_file_private *file_priv = file->driver_priv; in i915_driver_postclose()
945 i915_drm_client_put(file_priv->client); in i915_driver_postclose()
964 drm_modeset_lock_all(&dev_priv->drm); in intel_suspend_encoders()
965 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_suspend_encoders()
966 if (encoder->suspend) in intel_suspend_encoders()
967 encoder->suspend(encoder); in intel_suspend_encoders()
968 drm_modeset_unlock_all(&dev_priv->drm); in intel_suspend_encoders()
970 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_suspend_encoders()
971 if (encoder->suspend_complete) in intel_suspend_encoders()
972 encoder->suspend_complete(encoder); in intel_suspend_encoders()
986 drm_modeset_lock_all(&dev_priv->drm); in intel_shutdown_encoders()
987 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_shutdown_encoders()
988 if (encoder->shutdown) in intel_shutdown_encoders()
989 encoder->shutdown(encoder); in intel_shutdown_encoders()
990 drm_modeset_unlock_all(&dev_priv->drm); in intel_shutdown_encoders()
992 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_shutdown_encoders()
993 if (encoder->shutdown_complete) in intel_shutdown_encoders()
994 encoder->shutdown_complete(encoder); in intel_shutdown_encoders()
999 disable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_shutdown()
1000 intel_runtime_pm_disable(&i915->runtime_pm); in i915_driver_shutdown()
1004 drm_kms_helper_poll_disable(&i915->drm); in i915_driver_shutdown()
1006 drm_atomic_helper_shutdown(&i915->drm); in i915_driver_shutdown()
1027 * - unify the pci_driver::shutdown sequence here with the in i915_driver_shutdown()
1029 * - unify the driver remove and system/runtime suspend sequences with in i915_driver_shutdown()
1033 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_shutdown()
1035 intel_runtime_pm_driver_release(&i915->runtime_pm); in i915_driver_shutdown()
1051 intel_pxp_resume_complete(i915->pxp); in i915_drm_complete()
1058 intel_pxp_suspend_prepare(i915->pxp); in i915_drm_prepare()
1062 * ostensibly marked the GPU as ready-to-sleep here. We need to in i915_drm_prepare()
1072 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_suspend()
1075 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_suspend()
1096 i915_ggtt_suspend(to_gt(dev_priv)->ggtt); in i915_drm_suspend()
1105 dev_priv->suspend_count++; in i915_drm_suspend()
1109 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_suspend()
1116 static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation) in i915_drm_suspend_late() argument
1119 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_suspend_late()
1120 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in i915_drm_suspend_late()
1123 bool s2idle = !hibernation && suspend_to_idle(dev_priv); in i915_drm_suspend_late()
1127 intel_pxp_suspend(dev_priv->pxp); in i915_drm_suspend_late()
1132 intel_uncore_suspend(gt->uncore); in i915_drm_suspend_late()
1140 drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret); in i915_drm_suspend_late()
1148 * During hibernation on some platforms the BIOS may try to access in i915_drm_suspend_late()
1159 if (!(hibernation && GRAPHICS_VER(dev_priv) < 6)) in i915_drm_suspend_late()
1164 if (!dev_priv->uncore.user_forcewake_count) in i915_drm_suspend_late()
1175 if (drm_WARN_ON_ONCE(&i915->drm, state.event != PM_EVENT_SUSPEND && in i915_driver_suspend_switcheroo()
1177 return -EINVAL; in i915_driver_suspend_switcheroo()
1179 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_driver_suspend_switcheroo()
1182 error = i915_drm_suspend(&i915->drm); in i915_driver_suspend_switcheroo()
1186 return i915_drm_suspend_late(&i915->drm, false); in i915_driver_suspend_switcheroo()
1195 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume()
1205 drm_err(&dev_priv->drm, "failed to re-enable GGTT\n"); in i915_drm_resume()
1207 i915_ggtt_resume(to_gt(dev_priv)->ggtt); in i915_drm_resume()
1210 if (GRAPHICS_VER(gt->i915) >= 8) in i915_drm_resume()
1261 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume()
1269 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_resume_early()
1274 * We have a resume ordering issue with the snd-hda driver also in i915_drm_resume_early()
1295 drm_err(&dev_priv->drm, in i915_drm_resume_early()
1314 return -EIO; in i915_drm_resume_early()
1318 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume_early()
1322 drm_err(&dev_priv->drm, in i915_drm_resume_early()
1326 intel_uncore_resume_early(gt->uncore); in i915_drm_resume_early()
1334 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume_early()
1343 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_driver_resume_switcheroo()
1346 ret = i915_drm_resume_early(&i915->drm); in i915_driver_resume_switcheroo()
1350 return i915_drm_resume(&i915->drm); in i915_driver_resume_switcheroo()
1359 return -ENODEV; in i915_pm_prepare()
1362 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_prepare()
1365 return i915_drm_prepare(&i915->drm); in i915_pm_prepare()
1374 return -ENODEV; in i915_pm_suspend()
1377 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_suspend()
1380 return i915_drm_suspend(&i915->drm); in i915_pm_suspend()
1388 * We have a suspend ordering issue with the snd-hda driver also in i915_pm_suspend_late()
1396 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_suspend_late()
1399 return i915_drm_suspend_late(&i915->drm, false); in i915_pm_suspend_late()
1406 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_poweroff_late()
1409 return i915_drm_suspend_late(&i915->drm, true); in i915_pm_poweroff_late()
1416 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_resume_early()
1419 return i915_drm_resume_early(&i915->drm); in i915_pm_resume_early()
1426 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_resume()
1429 return i915_drm_resume(&i915->drm); in i915_pm_resume()
1436 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_complete()
1439 i915_drm_complete(&i915->drm); in i915_pm_complete()
1448 if (i915->drm.switch_power_state != DRM_SWITCH_POWER_OFF) { in i915_pm_freeze()
1449 ret = i915_drm_suspend(&i915->drm); in i915_pm_freeze()
1466 if (i915->drm.switch_power_state != DRM_SWITCH_POWER_OFF) { in i915_pm_freeze_late()
1467 ret = i915_drm_suspend_late(&i915->drm, true); in i915_pm_freeze_late()
1479 /* thaw: called after creating the hibernation image, but before turning off. */
1490 /* restore: called after loading the hibernation image. */
1504 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in intel_runtime_suspend()
1505 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in intel_runtime_suspend()
1510 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv))) in intel_runtime_suspend()
1511 return -ENODEV; in intel_runtime_suspend()
1513 drm_dbg(&dev_priv->drm, "Suspending device\n"); in intel_runtime_suspend()
1518 * We are safe here against re-faults, since the fault handler takes in intel_runtime_suspend()
1523 intel_pxp_runtime_suspend(dev_priv->pxp); in intel_runtime_suspend()
1531 intel_uncore_suspend(gt->uncore); in intel_runtime_suspend()
1537 drm_err(&dev_priv->drm, in intel_runtime_suspend()
1539 intel_uncore_runtime_resume(&dev_priv->uncore); in intel_runtime_suspend()
1554 if (intel_uncore_arm_unclaimed_mmio_detection(&dev_priv->uncore)) in intel_runtime_suspend()
1555 drm_err(&dev_priv->drm, in intel_runtime_suspend()
1567 rpm->suspended = true; in intel_runtime_suspend()
1592 assert_forcewakes_inactive(&dev_priv->uncore); in intel_runtime_suspend()
1597 drm_dbg(&dev_priv->drm, "Device suspended\n"); in intel_runtime_suspend()
1604 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in intel_runtime_resume()
1605 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in intel_runtime_resume()
1610 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv))) in intel_runtime_resume()
1611 return -ENODEV; in intel_runtime_resume()
1613 drm_dbg(&dev_priv->drm, "Resuming device\n"); in intel_runtime_resume()
1615 drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count)); in intel_runtime_resume()
1619 rpm->suspended = false; in intel_runtime_resume()
1625 if (intel_uncore_unclaimed_mmio(&dev_priv->uncore)) in intel_runtime_resume()
1626 drm_dbg(&dev_priv->drm, in intel_runtime_resume()
1634 intel_uncore_runtime_resume(gt->uncore); in intel_runtime_resume()
1640 * we can do is to hope that things will still work (and disable RPM). in intel_runtime_resume()
1645 intel_pxp_runtime_resume(dev_priv->pxp); in intel_runtime_resume()
1662 drm_err(&dev_priv->drm, in intel_runtime_resume()
1665 drm_dbg(&dev_priv->drm, "Device resumed\n"); in intel_runtime_resume()
1685 * hibernation image [PMSG_FREEZE] and
1688 * @thaw, @thaw_early : called (1) after creating the hibernation
1692 * @poweroff, @poweroff_late: called after writing the hibernation
1695 * hibernation image [PMSG_RESTORE]
1730 return -ENODEV; in i915_gem_reject_pin_ioctl()
1803 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
1804 * - Support vertical blank on secondary display pipe