i915_pci.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794
  1. /*
  2. * Copyright © 2016 Intel Corporation
  3. *
  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:
  10. *
  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
  13. * Software.
  14. *
  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
  21. * IN THE SOFTWARE.
  22. *
  23. */
  24. #include <linux/console.h>
  25. #include <linux/vgaarb.h>
  26. #include <linux/vga_switcheroo.h>
  27. #include "i915_drv.h"
  28. #include "i915_selftest.h"
  29. #define PLATFORM(x) .platform = (x), .platform_mask = BIT(x)
  30. #define GEN(x) .gen = (x), .gen_mask = BIT((x) - 1)
  31. #define GEN_DEFAULT_PIPEOFFSETS \
  32. .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
  33. PIPE_C_OFFSET, PIPE_EDP_OFFSET }, \
  34. .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
  35. TRANSCODER_C_OFFSET, TRANSCODER_EDP_OFFSET }, \
  36. .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET }
  37. #define GEN_CHV_PIPEOFFSETS \
  38. .pipe_offsets = { PIPE_A_OFFSET, PIPE_B_OFFSET, \
  39. CHV_PIPE_C_OFFSET }, \
  40. .trans_offsets = { TRANSCODER_A_OFFSET, TRANSCODER_B_OFFSET, \
  41. CHV_TRANSCODER_C_OFFSET, }, \
  42. .palette_offsets = { PALETTE_A_OFFSET, PALETTE_B_OFFSET, \
  43. CHV_PALETTE_C_OFFSET }
  44. #define CURSOR_OFFSETS \
  45. .cursor_offsets = { CURSOR_A_OFFSET, CURSOR_B_OFFSET, CHV_CURSOR_C_OFFSET }
  46. #define IVB_CURSOR_OFFSETS \
  47. .cursor_offsets = { CURSOR_A_OFFSET, IVB_CURSOR_B_OFFSET, IVB_CURSOR_C_OFFSET }
  48. #define BDW_COLORS \
  49. .color = { .degamma_lut_size = 512, .gamma_lut_size = 512 }
  50. #define CHV_COLORS \
  51. .color = { .degamma_lut_size = 65, .gamma_lut_size = 257 }
  52. #define GLK_COLORS \
  53. .color = { .degamma_lut_size = 0, .gamma_lut_size = 1024 }
  54. /* Keep in gen based order, and chronological order within a gen */
  55. #define GEN_DEFAULT_PAGE_SIZES \
  56. .page_sizes = I915_GTT_PAGE_SIZE_4K
  57. #define GEN2_FEATURES \
  58. GEN(2), \
  59. .num_pipes = 1, \
  60. .has_overlay = 1, .overlay_needs_physical = 1, \
  61. .has_gmch_display = 1, \
  62. .hws_needs_physical = 1, \
  63. .unfenced_needs_alignment = 1, \
  64. .ring_mask = RENDER_RING, \
  65. .has_snoop = true, \
  66. .has_coherent_ggtt = false, \
  67. GEN_DEFAULT_PIPEOFFSETS, \
  68. GEN_DEFAULT_PAGE_SIZES, \
  69. CURSOR_OFFSETS
  70. static const struct intel_device_info intel_i830_info = {
  71. GEN2_FEATURES,
  72. PLATFORM(INTEL_I830),
  73. .is_mobile = 1, .cursor_needs_physical = 1,
  74. .num_pipes = 2, /* legal, last one wins */
  75. };
  76. static const struct intel_device_info intel_i845g_info = {
  77. GEN2_FEATURES,
  78. PLATFORM(INTEL_I845G),
  79. };
  80. static const struct intel_device_info intel_i85x_info = {
  81. GEN2_FEATURES,
  82. PLATFORM(INTEL_I85X),
  83. .is_mobile = 1,
  84. .num_pipes = 2, /* legal, last one wins */
  85. .cursor_needs_physical = 1,
  86. .has_fbc = 1,
  87. };
  88. static const struct intel_device_info intel_i865g_info = {
  89. GEN2_FEATURES,
  90. PLATFORM(INTEL_I865G),
  91. };
  92. #define GEN3_FEATURES \
  93. GEN(3), \
  94. .num_pipes = 2, \
  95. .has_gmch_display = 1, \
  96. .ring_mask = RENDER_RING, \
  97. .has_snoop = true, \
  98. .has_coherent_ggtt = true, \
  99. GEN_DEFAULT_PIPEOFFSETS, \
  100. GEN_DEFAULT_PAGE_SIZES, \
  101. CURSOR_OFFSETS
  102. static const struct intel_device_info intel_i915g_info = {
  103. GEN3_FEATURES,
  104. PLATFORM(INTEL_I915G),
  105. .has_coherent_ggtt = false,
  106. .cursor_needs_physical = 1,
  107. .has_overlay = 1, .overlay_needs_physical = 1,
  108. .hws_needs_physical = 1,
  109. .unfenced_needs_alignment = 1,
  110. };
  111. static const struct intel_device_info intel_i915gm_info = {
  112. GEN3_FEATURES,
  113. PLATFORM(INTEL_I915GM),
  114. .is_mobile = 1,
  115. .cursor_needs_physical = 1,
  116. .has_overlay = 1, .overlay_needs_physical = 1,
  117. .supports_tv = 1,
  118. .has_fbc = 1,
  119. .hws_needs_physical = 1,
  120. .unfenced_needs_alignment = 1,
  121. };
  122. static const struct intel_device_info intel_i945g_info = {
  123. GEN3_FEATURES,
  124. PLATFORM(INTEL_I945G),
  125. .has_hotplug = 1, .cursor_needs_physical = 1,
  126. .has_overlay = 1, .overlay_needs_physical = 1,
  127. .hws_needs_physical = 1,
  128. .unfenced_needs_alignment = 1,
  129. };
  130. static const struct intel_device_info intel_i945gm_info = {
  131. GEN3_FEATURES,
  132. PLATFORM(INTEL_I945GM),
  133. .is_mobile = 1,
  134. .has_hotplug = 1, .cursor_needs_physical = 1,
  135. .has_overlay = 1, .overlay_needs_physical = 1,
  136. .supports_tv = 1,
  137. .has_fbc = 1,
  138. .hws_needs_physical = 1,
  139. .unfenced_needs_alignment = 1,
  140. };
  141. static const struct intel_device_info intel_g33_info = {
  142. GEN3_FEATURES,
  143. PLATFORM(INTEL_G33),
  144. .has_hotplug = 1,
  145. .has_overlay = 1,
  146. };
  147. static const struct intel_device_info intel_pineview_info = {
  148. GEN3_FEATURES,
  149. PLATFORM(INTEL_PINEVIEW),
  150. .is_mobile = 1,
  151. .has_hotplug = 1,
  152. .has_overlay = 1,
  153. };
  154. #define GEN4_FEATURES \
  155. GEN(4), \
  156. .num_pipes = 2, \
  157. .has_hotplug = 1, \
  158. .has_gmch_display = 1, \
  159. .ring_mask = RENDER_RING, \
  160. .has_snoop = true, \
  161. .has_coherent_ggtt = true, \
  162. GEN_DEFAULT_PIPEOFFSETS, \
  163. GEN_DEFAULT_PAGE_SIZES, \
  164. CURSOR_OFFSETS
  165. static const struct intel_device_info intel_i965g_info = {
  166. GEN4_FEATURES,
  167. PLATFORM(INTEL_I965G),
  168. .has_overlay = 1,
  169. .hws_needs_physical = 1,
  170. .has_snoop = false,
  171. };
  172. static const struct intel_device_info intel_i965gm_info = {
  173. GEN4_FEATURES,
  174. PLATFORM(INTEL_I965GM),
  175. .is_mobile = 1, .has_fbc = 1,
  176. .has_overlay = 1,
  177. .supports_tv = 1,
  178. .hws_needs_physical = 1,
  179. .has_snoop = false,
  180. };
  181. static const struct intel_device_info intel_g45_info = {
  182. GEN4_FEATURES,
  183. PLATFORM(INTEL_G45),
  184. .ring_mask = RENDER_RING | BSD_RING,
  185. };
  186. static const struct intel_device_info intel_gm45_info = {
  187. GEN4_FEATURES,
  188. PLATFORM(INTEL_GM45),
  189. .is_mobile = 1, .has_fbc = 1,
  190. .supports_tv = 1,
  191. .ring_mask = RENDER_RING | BSD_RING,
  192. };
  193. #define GEN5_FEATURES \
  194. GEN(5), \
  195. .num_pipes = 2, \
  196. .has_hotplug = 1, \
  197. .ring_mask = RENDER_RING | BSD_RING, \
  198. .has_snoop = true, \
  199. .has_coherent_ggtt = true, \
  200. /* ilk does support rc6, but we do not implement [power] contexts */ \
  201. .has_rc6 = 0, \
  202. GEN_DEFAULT_PIPEOFFSETS, \
  203. GEN_DEFAULT_PAGE_SIZES, \
  204. CURSOR_OFFSETS
  205. static const struct intel_device_info intel_ironlake_d_info = {
  206. GEN5_FEATURES,
  207. PLATFORM(INTEL_IRONLAKE),
  208. };
  209. static const struct intel_device_info intel_ironlake_m_info = {
  210. GEN5_FEATURES,
  211. PLATFORM(INTEL_IRONLAKE),
  212. .is_mobile = 1, .has_fbc = 1,
  213. };
  214. #define GEN6_FEATURES \
  215. GEN(6), \
  216. .num_pipes = 2, \
  217. .has_hotplug = 1, \
  218. .has_fbc = 1, \
  219. .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
  220. .has_coherent_ggtt = true, \
  221. .has_llc = 1, \
  222. .has_rc6 = 1, \
  223. .has_rc6p = 1, \
  224. .has_aliasing_ppgtt = 1, \
  225. GEN_DEFAULT_PIPEOFFSETS, \
  226. GEN_DEFAULT_PAGE_SIZES, \
  227. CURSOR_OFFSETS
  228. #define SNB_D_PLATFORM \
  229. GEN6_FEATURES, \
  230. PLATFORM(INTEL_SANDYBRIDGE)
  231. static const struct intel_device_info intel_sandybridge_d_gt1_info = {
  232. SNB_D_PLATFORM,
  233. .gt = 1,
  234. };
  235. static const struct intel_device_info intel_sandybridge_d_gt2_info = {
  236. SNB_D_PLATFORM,
  237. .gt = 2,
  238. };
  239. #define SNB_M_PLATFORM \
  240. GEN6_FEATURES, \
  241. PLATFORM(INTEL_SANDYBRIDGE), \
  242. .is_mobile = 1
  243. static const struct intel_device_info intel_sandybridge_m_gt1_info = {
  244. SNB_M_PLATFORM,
  245. .gt = 1,
  246. };
  247. static const struct intel_device_info intel_sandybridge_m_gt2_info = {
  248. SNB_M_PLATFORM,
  249. .gt = 2,
  250. };
  251. #define GEN7_FEATURES \
  252. GEN(7), \
  253. .num_pipes = 3, \
  254. .has_hotplug = 1, \
  255. .has_fbc = 1, \
  256. .ring_mask = RENDER_RING | BSD_RING | BLT_RING, \
  257. .has_coherent_ggtt = true, \
  258. .has_llc = 1, \
  259. .has_rc6 = 1, \
  260. .has_rc6p = 1, \
  261. .has_aliasing_ppgtt = 1, \
  262. .has_full_ppgtt = 1, \
  263. GEN_DEFAULT_PIPEOFFSETS, \
  264. GEN_DEFAULT_PAGE_SIZES, \
  265. IVB_CURSOR_OFFSETS
  266. #define IVB_D_PLATFORM \
  267. GEN7_FEATURES, \
  268. PLATFORM(INTEL_IVYBRIDGE), \
  269. .has_l3_dpf = 1
  270. static const struct intel_device_info intel_ivybridge_d_gt1_info = {
  271. IVB_D_PLATFORM,
  272. .gt = 1,
  273. };
  274. static const struct intel_device_info intel_ivybridge_d_gt2_info = {
  275. IVB_D_PLATFORM,
  276. .gt = 2,
  277. };
  278. #define IVB_M_PLATFORM \
  279. GEN7_FEATURES, \
  280. PLATFORM(INTEL_IVYBRIDGE), \
  281. .is_mobile = 1, \
  282. .has_l3_dpf = 1
  283. static const struct intel_device_info intel_ivybridge_m_gt1_info = {
  284. IVB_M_PLATFORM,
  285. .gt = 1,
  286. };
  287. static const struct intel_device_info intel_ivybridge_m_gt2_info = {
  288. IVB_M_PLATFORM,
  289. .gt = 2,
  290. };
  291. static const struct intel_device_info intel_ivybridge_q_info = {
  292. GEN7_FEATURES,
  293. PLATFORM(INTEL_IVYBRIDGE),
  294. .gt = 2,
  295. .num_pipes = 0, /* legal, last one wins */
  296. .has_l3_dpf = 1,
  297. };
  298. static const struct intel_device_info intel_valleyview_info = {
  299. PLATFORM(INTEL_VALLEYVIEW),
  300. GEN(7),
  301. .is_lp = 1,
  302. .num_pipes = 2,
  303. .has_runtime_pm = 1,
  304. .has_rc6 = 1,
  305. .has_gmch_display = 1,
  306. .has_hotplug = 1,
  307. .has_aliasing_ppgtt = 1,
  308. .has_full_ppgtt = 1,
  309. .has_snoop = true,
  310. .has_coherent_ggtt = false,
  311. .ring_mask = RENDER_RING | BSD_RING | BLT_RING,
  312. .display_mmio_offset = VLV_DISPLAY_BASE,
  313. GEN_DEFAULT_PAGE_SIZES,
  314. GEN_DEFAULT_PIPEOFFSETS,
  315. CURSOR_OFFSETS
  316. };
  317. #define G75_FEATURES \
  318. GEN7_FEATURES, \
  319. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
  320. .has_ddi = 1, \
  321. .has_fpga_dbg = 1, \
  322. .has_psr = 1, \
  323. .has_dp_mst = 1, \
  324. .has_rc6p = 0 /* RC6p removed-by HSW */, \
  325. .has_runtime_pm = 1
  326. #define HSW_PLATFORM \
  327. G75_FEATURES, \
  328. PLATFORM(INTEL_HASWELL), \
  329. .has_l3_dpf = 1
  330. static const struct intel_device_info intel_haswell_gt1_info = {
  331. HSW_PLATFORM,
  332. .gt = 1,
  333. };
  334. static const struct intel_device_info intel_haswell_gt2_info = {
  335. HSW_PLATFORM,
  336. .gt = 2,
  337. };
  338. static const struct intel_device_info intel_haswell_gt3_info = {
  339. HSW_PLATFORM,
  340. .gt = 3,
  341. };
  342. #define GEN8_FEATURES \
  343. G75_FEATURES, \
  344. GEN(8), \
  345. BDW_COLORS, \
  346. .page_sizes = I915_GTT_PAGE_SIZE_4K | \
  347. I915_GTT_PAGE_SIZE_2M, \
  348. .has_logical_ring_contexts = 1, \
  349. .has_full_48bit_ppgtt = 1, \
  350. .has_64bit_reloc = 1, \
  351. .has_reset_engine = 1
  352. #define BDW_PLATFORM \
  353. GEN8_FEATURES, \
  354. PLATFORM(INTEL_BROADWELL)
  355. static const struct intel_device_info intel_broadwell_gt1_info = {
  356. BDW_PLATFORM,
  357. .gt = 1,
  358. };
  359. static const struct intel_device_info intel_broadwell_gt2_info = {
  360. BDW_PLATFORM,
  361. .gt = 2,
  362. };
  363. static const struct intel_device_info intel_broadwell_rsvd_info = {
  364. BDW_PLATFORM,
  365. .gt = 3,
  366. /* According to the device ID those devices are GT3, they were
  367. * previously treated as not GT3, keep it like that.
  368. */
  369. };
  370. static const struct intel_device_info intel_broadwell_gt3_info = {
  371. BDW_PLATFORM,
  372. .gt = 3,
  373. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  374. };
  375. static const struct intel_device_info intel_cherryview_info = {
  376. PLATFORM(INTEL_CHERRYVIEW),
  377. GEN(8),
  378. .num_pipes = 3,
  379. .has_hotplug = 1,
  380. .is_lp = 1,
  381. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING,
  382. .has_64bit_reloc = 1,
  383. .has_runtime_pm = 1,
  384. .has_rc6 = 1,
  385. .has_logical_ring_contexts = 1,
  386. .has_gmch_display = 1,
  387. .has_aliasing_ppgtt = 1,
  388. .has_full_ppgtt = 1,
  389. .has_reset_engine = 1,
  390. .has_snoop = true,
  391. .has_coherent_ggtt = false,
  392. .display_mmio_offset = VLV_DISPLAY_BASE,
  393. GEN_DEFAULT_PAGE_SIZES,
  394. GEN_CHV_PIPEOFFSETS,
  395. CURSOR_OFFSETS,
  396. CHV_COLORS,
  397. };
  398. #define GEN9_DEFAULT_PAGE_SIZES \
  399. .page_sizes = I915_GTT_PAGE_SIZE_4K | \
  400. I915_GTT_PAGE_SIZE_64K | \
  401. I915_GTT_PAGE_SIZE_2M
  402. #define GEN9_FEATURES \
  403. GEN8_FEATURES, \
  404. GEN(9), \
  405. GEN9_DEFAULT_PAGE_SIZES, \
  406. .has_logical_ring_preemption = 1, \
  407. .has_csr = 1, \
  408. .has_guc = 1, \
  409. .has_ipc = 1, \
  410. .ddb_size = 896
  411. #define SKL_PLATFORM \
  412. GEN9_FEATURES, \
  413. PLATFORM(INTEL_SKYLAKE)
  414. static const struct intel_device_info intel_skylake_gt1_info = {
  415. SKL_PLATFORM,
  416. .gt = 1,
  417. };
  418. static const struct intel_device_info intel_skylake_gt2_info = {
  419. SKL_PLATFORM,
  420. .gt = 2,
  421. };
  422. #define SKL_GT3_PLUS_PLATFORM \
  423. SKL_PLATFORM, \
  424. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING
  425. static const struct intel_device_info intel_skylake_gt3_info = {
  426. SKL_GT3_PLUS_PLATFORM,
  427. .gt = 3,
  428. };
  429. static const struct intel_device_info intel_skylake_gt4_info = {
  430. SKL_GT3_PLUS_PLATFORM,
  431. .gt = 4,
  432. };
  433. #define GEN9_LP_FEATURES \
  434. GEN(9), \
  435. .is_lp = 1, \
  436. .has_hotplug = 1, \
  437. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING, \
  438. .num_pipes = 3, \
  439. .has_64bit_reloc = 1, \
  440. .has_ddi = 1, \
  441. .has_fpga_dbg = 1, \
  442. .has_fbc = 1, \
  443. .has_psr = 1, \
  444. .has_runtime_pm = 1, \
  445. .has_pooled_eu = 0, \
  446. .has_csr = 1, \
  447. .has_rc6 = 1, \
  448. .has_dp_mst = 1, \
  449. .has_logical_ring_contexts = 1, \
  450. .has_logical_ring_preemption = 1, \
  451. .has_guc = 1, \
  452. .has_aliasing_ppgtt = 1, \
  453. .has_full_ppgtt = 1, \
  454. .has_full_48bit_ppgtt = 1, \
  455. .has_reset_engine = 1, \
  456. .has_snoop = true, \
  457. .has_coherent_ggtt = false, \
  458. .has_ipc = 1, \
  459. GEN9_DEFAULT_PAGE_SIZES, \
  460. GEN_DEFAULT_PIPEOFFSETS, \
  461. IVB_CURSOR_OFFSETS, \
  462. BDW_COLORS
  463. static const struct intel_device_info intel_broxton_info = {
  464. GEN9_LP_FEATURES,
  465. PLATFORM(INTEL_BROXTON),
  466. .ddb_size = 512,
  467. };
  468. static const struct intel_device_info intel_geminilake_info = {
  469. GEN9_LP_FEATURES,
  470. PLATFORM(INTEL_GEMINILAKE),
  471. .ddb_size = 1024,
  472. GLK_COLORS,
  473. };
  474. #define KBL_PLATFORM \
  475. GEN9_FEATURES, \
  476. PLATFORM(INTEL_KABYLAKE)
  477. static const struct intel_device_info intel_kabylake_gt1_info = {
  478. KBL_PLATFORM,
  479. .gt = 1,
  480. };
  481. static const struct intel_device_info intel_kabylake_gt2_info = {
  482. KBL_PLATFORM,
  483. .gt = 2,
  484. };
  485. static const struct intel_device_info intel_kabylake_gt3_info = {
  486. KBL_PLATFORM,
  487. .gt = 3,
  488. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  489. };
  490. #define CFL_PLATFORM \
  491. GEN9_FEATURES, \
  492. PLATFORM(INTEL_COFFEELAKE)
  493. static const struct intel_device_info intel_coffeelake_gt1_info = {
  494. CFL_PLATFORM,
  495. .gt = 1,
  496. };
  497. static const struct intel_device_info intel_coffeelake_gt2_info = {
  498. CFL_PLATFORM,
  499. .gt = 2,
  500. };
  501. static const struct intel_device_info intel_coffeelake_gt3_info = {
  502. CFL_PLATFORM,
  503. .gt = 3,
  504. .ring_mask = RENDER_RING | BSD_RING | BLT_RING | VEBOX_RING | BSD2_RING,
  505. };
  506. #define GEN10_FEATURES \
  507. GEN9_FEATURES, \
  508. GEN(10), \
  509. .ddb_size = 1024, \
  510. .has_coherent_ggtt = false, \
  511. GLK_COLORS
  512. static const struct intel_device_info intel_cannonlake_info = {
  513. GEN10_FEATURES,
  514. PLATFORM(INTEL_CANNONLAKE),
  515. .gt = 2,
  516. };
  517. #define GEN11_FEATURES \
  518. GEN10_FEATURES, \
  519. GEN(11), \
  520. .ddb_size = 2048, \
  521. .has_logical_ring_elsq = 1
  522. static const struct intel_device_info intel_icelake_11_info = {
  523. GEN11_FEATURES,
  524. PLATFORM(INTEL_ICELAKE),
  525. .is_alpha_support = 1,
  526. .ring_mask = RENDER_RING | BLT_RING | VEBOX_RING | BSD_RING | BSD3_RING,
  527. };
  528. #undef GEN
  529. #undef PLATFORM
  530. /*
  531. * Make sure any device matches here are from most specific to most
  532. * general. For example, since the Quanta match is based on the subsystem
  533. * and subvendor IDs, we need it to come before the more general IVB
  534. * PCI ID matches, otherwise we'll use the wrong info struct above.
  535. */
  536. static const struct pci_device_id pciidlist[] = {
  537. INTEL_I830_IDS(&intel_i830_info),
  538. INTEL_I845G_IDS(&intel_i845g_info),
  539. INTEL_I85X_IDS(&intel_i85x_info),
  540. INTEL_I865G_IDS(&intel_i865g_info),
  541. INTEL_I915G_IDS(&intel_i915g_info),
  542. INTEL_I915GM_IDS(&intel_i915gm_info),
  543. INTEL_I945G_IDS(&intel_i945g_info),
  544. INTEL_I945GM_IDS(&intel_i945gm_info),
  545. INTEL_I965G_IDS(&intel_i965g_info),
  546. INTEL_G33_IDS(&intel_g33_info),
  547. INTEL_I965GM_IDS(&intel_i965gm_info),
  548. INTEL_GM45_IDS(&intel_gm45_info),
  549. INTEL_G45_IDS(&intel_g45_info),
  550. INTEL_PINEVIEW_IDS(&intel_pineview_info),
  551. INTEL_IRONLAKE_D_IDS(&intel_ironlake_d_info),
  552. INTEL_IRONLAKE_M_IDS(&intel_ironlake_m_info),
  553. INTEL_SNB_D_GT1_IDS(&intel_sandybridge_d_gt1_info),
  554. INTEL_SNB_D_GT2_IDS(&intel_sandybridge_d_gt2_info),
  555. INTEL_SNB_M_GT1_IDS(&intel_sandybridge_m_gt1_info),
  556. INTEL_SNB_M_GT2_IDS(&intel_sandybridge_m_gt2_info),
  557. INTEL_IVB_Q_IDS(&intel_ivybridge_q_info), /* must be first IVB */
  558. INTEL_IVB_M_GT1_IDS(&intel_ivybridge_m_gt1_info),
  559. INTEL_IVB_M_GT2_IDS(&intel_ivybridge_m_gt2_info),
  560. INTEL_IVB_D_GT1_IDS(&intel_ivybridge_d_gt1_info),
  561. INTEL_IVB_D_GT2_IDS(&intel_ivybridge_d_gt2_info),
  562. INTEL_HSW_GT1_IDS(&intel_haswell_gt1_info),
  563. INTEL_HSW_GT2_IDS(&intel_haswell_gt2_info),
  564. INTEL_HSW_GT3_IDS(&intel_haswell_gt3_info),
  565. INTEL_VLV_IDS(&intel_valleyview_info),
  566. INTEL_BDW_GT1_IDS(&intel_broadwell_gt1_info),
  567. INTEL_BDW_GT2_IDS(&intel_broadwell_gt2_info),
  568. INTEL_BDW_GT3_IDS(&intel_broadwell_gt3_info),
  569. INTEL_BDW_RSVD_IDS(&intel_broadwell_rsvd_info),
  570. INTEL_CHV_IDS(&intel_cherryview_info),
  571. INTEL_SKL_GT1_IDS(&intel_skylake_gt1_info),
  572. INTEL_SKL_GT2_IDS(&intel_skylake_gt2_info),
  573. INTEL_SKL_GT3_IDS(&intel_skylake_gt3_info),
  574. INTEL_SKL_GT4_IDS(&intel_skylake_gt4_info),
  575. INTEL_BXT_IDS(&intel_broxton_info),
  576. INTEL_GLK_IDS(&intel_geminilake_info),
  577. INTEL_KBL_GT1_IDS(&intel_kabylake_gt1_info),
  578. INTEL_KBL_GT2_IDS(&intel_kabylake_gt2_info),
  579. INTEL_KBL_GT3_IDS(&intel_kabylake_gt3_info),
  580. INTEL_KBL_GT4_IDS(&intel_kabylake_gt3_info),
  581. INTEL_AML_GT2_IDS(&intel_kabylake_gt2_info),
  582. INTEL_CFL_S_GT1_IDS(&intel_coffeelake_gt1_info),
  583. INTEL_CFL_S_GT2_IDS(&intel_coffeelake_gt2_info),
  584. INTEL_CFL_H_GT2_IDS(&intel_coffeelake_gt2_info),
  585. INTEL_CFL_U_GT2_IDS(&intel_coffeelake_gt2_info),
  586. INTEL_CFL_U_GT3_IDS(&intel_coffeelake_gt3_info),
  587. INTEL_WHL_U_GT1_IDS(&intel_coffeelake_gt1_info),
  588. INTEL_WHL_U_GT2_IDS(&intel_coffeelake_gt2_info),
  589. INTEL_WHL_U_GT3_IDS(&intel_coffeelake_gt3_info),
  590. INTEL_CNL_IDS(&intel_cannonlake_info),
  591. INTEL_ICL_11_IDS(&intel_icelake_11_info),
  592. {0, 0, 0}
  593. };
  594. MODULE_DEVICE_TABLE(pci, pciidlist);
  595. static void i915_pci_remove(struct pci_dev *pdev)
  596. {
  597. struct drm_device *dev;
  598. dev = pci_get_drvdata(pdev);
  599. if (!dev) /* driver load aborted, nothing to cleanup */
  600. return;
  601. i915_driver_unload(dev);
  602. drm_dev_put(dev);
  603. pci_set_drvdata(pdev, NULL);
  604. }
  605. static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  606. {
  607. struct intel_device_info *intel_info =
  608. (struct intel_device_info *) ent->driver_data;
  609. int err;
  610. if (IS_ALPHA_SUPPORT(intel_info) && !i915_modparams.alpha_support) {
  611. DRM_INFO("The driver support for your hardware in this kernel version is alpha quality\n"
  612. "See CONFIG_DRM_I915_ALPHA_SUPPORT or i915.alpha_support module parameter\n"
  613. "to enable support in this kernel version, or check for kernel updates.\n");
  614. return -ENODEV;
  615. }
  616. /* Only bind to function 0 of the device. Early generations
  617. * used function 1 as a placeholder for multi-head. This causes
  618. * us confusion instead, especially on the systems where both
  619. * functions have the same PCI-ID!
  620. */
  621. if (PCI_FUNC(pdev->devfn))
  622. return -ENODEV;
  623. /*
  624. * apple-gmux is needed on dual GPU MacBook Pro
  625. * to probe the panel if we're the inactive GPU.
  626. */
  627. if (vga_switcheroo_client_probe_defer(pdev))
  628. return -EPROBE_DEFER;
  629. err = i915_driver_load(pdev, ent);
  630. if (err)
  631. return err;
  632. if (i915_inject_load_failure()) {
  633. i915_pci_remove(pdev);
  634. return -ENODEV;
  635. }
  636. err = i915_live_selftests(pdev);
  637. if (err) {
  638. i915_pci_remove(pdev);
  639. return err > 0 ? -ENOTTY : err;
  640. }
  641. return 0;
  642. }
  643. static struct pci_driver i915_pci_driver = {
  644. .name = DRIVER_NAME,
  645. .id_table = pciidlist,
  646. .probe = i915_pci_probe,
  647. .remove = i915_pci_remove,
  648. .driver.pm = &i915_pm_ops,
  649. };
  650. static int __init i915_init(void)
  651. {
  652. bool use_kms = true;
  653. int err;
  654. err = i915_mock_selftests();
  655. if (err)
  656. return err > 0 ? 0 : err;
  657. /*
  658. * Enable KMS by default, unless explicitly overriden by
  659. * either the i915.modeset prarameter or by the
  660. * vga_text_mode_force boot option.
  661. */
  662. if (i915_modparams.modeset == 0)
  663. use_kms = false;
  664. if (vgacon_text_force() && i915_modparams.modeset == -1)
  665. use_kms = false;
  666. if (!use_kms) {
  667. /* Silently fail loading to not upset userspace. */
  668. DRM_DEBUG_DRIVER("KMS disabled.\n");
  669. return 0;
  670. }
  671. return pci_register_driver(&i915_pci_driver);
  672. }
  673. static void __exit i915_exit(void)
  674. {
  675. if (!i915_pci_driver.driver.owner)
  676. return;
  677. pci_unregister_driver(&i915_pci_driver);
  678. }
  679. module_init(i915_init);
  680. module_exit(i915_exit);
  681. MODULE_AUTHOR("Tungsten Graphics, Inc.");
  682. MODULE_AUTHOR("Intel Corporation");
  683. MODULE_DESCRIPTION(DRIVER_DESC);
  684. MODULE_LICENSE("GPL and additional rights");