2 * Copyright © 2016 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
25 #include <drm/drm_color_mgmt.h>
26 #include <drm/drm_drv.h>
27 #include <drm/i915_pciids.h>
29 #include "display/intel_display.h"
30 #include "display/intel_display_driver.h"
31 #include "gt/intel_gt_regs.h"
32 #include "gt/intel_sa_media.h"
33 #include "gem/i915_gem_object_types.h"
35 #include "i915_driver.h"
39 #include "intel_pci_config.h"
42 __diag_ignore_all("-Woverride-init", "Allow overriding inherited members");
44 #define PLATFORM(x) .platform = (x)
46 .__runtime.graphics.ip.ver = (x), \
47 .__runtime.media.ip.ver = (x)
49 #define LEGACY_CACHELEVEL \
50 .cachelevel_to_pat = { \
51 [I915_CACHE_NONE] = 0, \
52 [I915_CACHE_LLC] = 1, \
53 [I915_CACHE_L3_LLC] = 2, \
54 [I915_CACHE_WT] = 3, \
57 #define TGL_CACHELEVEL \
58 .cachelevel_to_pat = { \
59 [I915_CACHE_NONE] = 3, \
60 [I915_CACHE_LLC] = 0, \
61 [I915_CACHE_L3_LLC] = 0, \
62 [I915_CACHE_WT] = 2, \
65 #define PVC_CACHELEVEL \
66 .cachelevel_to_pat = { \
67 [I915_CACHE_NONE] = 0, \
68 [I915_CACHE_LLC] = 3, \
69 [I915_CACHE_L3_LLC] = 3, \
70 [I915_CACHE_WT] = 2, \
73 #define MTL_CACHELEVEL \
74 .cachelevel_to_pat = { \
75 [I915_CACHE_NONE] = 2, \
76 [I915_CACHE_LLC] = 3, \
77 [I915_CACHE_L3_LLC] = 3, \
78 [I915_CACHE_WT] = 1, \
81 /* Keep in gen based order, and chronological order within a gen */
83 #define GEN_DEFAULT_PAGE_SIZES \
84 .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K
86 #define GEN_DEFAULT_REGIONS \
87 .__runtime.memory_regions = REGION_SMEM | REGION_STOLEN_SMEM
89 #define I830_FEATURES \
92 .gpu_reset_clobbers_display = true, \
93 .has_3d_pipeline = 1, \
94 .hws_needs_physical = 1, \
95 .unfenced_needs_alignment = 1, \
96 .__runtime.platform_engine_mask = BIT(RCS0), \
98 .has_coherent_ggtt = false, \
99 .dma_mask_size = 32, \
100 .max_pat_index = 3, \
101 GEN_DEFAULT_PAGE_SIZES, \
102 GEN_DEFAULT_REGIONS, \
105 #define I845_FEATURES \
107 .has_3d_pipeline = 1, \
108 .gpu_reset_clobbers_display = true, \
109 .hws_needs_physical = 1, \
110 .unfenced_needs_alignment = 1, \
111 .__runtime.platform_engine_mask = BIT(RCS0), \
113 .has_coherent_ggtt = false, \
114 .dma_mask_size = 32, \
115 .max_pat_index = 3, \
116 GEN_DEFAULT_PAGE_SIZES, \
117 GEN_DEFAULT_REGIONS, \
120 static const struct intel_device_info i830_info = {
122 PLATFORM(INTEL_I830),
125 static const struct intel_device_info i845g_info = {
127 PLATFORM(INTEL_I845G),
130 static const struct intel_device_info i85x_info = {
132 PLATFORM(INTEL_I85X),
135 static const struct intel_device_info i865g_info = {
137 PLATFORM(INTEL_I865G),
140 #define GEN3_FEATURES \
142 .gpu_reset_clobbers_display = true, \
143 .__runtime.platform_engine_mask = BIT(RCS0), \
144 .has_3d_pipeline = 1, \
146 .has_coherent_ggtt = true, \
147 .dma_mask_size = 32, \
148 .max_pat_index = 3, \
149 GEN_DEFAULT_PAGE_SIZES, \
150 GEN_DEFAULT_REGIONS, \
153 static const struct intel_device_info i915g_info = {
155 PLATFORM(INTEL_I915G),
156 .has_coherent_ggtt = false,
157 .hws_needs_physical = 1,
158 .unfenced_needs_alignment = 1,
161 static const struct intel_device_info i915gm_info = {
163 PLATFORM(INTEL_I915GM),
165 .hws_needs_physical = 1,
166 .unfenced_needs_alignment = 1,
169 static const struct intel_device_info i945g_info = {
171 PLATFORM(INTEL_I945G),
172 .hws_needs_physical = 1,
173 .unfenced_needs_alignment = 1,
176 static const struct intel_device_info i945gm_info = {
178 PLATFORM(INTEL_I945GM),
180 .hws_needs_physical = 1,
181 .unfenced_needs_alignment = 1,
184 static const struct intel_device_info g33_info = {
190 static const struct intel_device_info pnv_g_info = {
192 PLATFORM(INTEL_PINEVIEW),
196 static const struct intel_device_info pnv_m_info = {
198 PLATFORM(INTEL_PINEVIEW),
203 #define GEN4_FEATURES \
205 .gpu_reset_clobbers_display = true, \
206 .__runtime.platform_engine_mask = BIT(RCS0), \
207 .has_3d_pipeline = 1, \
209 .has_coherent_ggtt = true, \
210 .dma_mask_size = 36, \
211 .max_pat_index = 3, \
212 GEN_DEFAULT_PAGE_SIZES, \
213 GEN_DEFAULT_REGIONS, \
216 static const struct intel_device_info i965g_info = {
218 PLATFORM(INTEL_I965G),
219 .hws_needs_physical = 1,
223 static const struct intel_device_info i965gm_info = {
225 PLATFORM(INTEL_I965GM),
227 .hws_needs_physical = 1,
231 static const struct intel_device_info g45_info = {
234 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0),
235 .gpu_reset_clobbers_display = false,
238 static const struct intel_device_info gm45_info = {
240 PLATFORM(INTEL_GM45),
242 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0),
243 .gpu_reset_clobbers_display = false,
246 #define GEN5_FEATURES \
248 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0), \
249 .has_3d_pipeline = 1, \
251 .has_coherent_ggtt = true, \
252 /* ilk does support rc6, but we do not implement [power] contexts */ \
254 .dma_mask_size = 36, \
255 .max_pat_index = 3, \
256 GEN_DEFAULT_PAGE_SIZES, \
257 GEN_DEFAULT_REGIONS, \
260 static const struct intel_device_info ilk_d_info = {
262 PLATFORM(INTEL_IRONLAKE),
265 static const struct intel_device_info ilk_m_info = {
267 PLATFORM(INTEL_IRONLAKE),
272 #define GEN6_FEATURES \
274 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0), \
275 .has_3d_pipeline = 1, \
276 .has_coherent_ggtt = true, \
279 /* snb does support rc6p, but enabling it causes various issues */ \
282 .dma_mask_size = 40, \
283 .max_pat_index = 3, \
284 .__runtime.ppgtt_type = INTEL_PPGTT_ALIASING, \
285 .__runtime.ppgtt_size = 31, \
286 GEN_DEFAULT_PAGE_SIZES, \
287 GEN_DEFAULT_REGIONS, \
290 #define SNB_D_PLATFORM \
292 PLATFORM(INTEL_SANDYBRIDGE)
294 static const struct intel_device_info snb_d_gt1_info = {
299 static const struct intel_device_info snb_d_gt2_info = {
304 #define SNB_M_PLATFORM \
306 PLATFORM(INTEL_SANDYBRIDGE), \
310 static const struct intel_device_info snb_m_gt1_info = {
315 static const struct intel_device_info snb_m_gt2_info = {
320 #define GEN7_FEATURES \
322 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0), \
323 .has_3d_pipeline = 1, \
324 .has_coherent_ggtt = true, \
328 .has_reset_engine = true, \
330 .dma_mask_size = 40, \
331 .max_pat_index = 3, \
332 .__runtime.ppgtt_type = INTEL_PPGTT_ALIASING, \
333 .__runtime.ppgtt_size = 31, \
334 GEN_DEFAULT_PAGE_SIZES, \
335 GEN_DEFAULT_REGIONS, \
338 #define IVB_D_PLATFORM \
340 PLATFORM(INTEL_IVYBRIDGE), \
343 static const struct intel_device_info ivb_d_gt1_info = {
348 static const struct intel_device_info ivb_d_gt2_info = {
353 #define IVB_M_PLATFORM \
355 PLATFORM(INTEL_IVYBRIDGE), \
359 static const struct intel_device_info ivb_m_gt1_info = {
364 static const struct intel_device_info ivb_m_gt2_info = {
369 static const struct intel_device_info ivb_q_info = {
371 PLATFORM(INTEL_IVYBRIDGE),
376 static const struct intel_device_info vlv_info = {
377 PLATFORM(INTEL_VALLEYVIEW),
382 .has_reset_engine = true,
386 .__runtime.ppgtt_type = INTEL_PPGTT_ALIASING,
387 .__runtime.ppgtt_size = 31,
389 .has_coherent_ggtt = false,
390 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0),
391 GEN_DEFAULT_PAGE_SIZES,
396 #define G75_FEATURES \
398 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
399 .has_rc6p = 0 /* RC6p removed-by HSW */, \
402 #define HSW_PLATFORM \
404 PLATFORM(INTEL_HASWELL), \
407 static const struct intel_device_info hsw_gt1_info = {
412 static const struct intel_device_info hsw_gt2_info = {
417 static const struct intel_device_info hsw_gt3_info = {
422 #define GEN8_FEATURES \
425 .has_logical_ring_contexts = 1, \
426 .dma_mask_size = 39, \
427 .__runtime.ppgtt_type = INTEL_PPGTT_FULL, \
428 .__runtime.ppgtt_size = 48, \
431 #define BDW_PLATFORM \
433 PLATFORM(INTEL_BROADWELL)
435 static const struct intel_device_info bdw_gt1_info = {
440 static const struct intel_device_info bdw_gt2_info = {
445 static const struct intel_device_info bdw_rsvd_info = {
448 /* According to the device ID those devices are GT3, they were
449 * previously treated as not GT3, keep it like that.
453 static const struct intel_device_info bdw_gt3_info = {
456 .__runtime.platform_engine_mask =
457 BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
460 static const struct intel_device_info chv_info = {
461 PLATFORM(INTEL_CHERRYVIEW),
464 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0),
465 .has_64bit_reloc = 1,
469 .has_logical_ring_contexts = 1,
472 .__runtime.ppgtt_type = INTEL_PPGTT_FULL,
473 .__runtime.ppgtt_size = 32,
474 .has_reset_engine = 1,
476 .has_coherent_ggtt = false,
477 GEN_DEFAULT_PAGE_SIZES,
482 #define GEN9_DEFAULT_PAGE_SIZES \
483 .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K | \
484 I915_GTT_PAGE_SIZE_64K
486 #define GEN9_FEATURES \
489 GEN9_DEFAULT_PAGE_SIZES, \
492 #define SKL_PLATFORM \
494 PLATFORM(INTEL_SKYLAKE)
496 static const struct intel_device_info skl_gt1_info = {
501 static const struct intel_device_info skl_gt2_info = {
506 #define SKL_GT3_PLUS_PLATFORM \
508 .__runtime.platform_engine_mask = \
509 BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1)
512 static const struct intel_device_info skl_gt3_info = {
513 SKL_GT3_PLUS_PLATFORM,
517 static const struct intel_device_info skl_gt4_info = {
518 SKL_GT3_PLUS_PLATFORM,
522 #define GEN9_LP_FEATURES \
525 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
526 .has_3d_pipeline = 1, \
527 .has_64bit_reloc = 1, \
528 .has_runtime_pm = 1, \
531 .has_logical_ring_contexts = 1, \
533 .dma_mask_size = 39, \
534 .__runtime.ppgtt_type = INTEL_PPGTT_FULL, \
535 .__runtime.ppgtt_size = 48, \
536 .has_reset_engine = 1, \
538 .has_coherent_ggtt = false, \
539 .max_pat_index = 3, \
540 GEN9_DEFAULT_PAGE_SIZES, \
541 GEN_DEFAULT_REGIONS, \
544 static const struct intel_device_info bxt_info = {
546 PLATFORM(INTEL_BROXTON),
549 static const struct intel_device_info glk_info = {
551 PLATFORM(INTEL_GEMINILAKE),
554 #define KBL_PLATFORM \
556 PLATFORM(INTEL_KABYLAKE)
558 static const struct intel_device_info kbl_gt1_info = {
563 static const struct intel_device_info kbl_gt2_info = {
568 static const struct intel_device_info kbl_gt3_info = {
571 .__runtime.platform_engine_mask =
572 BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
575 #define CFL_PLATFORM \
577 PLATFORM(INTEL_COFFEELAKE)
579 static const struct intel_device_info cfl_gt1_info = {
584 static const struct intel_device_info cfl_gt2_info = {
589 static const struct intel_device_info cfl_gt3_info = {
592 .__runtime.platform_engine_mask =
593 BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
596 #define CML_PLATFORM \
598 PLATFORM(INTEL_COMETLAKE)
600 static const struct intel_device_info cml_gt1_info = {
605 static const struct intel_device_info cml_gt2_info = {
610 #define GEN11_DEFAULT_PAGE_SIZES \
611 .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K | \
612 I915_GTT_PAGE_SIZE_64K | \
613 I915_GTT_PAGE_SIZE_2M
615 #define GEN11_FEATURES \
617 GEN11_DEFAULT_PAGE_SIZES, \
619 .has_coherent_ggtt = false, \
620 .has_logical_ring_elsq = 1
622 static const struct intel_device_info icl_info = {
624 PLATFORM(INTEL_ICELAKE),
625 .__runtime.platform_engine_mask =
626 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
629 static const struct intel_device_info ehl_info = {
631 PLATFORM(INTEL_ELKHARTLAKE),
632 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(VCS0) | BIT(VECS0),
633 .__runtime.ppgtt_size = 36,
636 static const struct intel_device_info jsl_info = {
638 PLATFORM(INTEL_JASPERLAKE),
639 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(VCS0) | BIT(VECS0),
640 .__runtime.ppgtt_size = 36,
643 #define GEN12_FEATURES \
647 .has_global_mocs = 1, \
651 static const struct intel_device_info tgl_info = {
653 PLATFORM(INTEL_TIGERLAKE),
654 .__runtime.platform_engine_mask =
655 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
658 static const struct intel_device_info rkl_info = {
660 PLATFORM(INTEL_ROCKETLAKE),
661 .__runtime.platform_engine_mask =
662 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0),
665 #define DGFX_FEATURES \
666 .__runtime.memory_regions = REGION_SMEM | REGION_LMEM | REGION_STOLEN_LMEM, \
673 static const struct intel_device_info dg1_info = {
676 .__runtime.graphics.ip.rel = 10,
678 .require_force_probe = 1,
679 .__runtime.platform_engine_mask =
680 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) |
681 BIT(VCS0) | BIT(VCS2),
683 .__runtime.ppgtt_size = 47,
686 static const struct intel_device_info adl_s_info = {
688 PLATFORM(INTEL_ALDERLAKE_S),
689 .__runtime.platform_engine_mask =
690 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
694 static const struct intel_device_info adl_p_info = {
696 PLATFORM(INTEL_ALDERLAKE_P),
697 .__runtime.platform_engine_mask =
698 BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
699 .__runtime.ppgtt_size = 48,
705 #define XE_HP_PAGE_SIZES \
706 .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K | \
707 I915_GTT_PAGE_SIZE_64K | \
708 I915_GTT_PAGE_SIZE_2M
710 #define XE_HP_FEATURES \
711 .__runtime.graphics.ip.ver = 12, \
712 .__runtime.graphics.ip.rel = 50, \
715 .dma_mask_size = 46, \
716 .has_3d_pipeline = 1, \
717 .has_64bit_reloc = 1, \
720 .has_global_mocs = 1, \
723 .has_logical_ring_contexts = 1, \
724 .has_logical_ring_elsq = 1, \
725 .has_mslice_steering = 1, \
726 .has_oa_bpc_reporting = 1, \
727 .has_oa_slice_contrib_limits = 1, \
730 .has_reset_engine = 1, \
732 .has_runtime_pm = 1, \
733 .max_pat_index = 3, \
734 .__runtime.ppgtt_size = 48, \
735 .__runtime.ppgtt_type = INTEL_PPGTT_FULL
737 #define XE_HPM_FEATURES \
738 .__runtime.media.ip.ver = 12, \
739 .__runtime.media.ip.rel = 50
742 static const struct intel_device_info xehpsdv_info = {
746 PLATFORM(INTEL_XEHPSDV),
748 .has_media_ratio_mode = 1,
749 .__runtime.platform_engine_mask =
750 BIT(RCS0) | BIT(BCS0) |
751 BIT(VECS0) | BIT(VECS1) | BIT(VECS2) | BIT(VECS3) |
752 BIT(VCS0) | BIT(VCS1) | BIT(VCS2) | BIT(VCS3) |
753 BIT(VCS4) | BIT(VCS5) | BIT(VCS6) | BIT(VCS7) |
754 BIT(CCS0) | BIT(CCS1) | BIT(CCS2) | BIT(CCS3),
755 .require_force_probe = 1,
758 #define DG2_FEATURES \
762 .__runtime.graphics.ip.rel = 55, \
763 .__runtime.media.ip.rel = 55, \
764 PLATFORM(INTEL_DG2), \
765 .has_64k_pages = 1, \
766 .has_guc_deprivilege = 1, \
768 .has_media_ratio_mode = 1, \
769 .__runtime.platform_engine_mask = \
770 BIT(RCS0) | BIT(BCS0) | \
771 BIT(VECS0) | BIT(VECS1) | \
772 BIT(VCS0) | BIT(VCS2) | \
773 BIT(CCS0) | BIT(CCS1) | BIT(CCS2) | BIT(CCS3)
775 static const struct intel_device_info dg2_info = {
779 static const struct intel_device_info ats_m_info = {
781 .require_force_probe = 1,
782 .tuning_thread_rr_after_dep = 1,
785 #define XE_HPC_FEATURES \
787 .dma_mask_size = 52, \
788 .has_3d_pipeline = 0, \
789 .has_guc_deprivilege = 1, \
790 .has_l3_ccs_read = 1, \
791 .has_mslice_steering = 0, \
792 .has_one_eu_per_fuse_bit = 1
795 static const struct intel_device_info pvc_info = {
799 .__runtime.graphics.ip.rel = 60,
800 .__runtime.media.ip.rel = 60,
801 PLATFORM(INTEL_PONTEVECCHIO),
804 .__runtime.platform_engine_mask =
807 BIT(CCS0) | BIT(CCS1) | BIT(CCS2) | BIT(CCS3),
808 .require_force_probe = 1,
812 static const struct intel_gt_definition xelpmp_extra_gt[] = {
815 .name = "Standalone Media GT",
816 .gsi_offset = MTL_MEDIA_GSI_BASE,
817 .engine_mask = BIT(VECS0) | BIT(VCS0) | BIT(VCS2) | BIT(GSC0),
822 static const struct intel_device_info mtl_info = {
825 * Real graphics IP version will be obtained from hardware GMD_ID
826 * register. Value provided here is just for sanity checking.
828 .__runtime.graphics.ip.ver = 12,
829 .__runtime.graphics.ip.rel = 70,
830 .__runtime.media.ip.ver = 13,
831 PLATFORM(INTEL_METEORLAKE),
832 .extra_gt_list = xelpmp_extra_gt,
835 .has_guc_deprivilege = 1,
837 .has_mslice_steering = 0,
841 .__runtime.memory_regions = REGION_SMEM | REGION_STOLEN_LMEM,
842 .__runtime.platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(CCS0),
843 .require_force_probe = 1,
852 * Make sure any device matches here are from most specific to most
853 * general. For example, since the Quanta match is based on the subsystem
854 * and subvendor IDs, we need it to come before the more general IVB
855 * PCI ID matches, otherwise we'll use the wrong info struct above.
857 static const struct pci_device_id pciidlist[] = {
858 INTEL_I830_IDS(&i830_info),
859 INTEL_I845G_IDS(&i845g_info),
860 INTEL_I85X_IDS(&i85x_info),
861 INTEL_I865G_IDS(&i865g_info),
862 INTEL_I915G_IDS(&i915g_info),
863 INTEL_I915GM_IDS(&i915gm_info),
864 INTEL_I945G_IDS(&i945g_info),
865 INTEL_I945GM_IDS(&i945gm_info),
866 INTEL_I965G_IDS(&i965g_info),
867 INTEL_G33_IDS(&g33_info),
868 INTEL_I965GM_IDS(&i965gm_info),
869 INTEL_GM45_IDS(&gm45_info),
870 INTEL_G45_IDS(&g45_info),
871 INTEL_PINEVIEW_G_IDS(&pnv_g_info),
872 INTEL_PINEVIEW_M_IDS(&pnv_m_info),
873 INTEL_IRONLAKE_D_IDS(&ilk_d_info),
874 INTEL_IRONLAKE_M_IDS(&ilk_m_info),
875 INTEL_SNB_D_GT1_IDS(&snb_d_gt1_info),
876 INTEL_SNB_D_GT2_IDS(&snb_d_gt2_info),
877 INTEL_SNB_M_GT1_IDS(&snb_m_gt1_info),
878 INTEL_SNB_M_GT2_IDS(&snb_m_gt2_info),
879 INTEL_IVB_Q_IDS(&ivb_q_info), /* must be first IVB */
880 INTEL_IVB_M_GT1_IDS(&ivb_m_gt1_info),
881 INTEL_IVB_M_GT2_IDS(&ivb_m_gt2_info),
882 INTEL_IVB_D_GT1_IDS(&ivb_d_gt1_info),
883 INTEL_IVB_D_GT2_IDS(&ivb_d_gt2_info),
884 INTEL_HSW_GT1_IDS(&hsw_gt1_info),
885 INTEL_HSW_GT2_IDS(&hsw_gt2_info),
886 INTEL_HSW_GT3_IDS(&hsw_gt3_info),
887 INTEL_VLV_IDS(&vlv_info),
888 INTEL_BDW_GT1_IDS(&bdw_gt1_info),
889 INTEL_BDW_GT2_IDS(&bdw_gt2_info),
890 INTEL_BDW_GT3_IDS(&bdw_gt3_info),
891 INTEL_BDW_RSVD_IDS(&bdw_rsvd_info),
892 INTEL_CHV_IDS(&chv_info),
893 INTEL_SKL_GT1_IDS(&skl_gt1_info),
894 INTEL_SKL_GT2_IDS(&skl_gt2_info),
895 INTEL_SKL_GT3_IDS(&skl_gt3_info),
896 INTEL_SKL_GT4_IDS(&skl_gt4_info),
897 INTEL_BXT_IDS(&bxt_info),
898 INTEL_GLK_IDS(&glk_info),
899 INTEL_KBL_GT1_IDS(&kbl_gt1_info),
900 INTEL_KBL_GT2_IDS(&kbl_gt2_info),
901 INTEL_KBL_GT3_IDS(&kbl_gt3_info),
902 INTEL_KBL_GT4_IDS(&kbl_gt3_info),
903 INTEL_AML_KBL_GT2_IDS(&kbl_gt2_info),
904 INTEL_CFL_S_GT1_IDS(&cfl_gt1_info),
905 INTEL_CFL_S_GT2_IDS(&cfl_gt2_info),
906 INTEL_CFL_H_GT1_IDS(&cfl_gt1_info),
907 INTEL_CFL_H_GT2_IDS(&cfl_gt2_info),
908 INTEL_CFL_U_GT2_IDS(&cfl_gt2_info),
909 INTEL_CFL_U_GT3_IDS(&cfl_gt3_info),
910 INTEL_WHL_U_GT1_IDS(&cfl_gt1_info),
911 INTEL_WHL_U_GT2_IDS(&cfl_gt2_info),
912 INTEL_AML_CFL_GT2_IDS(&cfl_gt2_info),
913 INTEL_WHL_U_GT3_IDS(&cfl_gt3_info),
914 INTEL_CML_GT1_IDS(&cml_gt1_info),
915 INTEL_CML_GT2_IDS(&cml_gt2_info),
916 INTEL_CML_U_GT1_IDS(&cml_gt1_info),
917 INTEL_CML_U_GT2_IDS(&cml_gt2_info),
918 INTEL_ICL_11_IDS(&icl_info),
919 INTEL_EHL_IDS(&ehl_info),
920 INTEL_JSL_IDS(&jsl_info),
921 INTEL_TGL_12_IDS(&tgl_info),
922 INTEL_RKL_IDS(&rkl_info),
923 INTEL_ADLS_IDS(&adl_s_info),
924 INTEL_ADLP_IDS(&adl_p_info),
925 INTEL_ADLN_IDS(&adl_p_info),
926 INTEL_DG1_IDS(&dg1_info),
927 INTEL_RPLS_IDS(&adl_s_info),
928 INTEL_RPLP_IDS(&adl_p_info),
929 INTEL_DG2_IDS(&dg2_info),
930 INTEL_ATS_M_IDS(&ats_m_info),
931 INTEL_MTL_IDS(&mtl_info),
934 MODULE_DEVICE_TABLE(pci, pciidlist);
936 static void i915_pci_remove(struct pci_dev *pdev)
938 struct drm_i915_private *i915;
940 i915 = pci_get_drvdata(pdev);
941 if (!i915) /* driver load aborted, nothing to cleanup */
944 i915_driver_remove(i915);
945 pci_set_drvdata(pdev, NULL);
948 /* is device_id present in comma separated list of ids */
949 static bool device_id_in_list(u16 device_id, const char *devices, bool negative)
954 if (!devices || !*devices)
957 /* match everything */
958 if (negative && strcmp(devices, "!*") == 0)
960 if (!negative && strcmp(devices, "*") == 0)
963 s = kstrdup(devices, GFP_KERNEL);
967 for (p = s, ret = false; (tok = strsep(&p, ",")) != NULL; ) {
970 if (negative && tok[0] == '!')
972 else if ((negative && tok[0] != '!') ||
973 (!negative && tok[0] == '!'))
976 if (kstrtou16(tok, 16, &val) == 0 && val == device_id) {
987 static bool id_forced(u16 device_id)
989 return device_id_in_list(device_id, i915_modparams.force_probe, false);
992 static bool id_blocked(u16 device_id)
994 return device_id_in_list(device_id, i915_modparams.force_probe, true);
997 bool i915_pci_resource_valid(struct pci_dev *pdev, int bar)
999 if (!pci_resource_flags(pdev, bar))
1002 if (pci_resource_flags(pdev, bar) & IORESOURCE_UNSET)
1005 if (!pci_resource_len(pdev, bar))
1011 static bool intel_mmio_bar_valid(struct pci_dev *pdev, struct intel_device_info *intel_info)
1013 return i915_pci_resource_valid(pdev, intel_mmio_bar(intel_info->__runtime.graphics.ip.ver));
1016 static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
1018 struct intel_device_info *intel_info =
1019 (struct intel_device_info *) ent->driver_data;
1022 if (intel_info->require_force_probe && !id_forced(pdev->device)) {
1023 dev_info(&pdev->dev,
1024 "Your graphics device %04x is not properly supported by i915 in this\n"
1025 "kernel version. To force driver probe anyway, use i915.force_probe=%04x\n"
1026 "module parameter or CONFIG_DRM_I915_FORCE_PROBE=%04x configuration option,\n"
1027 "or (recommended) check for kernel updates.\n",
1028 pdev->device, pdev->device, pdev->device);
1032 if (id_blocked(pdev->device)) {
1033 dev_info(&pdev->dev, "I915 probe blocked for Device ID %04x.\n",
1038 if (intel_info->require_force_probe) {
1039 dev_info(&pdev->dev, "Force probing unsupported Device ID %04x, tainting kernel\n",
1041 add_taint(TAINT_USER, LOCKDEP_STILL_OK);
1044 /* Only bind to function 0 of the device. Early generations
1045 * used function 1 as a placeholder for multi-head. This causes
1046 * us confusion instead, especially on the systems where both
1047 * functions have the same PCI-ID!
1049 if (PCI_FUNC(pdev->devfn))
1052 if (!intel_mmio_bar_valid(pdev, intel_info))
1055 /* Detect if we need to wait for other drivers early on */
1056 if (intel_display_driver_probe_defer(pdev))
1057 return -EPROBE_DEFER;
1059 err = i915_driver_probe(pdev, ent);
1063 if (i915_inject_probe_failure(pci_get_drvdata(pdev))) {
1064 i915_pci_remove(pdev);
1068 err = i915_live_selftests(pdev);
1070 i915_pci_remove(pdev);
1071 return err > 0 ? -ENOTTY : err;
1074 err = i915_perf_selftests(pdev);
1076 i915_pci_remove(pdev);
1077 return err > 0 ? -ENOTTY : err;
1083 static void i915_pci_shutdown(struct pci_dev *pdev)
1085 struct drm_i915_private *i915 = pci_get_drvdata(pdev);
1087 i915_driver_shutdown(i915);
1090 static struct pci_driver i915_pci_driver = {
1091 .name = DRIVER_NAME,
1092 .id_table = pciidlist,
1093 .probe = i915_pci_probe,
1094 .remove = i915_pci_remove,
1095 .shutdown = i915_pci_shutdown,
1096 .driver.pm = &i915_pm_ops,
1099 int i915_pci_register_driver(void)
1101 return pci_register_driver(&i915_pci_driver);
1104 void i915_pci_unregister_driver(void)
1106 pci_unregister_driver(&i915_pci_driver);