Lines Matching +full:rpm +full:- +full:requests
1 /* i915_drv.c -- i830,i845,i855,i865,i915 driver -*- linux-c -*-
22 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
116 * requests (and thus managing bo) once the task has been completed in i915_workqueues_init()
118 * need high-priority retirement, such as waiting for an explicit in i915_workqueues_init()
121 * It is also used for periodic low-priority events, such as in i915_workqueues_init()
122 * idle-timers and recording error state. in i915_workqueues_init()
128 dev_priv->wq = alloc_ordered_workqueue("i915", 0); in i915_workqueues_init()
129 if (dev_priv->wq == NULL) in i915_workqueues_init()
132 dev_priv->display.hotplug.dp_wq = alloc_ordered_workqueue("i915-dp", 0); in i915_workqueues_init()
133 if (dev_priv->display.hotplug.dp_wq == NULL) in i915_workqueues_init()
142 dev_priv->unordered_wq = alloc_workqueue("i915-unordered", 0, 0); in i915_workqueues_init()
143 if (dev_priv->unordered_wq == NULL) in i915_workqueues_init()
149 destroy_workqueue(dev_priv->display.hotplug.dp_wq); in i915_workqueues_init()
151 destroy_workqueue(dev_priv->wq); in i915_workqueues_init()
153 drm_err(&dev_priv->drm, "Failed to allocate workqueues.\n"); in i915_workqueues_init()
155 return -ENOMEM; in i915_workqueues_init()
160 destroy_workqueue(dev_priv->unordered_wq); in i915_workqueues_cleanup()
161 destroy_workqueue(dev_priv->display.hotplug.dp_wq); in i915_workqueues_cleanup()
162 destroy_workqueue(dev_priv->wq); in i915_workqueues_cleanup()
166 * We don't keep the workarounds for pre-production hardware, so we expect our
170 * Our policy for removing pre-production workarounds is to keep the
171 * current gen workarounds as a guide to the bring-up of the next gen
192 drm_err(&dev_priv->drm, "This is a pre-production stepping. " in intel_detect_preproduction_hw()
200 if (!INTEL_INFO(i915)->gpu_reset_clobbers_display) { in sanitize_gpu()
210 * i915_driver_early_probe - setup state not requiring device access
213 * Initialize everything that is a "SW-only" state, that is state not
224 return -ENODEV; in i915_driver_early_probe()
232 spin_lock_init(&dev_priv->irq_lock); in i915_driver_early_probe()
233 spin_lock_init(&dev_priv->gpu_error.lock); in i915_driver_early_probe()
235 mutex_init(&dev_priv->sb_lock); in i915_driver_early_probe()
236 cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE); in i915_driver_early_probe()
239 intel_runtime_pm_init_early(&dev_priv->runtime_pm); in i915_driver_early_probe()
280 * i915_driver_late_release - cleanup the setup done in
294 cpu_latency_qos_remove_request(&dev_priv->sb_qos); in i915_driver_late_release()
295 mutex_destroy(&dev_priv->sb_lock); in i915_driver_late_release()
297 i915_params_free(&dev_priv->params); in i915_driver_late_release()
301 * i915_driver_mmio_probe - setup device MMIO
305 * initialization sequence. The setup here should avoid any other device-wide
315 return -ENODEV; in i915_driver_mmio_probe()
322 ret = intel_uncore_init_mmio(gt->uncore); in i915_driver_mmio_probe()
326 ret = drmm_add_action_or_reset(&dev_priv->drm, in i915_driver_mmio_probe()
328 gt->uncore); in i915_driver_mmio_probe()
356 * i915_driver_mmio_release - cleanup the setup done in i915_driver_mmio_probe()
365 * i915_set_dma_info - set all relevant PCI dma info as configured for the
377 unsigned int mask_size = INTEL_INFO(i915)->dma_mask_size; in i915_set_dma_info()
386 dma_set_max_seg_size(i915->drm.dev, UINT_MAX); in i915_set_dma_info()
388 ret = dma_set_mask(i915->drm.dev, DMA_BIT_MASK(mask_size)); in i915_set_dma_info()
408 ret = dma_set_coherent_mask(i915->drm.dev, DMA_BIT_MASK(mask_size)); in i915_set_dma_info()
415 drm_err(&i915->drm, "Can't set DMA mask/consistent mask (%d)\n", ret); in i915_set_dma_info()
425 ret = intel_pcode_init(gt->uncore); in i915_pcode_init()
436 * i915_driver_hw_probe - setup state requiring device access
444 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_driver_hw_probe()
448 return -ENODEV; in i915_driver_hw_probe()
455 return -ENXIO; in i915_driver_hw_probe()
469 return -ENXIO; in i915_driver_hw_probe()
488 ret = drm_aperture_remove_conflicting_pci_framebuffers(pdev, dev_priv->drm.driver); in i915_driver_hw_probe()
497 * Make sure we probe lmem before we probe stolen-lmem. The BAR size in i915_driver_hw_probe()
510 drm_err(&dev_priv->drm, "failed to enable GGTT\n"); in i915_driver_hw_probe()
527 * pre-gen5 chipsets. in i915_driver_hw_probe()
537 drm_dbg(&dev_priv->drm, "can't enable MSI"); in i915_driver_hw_probe()
563 if (pdev->msi_enabled) in i915_driver_hw_probe()
577 * i915_driver_hw_remove - cleanup the setup done in i915_driver_hw_probe()
582 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_driver_hw_remove()
588 if (pdev->msi_enabled) in i915_driver_hw_remove()
593 * i915_driver_register - register the driver with the rest of the system
610 if (drm_dev_register(&dev_priv->drm, 0)) { in i915_driver_register()
611 drm_err(&dev_priv->drm, in i915_driver_register()
625 intel_pxp_debugfs_register(dev_priv->pxp); in i915_driver_register()
632 intel_runtime_pm_enable(&dev_priv->runtime_pm); in i915_driver_register()
637 drm_err(&dev_priv->drm, "Failed to register vga switcheroo!\n"); in i915_driver_register()
641 * i915_driver_unregister - cleanup the registration done in i915_driver_regiser()
653 intel_runtime_pm_disable(&dev_priv->runtime_pm); in i915_driver_unregister()
669 drm_dev_unplug(&dev_priv->drm); in i915_driver_unregister()
691 intel_platform_name(INTEL_INFO(dev_priv)->platform), in i915_welcome_messages()
693 INTEL_INFO(dev_priv)->platform), in i915_welcome_messages()
700 intel_gt_info_print(>->info, &p); in i915_welcome_messages()
704 drm_info(&dev_priv->drm, "DRM_I915_DEBUG enabled\n"); in i915_welcome_messages()
706 drm_info(&dev_priv->drm, "DRM_I915_DEBUG_GEM enabled\n"); in i915_welcome_messages()
708 drm_info(&dev_priv->drm, in i915_welcome_messages()
716 (struct intel_device_info *)ent->driver_data; in i915_driver_create()
719 i915 = devm_drm_dev_alloc(&pdev->dev, &i915_drm_driver, in i915_driver_create()
727 i915_params_copy(&i915->params, &i915_modparams); in i915_driver_create()
730 intel_device_info_driver_create(i915, pdev->device, match_info); in i915_driver_create()
738 * i915_driver_probe - setup chip and create an initial config
743 * - drive output discovery via intel_display_driver_probe()
744 * - initialize the memory manager
745 * - allocate initial config memory
746 * - setup the DRM framebuffer with the allocated memory
769 disable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
802 if (ret != -ENODEV) in i915_driver_probe()
803 drm_dbg(&i915->drm, "pxp init failed with %d\n", ret); in i915_driver_probe()
811 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
815 i915->do_release = true; in i915_driver_probe()
842 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
854 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in i915_driver_remove()
878 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in i915_driver_remove()
884 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in i915_driver_release() local
887 if (!dev_priv->do_release) in i915_driver_release()
890 wakeref = intel_runtime_pm_get(rpm); in i915_driver_release()
901 intel_runtime_pm_put(rpm, wakeref); in i915_driver_release()
903 intel_runtime_pm_driver_release(rpm); in i915_driver_release()
923 * i915_driver_lastclose - clean up after all DRM clients have exited
930 * Additionally, in the non-mode setting case, we'll tear down the GTT
945 struct drm_i915_file_private *file_priv = file->driver_priv; in i915_driver_postclose()
948 i915_drm_client_put(file_priv->client); in i915_driver_postclose()
967 drm_modeset_lock_all(&dev_priv->drm); in intel_suspend_encoders()
968 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_suspend_encoders()
969 if (encoder->suspend) in intel_suspend_encoders()
970 encoder->suspend(encoder); in intel_suspend_encoders()
971 drm_modeset_unlock_all(&dev_priv->drm); in intel_suspend_encoders()
973 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_suspend_encoders()
974 if (encoder->suspend_complete) in intel_suspend_encoders()
975 encoder->suspend_complete(encoder); in intel_suspend_encoders()
989 drm_modeset_lock_all(&dev_priv->drm); in intel_shutdown_encoders()
990 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_shutdown_encoders()
991 if (encoder->shutdown) in intel_shutdown_encoders()
992 encoder->shutdown(encoder); in intel_shutdown_encoders()
993 drm_modeset_unlock_all(&dev_priv->drm); in intel_shutdown_encoders()
995 for_each_intel_encoder(&dev_priv->drm, encoder) in intel_shutdown_encoders()
996 if (encoder->shutdown_complete) in intel_shutdown_encoders()
997 encoder->shutdown_complete(encoder); in intel_shutdown_encoders()
1002 disable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_shutdown()
1003 intel_runtime_pm_disable(&i915->runtime_pm); in i915_driver_shutdown()
1007 drm_kms_helper_poll_disable(&i915->drm); in i915_driver_shutdown()
1009 drm_atomic_helper_shutdown(&i915->drm); in i915_driver_shutdown()
1030 * - unify the pci_driver::shutdown sequence here with the in i915_driver_shutdown()
1032 * - unify the driver remove and system/runtime suspend sequences with in i915_driver_shutdown()
1036 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_shutdown()
1038 intel_runtime_pm_driver_last_release(&i915->runtime_pm); in i915_driver_shutdown()
1054 intel_pxp_resume_complete(i915->pxp); in i915_drm_complete()
1061 intel_pxp_suspend_prepare(i915->pxp); in i915_drm_prepare()
1064 * NB intel_display_driver_suspend() may issue new requests after we've in i915_drm_prepare()
1065 * ostensibly marked the GPU as ready-to-sleep here. We need to in i915_drm_prepare()
1075 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_suspend()
1078 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_suspend()
1099 i915_ggtt_suspend(to_gt(dev_priv)->ggtt); in i915_drm_suspend()
1108 dev_priv->suspend_count++; in i915_drm_suspend()
1112 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_suspend()
1122 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_suspend_late()
1123 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in i915_drm_suspend_late() local
1128 disable_rpm_wakeref_asserts(rpm); in i915_drm_suspend_late()
1130 intel_pxp_suspend(dev_priv->pxp); in i915_drm_suspend_late()
1135 intel_uncore_suspend(gt->uncore); in i915_drm_suspend_late()
1143 drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret); in i915_drm_suspend_late()
1166 enable_rpm_wakeref_asserts(rpm); in i915_drm_suspend_late()
1167 if (!dev_priv->uncore.user_forcewake_count) in i915_drm_suspend_late()
1168 intel_runtime_pm_driver_release(rpm); in i915_drm_suspend_late()
1178 if (drm_WARN_ON_ONCE(&i915->drm, state.event != PM_EVENT_SUSPEND && in i915_driver_suspend_switcheroo()
1180 return -EINVAL; in i915_driver_suspend_switcheroo()
1182 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_driver_suspend_switcheroo()
1185 error = i915_drm_suspend(&i915->drm); in i915_driver_suspend_switcheroo()
1189 return i915_drm_suspend_late(&i915->drm, false); in i915_driver_suspend_switcheroo()
1198 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume()
1208 drm_err(&dev_priv->drm, "failed to re-enable GGTT\n"); in i915_drm_resume()
1210 i915_ggtt_resume(to_gt(dev_priv)->ggtt); in i915_drm_resume()
1213 if (GRAPHICS_VER(gt->i915) >= 8) in i915_drm_resume()
1264 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume()
1272 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_resume_early()
1277 * We have a resume ordering issue with the snd-hda driver also in i915_drm_resume_early()
1298 drm_err(&dev_priv->drm, in i915_drm_resume_early()
1317 return -EIO; in i915_drm_resume_early()
1321 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume_early()
1325 drm_err(&dev_priv->drm, in i915_drm_resume_early()
1335 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume_early()
1344 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_driver_resume_switcheroo()
1347 ret = i915_drm_resume_early(&i915->drm); in i915_driver_resume_switcheroo()
1351 return i915_drm_resume(&i915->drm); in i915_driver_resume_switcheroo()
1360 return -ENODEV; in i915_pm_prepare()
1363 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_prepare()
1366 return i915_drm_prepare(&i915->drm); in i915_pm_prepare()
1375 return -ENODEV; in i915_pm_suspend()
1378 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_suspend()
1381 return i915_drm_suspend(&i915->drm); in i915_pm_suspend()
1389 * We have a suspend ordering issue with the snd-hda driver also in i915_pm_suspend_late()
1397 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_suspend_late()
1400 return i915_drm_suspend_late(&i915->drm, false); in i915_pm_suspend_late()
1407 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_poweroff_late()
1410 return i915_drm_suspend_late(&i915->drm, true); in i915_pm_poweroff_late()
1417 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_resume_early()
1420 return i915_drm_resume_early(&i915->drm); in i915_pm_resume_early()
1427 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_resume()
1430 return i915_drm_resume(&i915->drm); in i915_pm_resume()
1437 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_complete()
1440 i915_drm_complete(&i915->drm); in i915_pm_complete()
1449 if (i915->drm.switch_power_state != DRM_SWITCH_POWER_OFF) { in i915_pm_freeze()
1450 ret = i915_drm_suspend(&i915->drm); in i915_pm_freeze()
1467 if (i915->drm.switch_power_state != DRM_SWITCH_POWER_OFF) { in i915_pm_freeze_late()
1468 ret = i915_drm_suspend_late(&i915->drm, true); in i915_pm_freeze_late()
1505 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in intel_runtime_suspend() local
1506 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in intel_runtime_suspend()
1511 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv))) in intel_runtime_suspend()
1512 return -ENODEV; in intel_runtime_suspend()
1514 drm_dbg(&dev_priv->drm, "Suspending device\n"); in intel_runtime_suspend()
1516 disable_rpm_wakeref_asserts(rpm); in intel_runtime_suspend()
1519 * We are safe here against re-faults, since the fault handler takes in intel_runtime_suspend()
1520 * an RPM reference. in intel_runtime_suspend()
1524 intel_pxp_runtime_suspend(dev_priv->pxp); in intel_runtime_suspend()
1532 intel_uncore_suspend(gt->uncore); in intel_runtime_suspend()
1538 drm_err(&dev_priv->drm, in intel_runtime_suspend()
1540 intel_uncore_runtime_resume(&dev_priv->uncore); in intel_runtime_suspend()
1547 enable_rpm_wakeref_asserts(rpm); in intel_runtime_suspend()
1552 enable_rpm_wakeref_asserts(rpm); in intel_runtime_suspend()
1553 intel_runtime_pm_driver_release(rpm); in intel_runtime_suspend()
1555 if (intel_uncore_arm_unclaimed_mmio_detection(&dev_priv->uncore)) in intel_runtime_suspend()
1556 drm_err(&dev_priv->drm, in intel_runtime_suspend()
1591 assert_forcewakes_inactive(&dev_priv->uncore); in intel_runtime_suspend()
1596 drm_dbg(&dev_priv->drm, "Device suspended\n"); in intel_runtime_suspend()
1603 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in intel_runtime_resume() local
1604 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in intel_runtime_resume()
1609 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv))) in intel_runtime_resume()
1610 return -ENODEV; in intel_runtime_resume()
1612 drm_dbg(&dev_priv->drm, "Resuming device\n"); in intel_runtime_resume()
1614 drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count)); in intel_runtime_resume()
1615 disable_rpm_wakeref_asserts(rpm); in intel_runtime_resume()
1623 if (intel_uncore_unclaimed_mmio(&dev_priv->uncore)) in intel_runtime_resume()
1624 drm_dbg(&dev_priv->drm, in intel_runtime_resume()
1632 intel_uncore_runtime_resume(gt->uncore); in intel_runtime_resume()
1638 * we can do is to hope that things will still work (and disable RPM). in intel_runtime_resume()
1643 intel_pxp_runtime_resume(dev_priv->pxp); in intel_runtime_resume()
1657 enable_rpm_wakeref_asserts(rpm); in intel_runtime_resume()
1660 drm_err(&dev_priv->drm, in intel_runtime_resume()
1663 drm_dbg(&dev_priv->drm, "Device resumed\n"); in intel_runtime_resume()
1728 return -ENODEV; in i915_gem_reject_pin_ioctl()
1801 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
1802 * - Support vertical blank on secondary display pipe