Lines Matching +full:pch +full:- +full:msi +full:- +full:1
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
191 drm_err(&dev_priv->drm, "This is a pre-production stepping. " in intel_detect_preproduction_hw()
199 if (!INTEL_INFO(i915)->gpu_reset_clobbers_display) { in sanitize_gpu()
209 * i915_driver_early_probe - setup state not requiring device access
212 * Initialize everything that is a "SW-only" state, that is state not
223 return -ENODEV; in i915_driver_early_probe()
231 spin_lock_init(&dev_priv->irq_lock); in i915_driver_early_probe()
232 spin_lock_init(&dev_priv->gpu_error.lock); in i915_driver_early_probe()
234 mutex_init(&dev_priv->sb_lock); in i915_driver_early_probe()
235 cpu_latency_qos_add_request(&dev_priv->sb_qos, PM_QOS_DEFAULT_VALUE); in i915_driver_early_probe()
238 intel_runtime_pm_init_early(&dev_priv->runtime_pm); in i915_driver_early_probe()
279 * i915_driver_late_release - cleanup the setup done in
293 cpu_latency_qos_remove_request(&dev_priv->sb_qos); in i915_driver_late_release()
294 mutex_destroy(&dev_priv->sb_lock); in i915_driver_late_release()
296 i915_params_free(&dev_priv->params); in i915_driver_late_release()
300 * i915_driver_mmio_probe - setup device MMIO
304 * initialization sequence. The setup here should avoid any other device-wide
314 return -ENODEV; in i915_driver_mmio_probe()
321 ret = intel_uncore_init_mmio(gt->uncore); in i915_driver_mmio_probe()
325 ret = drmm_add_action_or_reset(&dev_priv->drm, in i915_driver_mmio_probe()
327 gt->uncore); in i915_driver_mmio_probe()
355 * i915_driver_mmio_release - cleanup the setup done in i915_driver_mmio_probe()
364 * i915_set_dma_info - set all relevant PCI dma info as configured for the
376 unsigned int mask_size = INTEL_INFO(i915)->dma_mask_size; in i915_set_dma_info()
385 dma_set_max_seg_size(i915->drm.dev, UINT_MAX); in i915_set_dma_info()
387 ret = dma_set_mask(i915->drm.dev, DMA_BIT_MASK(mask_size)); in i915_set_dma_info()
391 /* overlay on gen2 is broken and can't address above 1G */ in i915_set_dma_info()
407 ret = dma_set_coherent_mask(i915->drm.dev, DMA_BIT_MASK(mask_size)); in i915_set_dma_info()
414 drm_err(&i915->drm, "Can't set DMA mask/consistent mask (%d)\n", ret); in i915_set_dma_info()
424 ret = intel_pcode_init(gt->uncore); in i915_pcode_init()
435 * i915_driver_hw_probe - setup state requiring device access
443 struct intel_display *display = &dev_priv->display; in i915_driver_hw_probe()
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()
453 drm_err(&dev_priv->drm, in i915_driver_hw_probe()
455 return -ENXIO; in i915_driver_hw_probe()
467 drm_err(&dev_priv->drm, 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()
516 /* On the 945G/GM, the chipset reports the MSI capability on the in i915_driver_hw_probe()
520 * This may be a side effect of MSI having been made available for PEG in i915_driver_hw_probe()
523 * According to chipset errata, on the 965GM, MSI interrupts may in i915_driver_hw_probe()
524 * be lost or delayed, and was defeatured. MSI interrupts seem to in i915_driver_hw_probe()
527 * pre-gen5 chipsets. in i915_driver_hw_probe()
530 * interrupts even when in MSI mode. This results in spurious 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 intel_display *display = &dev_priv->display; in i915_driver_hw_remove()
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()
685 struct drm_printer p = drm_dbg_printer(&dev_priv->drm, DRM_UT_DRIVER, in i915_welcome_messages()
693 intel_platform_name(INTEL_INFO(dev_priv)->platform), in i915_welcome_messages()
695 INTEL_INFO(dev_priv)->platform), in i915_welcome_messages()
702 intel_gt_info_print(>->info, &p); in i915_welcome_messages()
706 drm_info(&dev_priv->drm, "DRM_I915_DEBUG enabled\n"); in i915_welcome_messages()
708 drm_info(&dev_priv->drm, "DRM_I915_DEBUG_GEM enabled\n"); in i915_welcome_messages()
710 drm_info(&dev_priv->drm, in i915_welcome_messages()
718 (struct intel_device_info *)ent->driver_data; in i915_driver_create()
721 i915 = devm_drm_dev_alloc(&pdev->dev, &i915_drm_driver, in i915_driver_create()
726 pci_set_drvdata(pdev, &i915->drm); in i915_driver_create()
729 i915_params_copy(&i915->params, &i915_modparams); in i915_driver_create()
732 intel_device_info_driver_create(i915, pdev->device, match_info); in i915_driver_create()
740 * i915_driver_probe - setup chip and create an initial config
745 * - drive output discovery via intel_display_driver_probe()
746 * - initialize the memory manager
747 * - allocate initial config memory
748 * - setup the DRM framebuffer with the allocated memory
771 disable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
804 if (ret && ret != -ENODEV) in i915_driver_probe()
805 drm_dbg(&i915->drm, "pxp init failed with %d\n", ret); in i915_driver_probe()
813 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
817 i915->do_release = true; in i915_driver_probe()
844 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_probe()
856 wakeref = intel_runtime_pm_get(&i915->runtime_pm); in i915_driver_remove()
880 intel_runtime_pm_put(&i915->runtime_pm, wakeref); in i915_driver_remove()
886 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in i915_driver_release()
889 if (!dev_priv->do_release) in i915_driver_release()
926 struct drm_i915_file_private *file_priv = file->driver_priv; in i915_driver_postclose()
929 i915_drm_client_put(file_priv->client); in i915_driver_postclose()
939 disable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_shutdown()
940 intel_runtime_pm_disable(&i915->runtime_pm); in i915_driver_shutdown()
943 intel_fbdev_set_suspend(&i915->drm, FBINFO_STATE_SUSPENDED, true); in i915_driver_shutdown()
945 drm_kms_helper_poll_disable(&i915->drm); in i915_driver_shutdown()
948 drm_atomic_helper_shutdown(&i915->drm); in i915_driver_shutdown()
959 intel_encoder_suspend_all(&i915->display); in i915_driver_shutdown()
960 intel_encoder_shutdown_all(&i915->display); in i915_driver_shutdown()
972 * - unify the pci_driver::shutdown sequence here with the in i915_driver_shutdown()
974 * - unify the driver remove and system/runtime suspend sequences with in i915_driver_shutdown()
978 enable_rpm_wakeref_asserts(&i915->runtime_pm); in i915_driver_shutdown()
980 intel_runtime_pm_driver_last_release(&i915->runtime_pm); in i915_driver_shutdown()
996 intel_pxp_resume_complete(i915->pxp); in i915_drm_complete()
1003 intel_pxp_suspend_prepare(i915->pxp); in i915_drm_prepare()
1007 * ostensibly marked the GPU as ready-to-sleep here. We need to in i915_drm_prepare()
1017 struct intel_display *display = &dev_priv->display; in i915_drm_suspend()
1018 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_suspend()
1021 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_suspend()
1044 intel_encoder_suspend_all(&dev_priv->display); in i915_drm_suspend()
1048 i915_ggtt_suspend(to_gt(dev_priv)->ggtt); in i915_drm_suspend()
1055 dev_priv->suspend_count++; in i915_drm_suspend()
1059 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_suspend()
1069 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_suspend_late()
1070 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in i915_drm_suspend_late()
1077 intel_pxp_suspend(dev_priv->pxp); in i915_drm_suspend_late()
1082 intel_uncore_suspend(gt->uncore); in i915_drm_suspend_late()
1090 drm_err(&dev_priv->drm, "Suspend complete failed: %d\n", ret); in i915_drm_suspend_late()
1114 if (!dev_priv->uncore.user_forcewake_count) in i915_drm_suspend_late()
1125 if (drm_WARN_ON_ONCE(&i915->drm, state.event != PM_EVENT_SUSPEND && in i915_driver_suspend_switcheroo()
1127 return -EINVAL; in i915_driver_suspend_switcheroo()
1129 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_driver_suspend_switcheroo()
1132 error = i915_drm_suspend(&i915->drm); in i915_driver_suspend_switcheroo()
1136 return i915_drm_suspend_late(&i915->drm, false); in i915_driver_suspend_switcheroo()
1142 struct intel_display *display = &dev_priv->display; in i915_drm_resume()
1146 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume()
1156 drm_err(&dev_priv->drm, "failed to re-enable GGTT\n"); in i915_drm_resume()
1158 i915_ggtt_resume(to_gt(dev_priv)->ggtt); in i915_drm_resume()
1161 if (GRAPHICS_VER(gt->i915) >= 8) in i915_drm_resume()
1218 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume()
1226 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in i915_drm_resume_early()
1231 * We have a resume ordering issue with the snd-hda driver also in i915_drm_resume_early()
1252 drm_err(&dev_priv->drm, in i915_drm_resume_early()
1271 return -EIO; in i915_drm_resume_early()
1275 disable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume_early()
1279 drm_err(&dev_priv->drm, in i915_drm_resume_early()
1289 enable_rpm_wakeref_asserts(&dev_priv->runtime_pm); in i915_drm_resume_early()
1298 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_driver_resume_switcheroo()
1301 ret = i915_drm_resume_early(&i915->drm); in i915_driver_resume_switcheroo()
1305 return i915_drm_resume(&i915->drm); in i915_driver_resume_switcheroo()
1314 return -ENODEV; in i915_pm_prepare()
1317 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_prepare()
1320 return i915_drm_prepare(&i915->drm); in i915_pm_prepare()
1329 return -ENODEV; in i915_pm_suspend()
1332 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_suspend()
1335 return i915_drm_suspend(&i915->drm); in i915_pm_suspend()
1343 * We have a suspend ordering issue with the snd-hda driver also in i915_pm_suspend_late()
1351 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_suspend_late()
1354 return i915_drm_suspend_late(&i915->drm, false); in i915_pm_suspend_late()
1361 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_poweroff_late()
1364 return i915_drm_suspend_late(&i915->drm, true); in i915_pm_poweroff_late()
1371 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_resume_early()
1374 return i915_drm_resume_early(&i915->drm); in i915_pm_resume_early()
1381 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_resume()
1384 return i915_drm_resume(&i915->drm); in i915_pm_resume()
1391 if (i915->drm.switch_power_state == DRM_SWITCH_POWER_OFF) in i915_pm_complete()
1394 i915_drm_complete(&i915->drm); in i915_pm_complete()
1403 if (i915->drm.switch_power_state != DRM_SWITCH_POWER_OFF) { in i915_pm_freeze()
1404 ret = i915_drm_suspend(&i915->drm); in i915_pm_freeze()
1421 if (i915->drm.switch_power_state != DRM_SWITCH_POWER_OFF) { in i915_pm_freeze_late()
1422 ret = i915_drm_suspend_late(&i915->drm, true); in i915_pm_freeze_late()
1459 struct intel_display *display = &dev_priv->display; in intel_runtime_suspend()
1460 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in intel_runtime_suspend()
1461 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in intel_runtime_suspend()
1466 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv))) in intel_runtime_suspend()
1467 return -ENODEV; in intel_runtime_suspend()
1469 drm_dbg(&dev_priv->drm, "Suspending device\n"); in intel_runtime_suspend()
1474 * We are safe here against re-faults, since the fault handler takes in intel_runtime_suspend()
1479 intel_pxp_runtime_suspend(dev_priv->pxp); in intel_runtime_suspend()
1487 intel_uncore_suspend(gt->uncore); in intel_runtime_suspend()
1493 drm_err(&dev_priv->drm, in intel_runtime_suspend()
1495 intel_uncore_runtime_resume(&dev_priv->uncore); in intel_runtime_suspend()
1510 if (intel_uncore_arm_unclaimed_mmio_detection(&dev_priv->uncore)) in intel_runtime_suspend()
1511 drm_err(&dev_priv->drm, in intel_runtime_suspend()
1529 * On Broadwell, if we use PCI_D1 the PCH DDI ports will stop in intel_runtime_suspend()
1546 assert_forcewakes_inactive(&dev_priv->uncore); in intel_runtime_suspend()
1551 drm_dbg(&dev_priv->drm, "Device suspended\n"); in intel_runtime_suspend()
1558 struct intel_display *display = &dev_priv->display; in intel_runtime_resume()
1559 struct intel_runtime_pm *rpm = &dev_priv->runtime_pm; in intel_runtime_resume()
1560 struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); in intel_runtime_resume()
1565 if (drm_WARN_ON_ONCE(&dev_priv->drm, !HAS_RUNTIME_PM(dev_priv))) in intel_runtime_resume()
1566 return -ENODEV; in intel_runtime_resume()
1568 drm_dbg(&dev_priv->drm, "Resuming device\n"); in intel_runtime_resume()
1570 drm_WARN_ON_ONCE(&dev_priv->drm, atomic_read(&rpm->wakeref_count)); in intel_runtime_resume()
1579 if (intel_uncore_unclaimed_mmio(&dev_priv->uncore)) in intel_runtime_resume()
1580 drm_dbg(&dev_priv->drm, in intel_runtime_resume()
1588 intel_uncore_runtime_resume(gt->uncore); in intel_runtime_resume()
1599 intel_pxp_runtime_resume(dev_priv->pxp); in intel_runtime_resume()
1616 drm_err(&dev_priv->drm, in intel_runtime_resume()
1619 drm_dbg(&dev_priv->drm, "Device resumed\n"); in intel_runtime_resume()
1638 * @freeze, @freeze_late : called (1) before creating the
1642 * @thaw, @thaw_early : called (1) after creating the hibernation
1685 return -ENODEV; in i915_gem_reject_pin_ioctl()
1758 * 1.6: - New ioctl for scheduling buffer swaps on vertical blank
1759 * - Support vertical blank on secondary display pipe
1761 #define DRIVER_MAJOR 1