i915_pci.c 19 KB

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