i915_pci.c 19 KB

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