i915_pci.c 37 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415
  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 <drm/drm_color_mgmt.h>
  25. #include <drm/drm_drv.h>
  26. #include <drm/i915_pciids.h>
  27. #include "gt/intel_gt_regs.h"
  28. #include "gt/intel_sa_media.h"
  29. #include "i915_driver.h"
  30. #include "i915_drv.h"
  31. #include "i915_pci.h"
  32. #include "i915_reg.h"
  33. #include "intel_pci_config.h"
  34. #define PLATFORM(x) .platform = (x)
  35. #define GEN(x) \
  36. .__runtime.graphics.ip.ver = (x), \
  37. .__runtime.media.ip.ver = (x), \
  38. .__runtime.display.ip.ver = (x)
  39. #define NO_DISPLAY .__runtime.pipe_mask = 0
  40. #define I845_PIPE_OFFSETS \
  41. .display.pipe_offsets = { \
  42. [TRANSCODER_A] = PIPE_A_OFFSET, \
  43. }, \
  44. .display.trans_offsets = { \
  45. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  46. }
  47. #define I9XX_PIPE_OFFSETS \
  48. .display.pipe_offsets = { \
  49. [TRANSCODER_A] = PIPE_A_OFFSET, \
  50. [TRANSCODER_B] = PIPE_B_OFFSET, \
  51. }, \
  52. .display.trans_offsets = { \
  53. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  54. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  55. }
  56. #define IVB_PIPE_OFFSETS \
  57. .display.pipe_offsets = { \
  58. [TRANSCODER_A] = PIPE_A_OFFSET, \
  59. [TRANSCODER_B] = PIPE_B_OFFSET, \
  60. [TRANSCODER_C] = PIPE_C_OFFSET, \
  61. }, \
  62. .display.trans_offsets = { \
  63. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  64. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  65. [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
  66. }
  67. #define HSW_PIPE_OFFSETS \
  68. .display.pipe_offsets = { \
  69. [TRANSCODER_A] = PIPE_A_OFFSET, \
  70. [TRANSCODER_B] = PIPE_B_OFFSET, \
  71. [TRANSCODER_C] = PIPE_C_OFFSET, \
  72. [TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
  73. }, \
  74. .display.trans_offsets = { \
  75. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  76. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  77. [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
  78. [TRANSCODER_EDP] = TRANSCODER_EDP_OFFSET, \
  79. }
  80. #define CHV_PIPE_OFFSETS \
  81. .display.pipe_offsets = { \
  82. [TRANSCODER_A] = PIPE_A_OFFSET, \
  83. [TRANSCODER_B] = PIPE_B_OFFSET, \
  84. [TRANSCODER_C] = CHV_PIPE_C_OFFSET, \
  85. }, \
  86. .display.trans_offsets = { \
  87. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  88. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  89. [TRANSCODER_C] = CHV_TRANSCODER_C_OFFSET, \
  90. }
  91. #define I845_CURSOR_OFFSETS \
  92. .display.cursor_offsets = { \
  93. [PIPE_A] = CURSOR_A_OFFSET, \
  94. }
  95. #define I9XX_CURSOR_OFFSETS \
  96. .display.cursor_offsets = { \
  97. [PIPE_A] = CURSOR_A_OFFSET, \
  98. [PIPE_B] = CURSOR_B_OFFSET, \
  99. }
  100. #define CHV_CURSOR_OFFSETS \
  101. .display.cursor_offsets = { \
  102. [PIPE_A] = CURSOR_A_OFFSET, \
  103. [PIPE_B] = CURSOR_B_OFFSET, \
  104. [PIPE_C] = CHV_CURSOR_C_OFFSET, \
  105. }
  106. #define IVB_CURSOR_OFFSETS \
  107. .display.cursor_offsets = { \
  108. [PIPE_A] = CURSOR_A_OFFSET, \
  109. [PIPE_B] = IVB_CURSOR_B_OFFSET, \
  110. [PIPE_C] = IVB_CURSOR_C_OFFSET, \
  111. }
  112. #define TGL_CURSOR_OFFSETS \
  113. .display.cursor_offsets = { \
  114. [PIPE_A] = CURSOR_A_OFFSET, \
  115. [PIPE_B] = IVB_CURSOR_B_OFFSET, \
  116. [PIPE_C] = IVB_CURSOR_C_OFFSET, \
  117. [PIPE_D] = TGL_CURSOR_D_OFFSET, \
  118. }
  119. #define I9XX_COLORS \
  120. .display.color = { .gamma_lut_size = 256 }
  121. #define I965_COLORS \
  122. .display.color = { .gamma_lut_size = 129, \
  123. .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
  124. }
  125. #define ILK_COLORS \
  126. .display.color = { .gamma_lut_size = 1024 }
  127. #define IVB_COLORS \
  128. .display.color = { .degamma_lut_size = 1024, .gamma_lut_size = 1024 }
  129. #define CHV_COLORS \
  130. .display.color = { \
  131. .degamma_lut_size = 65, .gamma_lut_size = 257, \
  132. .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
  133. .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
  134. }
  135. #define GLK_COLORS \
  136. .display.color = { \
  137. .degamma_lut_size = 33, .gamma_lut_size = 1024, \
  138. .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
  139. DRM_COLOR_LUT_EQUAL_CHANNELS, \
  140. }
  141. #define ICL_COLORS \
  142. .display.color = { \
  143. .degamma_lut_size = 33, .gamma_lut_size = 262145, \
  144. .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
  145. DRM_COLOR_LUT_EQUAL_CHANNELS, \
  146. .gamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING, \
  147. }
  148. /* Keep in gen based order, and chronological order within a gen */
  149. #define GEN_DEFAULT_PAGE_SIZES \
  150. .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K
  151. #define GEN_DEFAULT_REGIONS \
  152. .__runtime.memory_regions = REGION_SMEM | REGION_STOLEN_SMEM
  153. #define I830_FEATURES \
  154. GEN(2), \
  155. .is_mobile = 1, \
  156. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
  157. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
  158. .display.has_overlay = 1, \
  159. .display.cursor_needs_physical = 1, \
  160. .display.overlay_needs_physical = 1, \
  161. .display.has_gmch = 1, \
  162. .gpu_reset_clobbers_display = true, \
  163. .has_3d_pipeline = 1, \
  164. .hws_needs_physical = 1, \
  165. .unfenced_needs_alignment = 1, \
  166. .__runtime.platform_engine_mask = BIT(RCS0), \
  167. .has_snoop = true, \
  168. .has_coherent_ggtt = false, \
  169. .dma_mask_size = 32, \
  170. I9XX_PIPE_OFFSETS, \
  171. I9XX_CURSOR_OFFSETS, \
  172. I9XX_COLORS, \
  173. GEN_DEFAULT_PAGE_SIZES, \
  174. GEN_DEFAULT_REGIONS
  175. #define I845_FEATURES \
  176. GEN(2), \
  177. .__runtime.pipe_mask = BIT(PIPE_A), \
  178. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A), \
  179. .display.has_overlay = 1, \
  180. .display.overlay_needs_physical = 1, \
  181. .display.has_gmch = 1, \
  182. .has_3d_pipeline = 1, \
  183. .gpu_reset_clobbers_display = true, \
  184. .hws_needs_physical = 1, \
  185. .unfenced_needs_alignment = 1, \
  186. .__runtime.platform_engine_mask = BIT(RCS0), \
  187. .has_snoop = true, \
  188. .has_coherent_ggtt = false, \
  189. .dma_mask_size = 32, \
  190. I845_PIPE_OFFSETS, \
  191. I845_CURSOR_OFFSETS, \
  192. I9XX_COLORS, \
  193. GEN_DEFAULT_PAGE_SIZES, \
  194. GEN_DEFAULT_REGIONS
  195. static const struct intel_device_info i830_info = {
  196. I830_FEATURES,
  197. PLATFORM(INTEL_I830),
  198. };
  199. static const struct intel_device_info i845g_info = {
  200. I845_FEATURES,
  201. PLATFORM(INTEL_I845G),
  202. };
  203. static const struct intel_device_info i85x_info = {
  204. I830_FEATURES,
  205. PLATFORM(INTEL_I85X),
  206. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  207. };
  208. static const struct intel_device_info i865g_info = {
  209. I845_FEATURES,
  210. PLATFORM(INTEL_I865G),
  211. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  212. };
  213. #define GEN3_FEATURES \
  214. GEN(3), \
  215. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
  216. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
  217. .display.has_gmch = 1, \
  218. .gpu_reset_clobbers_display = true, \
  219. .__runtime.platform_engine_mask = BIT(RCS0), \
  220. .has_3d_pipeline = 1, \
  221. .has_snoop = true, \
  222. .has_coherent_ggtt = true, \
  223. .dma_mask_size = 32, \
  224. I9XX_PIPE_OFFSETS, \
  225. I9XX_CURSOR_OFFSETS, \
  226. I9XX_COLORS, \
  227. GEN_DEFAULT_PAGE_SIZES, \
  228. GEN_DEFAULT_REGIONS
  229. static const struct intel_device_info i915g_info = {
  230. GEN3_FEATURES,
  231. PLATFORM(INTEL_I915G),
  232. .has_coherent_ggtt = false,
  233. .display.cursor_needs_physical = 1,
  234. .display.has_overlay = 1,
  235. .display.overlay_needs_physical = 1,
  236. .hws_needs_physical = 1,
  237. .unfenced_needs_alignment = 1,
  238. };
  239. static const struct intel_device_info i915gm_info = {
  240. GEN3_FEATURES,
  241. PLATFORM(INTEL_I915GM),
  242. .is_mobile = 1,
  243. .display.cursor_needs_physical = 1,
  244. .display.has_overlay = 1,
  245. .display.overlay_needs_physical = 1,
  246. .display.supports_tv = 1,
  247. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  248. .hws_needs_physical = 1,
  249. .unfenced_needs_alignment = 1,
  250. };
  251. static const struct intel_device_info i945g_info = {
  252. GEN3_FEATURES,
  253. PLATFORM(INTEL_I945G),
  254. .display.has_hotplug = 1,
  255. .display.cursor_needs_physical = 1,
  256. .display.has_overlay = 1,
  257. .display.overlay_needs_physical = 1,
  258. .hws_needs_physical = 1,
  259. .unfenced_needs_alignment = 1,
  260. };
  261. static const struct intel_device_info i945gm_info = {
  262. GEN3_FEATURES,
  263. PLATFORM(INTEL_I945GM),
  264. .is_mobile = 1,
  265. .display.has_hotplug = 1,
  266. .display.cursor_needs_physical = 1,
  267. .display.has_overlay = 1,
  268. .display.overlay_needs_physical = 1,
  269. .display.supports_tv = 1,
  270. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  271. .hws_needs_physical = 1,
  272. .unfenced_needs_alignment = 1,
  273. };
  274. static const struct intel_device_info g33_info = {
  275. GEN3_FEATURES,
  276. PLATFORM(INTEL_G33),
  277. .display.has_hotplug = 1,
  278. .display.has_overlay = 1,
  279. .dma_mask_size = 36,
  280. };
  281. static const struct intel_device_info pnv_g_info = {
  282. GEN3_FEATURES,
  283. PLATFORM(INTEL_PINEVIEW),
  284. .display.has_hotplug = 1,
  285. .display.has_overlay = 1,
  286. .dma_mask_size = 36,
  287. };
  288. static const struct intel_device_info pnv_m_info = {
  289. GEN3_FEATURES,
  290. PLATFORM(INTEL_PINEVIEW),
  291. .is_mobile = 1,
  292. .display.has_hotplug = 1,
  293. .display.has_overlay = 1,
  294. .dma_mask_size = 36,
  295. };
  296. #define GEN4_FEATURES \
  297. GEN(4), \
  298. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
  299. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
  300. .display.has_hotplug = 1, \
  301. .display.has_gmch = 1, \
  302. .gpu_reset_clobbers_display = true, \
  303. .__runtime.platform_engine_mask = BIT(RCS0), \
  304. .has_3d_pipeline = 1, \
  305. .has_snoop = true, \
  306. .has_coherent_ggtt = true, \
  307. .dma_mask_size = 36, \
  308. I9XX_PIPE_OFFSETS, \
  309. I9XX_CURSOR_OFFSETS, \
  310. I965_COLORS, \
  311. GEN_DEFAULT_PAGE_SIZES, \
  312. GEN_DEFAULT_REGIONS
  313. static const struct intel_device_info i965g_info = {
  314. GEN4_FEATURES,
  315. PLATFORM(INTEL_I965G),
  316. .display.has_overlay = 1,
  317. .hws_needs_physical = 1,
  318. .has_snoop = false,
  319. };
  320. static const struct intel_device_info i965gm_info = {
  321. GEN4_FEATURES,
  322. PLATFORM(INTEL_I965GM),
  323. .is_mobile = 1,
  324. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  325. .display.has_overlay = 1,
  326. .display.supports_tv = 1,
  327. .hws_needs_physical = 1,
  328. .has_snoop = false,
  329. };
  330. static const struct intel_device_info g45_info = {
  331. GEN4_FEATURES,
  332. PLATFORM(INTEL_G45),
  333. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0),
  334. .gpu_reset_clobbers_display = false,
  335. };
  336. static const struct intel_device_info gm45_info = {
  337. GEN4_FEATURES,
  338. PLATFORM(INTEL_GM45),
  339. .is_mobile = 1,
  340. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  341. .display.supports_tv = 1,
  342. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0),
  343. .gpu_reset_clobbers_display = false,
  344. };
  345. #define GEN5_FEATURES \
  346. GEN(5), \
  347. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
  348. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
  349. .display.has_hotplug = 1, \
  350. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0), \
  351. .has_3d_pipeline = 1, \
  352. .has_snoop = true, \
  353. .has_coherent_ggtt = true, \
  354. /* ilk does support rc6, but we do not implement [power] contexts */ \
  355. .has_rc6 = 0, \
  356. .dma_mask_size = 36, \
  357. I9XX_PIPE_OFFSETS, \
  358. I9XX_CURSOR_OFFSETS, \
  359. ILK_COLORS, \
  360. GEN_DEFAULT_PAGE_SIZES, \
  361. GEN_DEFAULT_REGIONS
  362. static const struct intel_device_info ilk_d_info = {
  363. GEN5_FEATURES,
  364. PLATFORM(INTEL_IRONLAKE),
  365. };
  366. static const struct intel_device_info ilk_m_info = {
  367. GEN5_FEATURES,
  368. PLATFORM(INTEL_IRONLAKE),
  369. .is_mobile = 1,
  370. .has_rps = true,
  371. .__runtime.fbc_mask = BIT(INTEL_FBC_A),
  372. };
  373. #define GEN6_FEATURES \
  374. GEN(6), \
  375. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B), \
  376. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B), \
  377. .display.has_hotplug = 1, \
  378. .__runtime.fbc_mask = BIT(INTEL_FBC_A), \
  379. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0), \
  380. .has_3d_pipeline = 1, \
  381. .has_coherent_ggtt = true, \
  382. .has_llc = 1, \
  383. .has_rc6 = 1, \
  384. /* snb does support rc6p, but enabling it causes various issues */ \
  385. .has_rc6p = 0, \
  386. .has_rps = true, \
  387. .dma_mask_size = 40, \
  388. .__runtime.ppgtt_type = INTEL_PPGTT_ALIASING, \
  389. .__runtime.ppgtt_size = 31, \
  390. I9XX_PIPE_OFFSETS, \
  391. I9XX_CURSOR_OFFSETS, \
  392. ILK_COLORS, \
  393. GEN_DEFAULT_PAGE_SIZES, \
  394. GEN_DEFAULT_REGIONS
  395. #define SNB_D_PLATFORM \
  396. GEN6_FEATURES, \
  397. PLATFORM(INTEL_SANDYBRIDGE)
  398. static const struct intel_device_info snb_d_gt1_info = {
  399. SNB_D_PLATFORM,
  400. .gt = 1,
  401. };
  402. static const struct intel_device_info snb_d_gt2_info = {
  403. SNB_D_PLATFORM,
  404. .gt = 2,
  405. };
  406. #define SNB_M_PLATFORM \
  407. GEN6_FEATURES, \
  408. PLATFORM(INTEL_SANDYBRIDGE), \
  409. .is_mobile = 1
  410. static const struct intel_device_info snb_m_gt1_info = {
  411. SNB_M_PLATFORM,
  412. .gt = 1,
  413. };
  414. static const struct intel_device_info snb_m_gt2_info = {
  415. SNB_M_PLATFORM,
  416. .gt = 2,
  417. };
  418. #define GEN7_FEATURES \
  419. GEN(7), \
  420. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C), \
  421. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | BIT(TRANSCODER_C), \
  422. .display.has_hotplug = 1, \
  423. .__runtime.fbc_mask = BIT(INTEL_FBC_A), \
  424. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0), \
  425. .has_3d_pipeline = 1, \
  426. .has_coherent_ggtt = true, \
  427. .has_llc = 1, \
  428. .has_rc6 = 1, \
  429. .has_rc6p = 1, \
  430. .has_reset_engine = true, \
  431. .has_rps = true, \
  432. .dma_mask_size = 40, \
  433. .__runtime.ppgtt_type = INTEL_PPGTT_ALIASING, \
  434. .__runtime.ppgtt_size = 31, \
  435. IVB_PIPE_OFFSETS, \
  436. IVB_CURSOR_OFFSETS, \
  437. IVB_COLORS, \
  438. GEN_DEFAULT_PAGE_SIZES, \
  439. GEN_DEFAULT_REGIONS
  440. #define IVB_D_PLATFORM \
  441. GEN7_FEATURES, \
  442. PLATFORM(INTEL_IVYBRIDGE), \
  443. .has_l3_dpf = 1
  444. static const struct intel_device_info ivb_d_gt1_info = {
  445. IVB_D_PLATFORM,
  446. .gt = 1,
  447. };
  448. static const struct intel_device_info ivb_d_gt2_info = {
  449. IVB_D_PLATFORM,
  450. .gt = 2,
  451. };
  452. #define IVB_M_PLATFORM \
  453. GEN7_FEATURES, \
  454. PLATFORM(INTEL_IVYBRIDGE), \
  455. .is_mobile = 1, \
  456. .has_l3_dpf = 1
  457. static const struct intel_device_info ivb_m_gt1_info = {
  458. IVB_M_PLATFORM,
  459. .gt = 1,
  460. };
  461. static const struct intel_device_info ivb_m_gt2_info = {
  462. IVB_M_PLATFORM,
  463. .gt = 2,
  464. };
  465. static const struct intel_device_info ivb_q_info = {
  466. GEN7_FEATURES,
  467. PLATFORM(INTEL_IVYBRIDGE),
  468. NO_DISPLAY,
  469. .gt = 2,
  470. .has_l3_dpf = 1,
  471. };
  472. static const struct intel_device_info vlv_info = {
  473. PLATFORM(INTEL_VALLEYVIEW),
  474. GEN(7),
  475. .is_lp = 1,
  476. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B),
  477. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B),
  478. .has_runtime_pm = 1,
  479. .has_rc6 = 1,
  480. .has_reset_engine = true,
  481. .has_rps = true,
  482. .display.has_gmch = 1,
  483. .display.has_hotplug = 1,
  484. .dma_mask_size = 40,
  485. .__runtime.ppgtt_type = INTEL_PPGTT_ALIASING,
  486. .__runtime.ppgtt_size = 31,
  487. .has_snoop = true,
  488. .has_coherent_ggtt = false,
  489. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0),
  490. .display.mmio_offset = VLV_DISPLAY_BASE,
  491. I9XX_PIPE_OFFSETS,
  492. I9XX_CURSOR_OFFSETS,
  493. I965_COLORS,
  494. GEN_DEFAULT_PAGE_SIZES,
  495. GEN_DEFAULT_REGIONS,
  496. };
  497. #define G75_FEATURES \
  498. GEN7_FEATURES, \
  499. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
  500. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
  501. BIT(TRANSCODER_C) | BIT(TRANSCODER_EDP), \
  502. .display.has_ddi = 1, \
  503. .display.has_fpga_dbg = 1, \
  504. .display.has_dp_mst = 1, \
  505. .has_rc6p = 0 /* RC6p removed-by HSW */, \
  506. HSW_PIPE_OFFSETS, \
  507. .has_runtime_pm = 1
  508. #define HSW_PLATFORM \
  509. G75_FEATURES, \
  510. PLATFORM(INTEL_HASWELL), \
  511. .has_l3_dpf = 1
  512. static const struct intel_device_info hsw_gt1_info = {
  513. HSW_PLATFORM,
  514. .gt = 1,
  515. };
  516. static const struct intel_device_info hsw_gt2_info = {
  517. HSW_PLATFORM,
  518. .gt = 2,
  519. };
  520. static const struct intel_device_info hsw_gt3_info = {
  521. HSW_PLATFORM,
  522. .gt = 3,
  523. };
  524. #define GEN8_FEATURES \
  525. G75_FEATURES, \
  526. GEN(8), \
  527. .has_logical_ring_contexts = 1, \
  528. .dma_mask_size = 39, \
  529. .__runtime.ppgtt_type = INTEL_PPGTT_FULL, \
  530. .__runtime.ppgtt_size = 48, \
  531. .has_64bit_reloc = 1
  532. #define BDW_PLATFORM \
  533. GEN8_FEATURES, \
  534. PLATFORM(INTEL_BROADWELL)
  535. static const struct intel_device_info bdw_gt1_info = {
  536. BDW_PLATFORM,
  537. .gt = 1,
  538. };
  539. static const struct intel_device_info bdw_gt2_info = {
  540. BDW_PLATFORM,
  541. .gt = 2,
  542. };
  543. static const struct intel_device_info bdw_rsvd_info = {
  544. BDW_PLATFORM,
  545. .gt = 3,
  546. /* According to the device ID those devices are GT3, they were
  547. * previously treated as not GT3, keep it like that.
  548. */
  549. };
  550. static const struct intel_device_info bdw_gt3_info = {
  551. BDW_PLATFORM,
  552. .gt = 3,
  553. .__runtime.platform_engine_mask =
  554. BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
  555. };
  556. static const struct intel_device_info chv_info = {
  557. PLATFORM(INTEL_CHERRYVIEW),
  558. GEN(8),
  559. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C),
  560. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | BIT(TRANSCODER_C),
  561. .display.has_hotplug = 1,
  562. .is_lp = 1,
  563. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0),
  564. .has_64bit_reloc = 1,
  565. .has_runtime_pm = 1,
  566. .has_rc6 = 1,
  567. .has_rps = true,
  568. .has_logical_ring_contexts = 1,
  569. .display.has_gmch = 1,
  570. .dma_mask_size = 39,
  571. .__runtime.ppgtt_type = INTEL_PPGTT_FULL,
  572. .__runtime.ppgtt_size = 32,
  573. .has_reset_engine = 1,
  574. .has_snoop = true,
  575. .has_coherent_ggtt = false,
  576. .display.mmio_offset = VLV_DISPLAY_BASE,
  577. CHV_PIPE_OFFSETS,
  578. CHV_CURSOR_OFFSETS,
  579. CHV_COLORS,
  580. GEN_DEFAULT_PAGE_SIZES,
  581. GEN_DEFAULT_REGIONS,
  582. };
  583. #define GEN9_DEFAULT_PAGE_SIZES \
  584. .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K | \
  585. I915_GTT_PAGE_SIZE_64K
  586. #define GEN9_FEATURES \
  587. GEN8_FEATURES, \
  588. GEN(9), \
  589. GEN9_DEFAULT_PAGE_SIZES, \
  590. .__runtime.has_dmc = 1, \
  591. .has_gt_uc = 1, \
  592. .__runtime.has_hdcp = 1, \
  593. .display.has_ipc = 1, \
  594. .display.has_psr = 1, \
  595. .display.has_psr_hw_tracking = 1, \
  596. .display.dbuf.size = 896 - 4, /* 4 blocks for bypass path allocation */ \
  597. .display.dbuf.slice_mask = BIT(DBUF_S1)
  598. #define SKL_PLATFORM \
  599. GEN9_FEATURES, \
  600. PLATFORM(INTEL_SKYLAKE)
  601. static const struct intel_device_info skl_gt1_info = {
  602. SKL_PLATFORM,
  603. .gt = 1,
  604. };
  605. static const struct intel_device_info skl_gt2_info = {
  606. SKL_PLATFORM,
  607. .gt = 2,
  608. };
  609. #define SKL_GT3_PLUS_PLATFORM \
  610. SKL_PLATFORM, \
  611. .__runtime.platform_engine_mask = \
  612. BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1)
  613. static const struct intel_device_info skl_gt3_info = {
  614. SKL_GT3_PLUS_PLATFORM,
  615. .gt = 3,
  616. };
  617. static const struct intel_device_info skl_gt4_info = {
  618. SKL_GT3_PLUS_PLATFORM,
  619. .gt = 4,
  620. };
  621. #define GEN9_LP_FEATURES \
  622. GEN(9), \
  623. .is_lp = 1, \
  624. .display.dbuf.slice_mask = BIT(DBUF_S1), \
  625. .display.has_hotplug = 1, \
  626. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
  627. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C), \
  628. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
  629. BIT(TRANSCODER_C) | BIT(TRANSCODER_EDP) | \
  630. BIT(TRANSCODER_DSI_A) | BIT(TRANSCODER_DSI_C), \
  631. .has_3d_pipeline = 1, \
  632. .has_64bit_reloc = 1, \
  633. .display.has_ddi = 1, \
  634. .display.has_fpga_dbg = 1, \
  635. .__runtime.fbc_mask = BIT(INTEL_FBC_A), \
  636. .__runtime.has_hdcp = 1, \
  637. .display.has_psr = 1, \
  638. .display.has_psr_hw_tracking = 1, \
  639. .has_runtime_pm = 1, \
  640. .__runtime.has_dmc = 1, \
  641. .has_rc6 = 1, \
  642. .has_rps = true, \
  643. .display.has_dp_mst = 1, \
  644. .has_logical_ring_contexts = 1, \
  645. .has_gt_uc = 1, \
  646. .dma_mask_size = 39, \
  647. .__runtime.ppgtt_type = INTEL_PPGTT_FULL, \
  648. .__runtime.ppgtt_size = 48, \
  649. .has_reset_engine = 1, \
  650. .has_snoop = true, \
  651. .has_coherent_ggtt = false, \
  652. .display.has_ipc = 1, \
  653. HSW_PIPE_OFFSETS, \
  654. IVB_CURSOR_OFFSETS, \
  655. IVB_COLORS, \
  656. GEN9_DEFAULT_PAGE_SIZES, \
  657. GEN_DEFAULT_REGIONS
  658. static const struct intel_device_info bxt_info = {
  659. GEN9_LP_FEATURES,
  660. PLATFORM(INTEL_BROXTON),
  661. .display.dbuf.size = 512 - 4, /* 4 blocks for bypass path allocation */
  662. };
  663. static const struct intel_device_info glk_info = {
  664. GEN9_LP_FEATURES,
  665. PLATFORM(INTEL_GEMINILAKE),
  666. .__runtime.display.ip.ver = 10,
  667. .display.dbuf.size = 1024 - 4, /* 4 blocks for bypass path allocation */
  668. GLK_COLORS,
  669. };
  670. #define KBL_PLATFORM \
  671. GEN9_FEATURES, \
  672. PLATFORM(INTEL_KABYLAKE)
  673. static const struct intel_device_info kbl_gt1_info = {
  674. KBL_PLATFORM,
  675. .gt = 1,
  676. };
  677. static const struct intel_device_info kbl_gt2_info = {
  678. KBL_PLATFORM,
  679. .gt = 2,
  680. };
  681. static const struct intel_device_info kbl_gt3_info = {
  682. KBL_PLATFORM,
  683. .gt = 3,
  684. .__runtime.platform_engine_mask =
  685. BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
  686. };
  687. #define CFL_PLATFORM \
  688. GEN9_FEATURES, \
  689. PLATFORM(INTEL_COFFEELAKE)
  690. static const struct intel_device_info cfl_gt1_info = {
  691. CFL_PLATFORM,
  692. .gt = 1,
  693. };
  694. static const struct intel_device_info cfl_gt2_info = {
  695. CFL_PLATFORM,
  696. .gt = 2,
  697. };
  698. static const struct intel_device_info cfl_gt3_info = {
  699. CFL_PLATFORM,
  700. .gt = 3,
  701. .__runtime.platform_engine_mask =
  702. BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS1),
  703. };
  704. #define CML_PLATFORM \
  705. GEN9_FEATURES, \
  706. PLATFORM(INTEL_COMETLAKE)
  707. static const struct intel_device_info cml_gt1_info = {
  708. CML_PLATFORM,
  709. .gt = 1,
  710. };
  711. static const struct intel_device_info cml_gt2_info = {
  712. CML_PLATFORM,
  713. .gt = 2,
  714. };
  715. #define GEN11_DEFAULT_PAGE_SIZES \
  716. .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K | \
  717. I915_GTT_PAGE_SIZE_64K | \
  718. I915_GTT_PAGE_SIZE_2M
  719. #define GEN11_FEATURES \
  720. GEN9_FEATURES, \
  721. GEN11_DEFAULT_PAGE_SIZES, \
  722. .display.abox_mask = BIT(0), \
  723. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
  724. BIT(TRANSCODER_C) | BIT(TRANSCODER_EDP) | \
  725. BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1), \
  726. .display.pipe_offsets = { \
  727. [TRANSCODER_A] = PIPE_A_OFFSET, \
  728. [TRANSCODER_B] = PIPE_B_OFFSET, \
  729. [TRANSCODER_C] = PIPE_C_OFFSET, \
  730. [TRANSCODER_EDP] = PIPE_EDP_OFFSET, \
  731. [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
  732. [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
  733. }, \
  734. .display.trans_offsets = { \
  735. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  736. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  737. [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
  738. [TRANSCODER_EDP] = TRANSCODER_EDP_OFFSET, \
  739. [TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
  740. [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
  741. }, \
  742. GEN(11), \
  743. ICL_COLORS, \
  744. .display.dbuf.size = 2048, \
  745. .display.dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2), \
  746. .__runtime.has_dsc = 1, \
  747. .has_coherent_ggtt = false, \
  748. .has_logical_ring_elsq = 1
  749. static const struct intel_device_info icl_info = {
  750. GEN11_FEATURES,
  751. PLATFORM(INTEL_ICELAKE),
  752. .__runtime.platform_engine_mask =
  753. BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
  754. };
  755. static const struct intel_device_info ehl_info = {
  756. GEN11_FEATURES,
  757. PLATFORM(INTEL_ELKHARTLAKE),
  758. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(VCS0) | BIT(VECS0),
  759. .__runtime.ppgtt_size = 36,
  760. };
  761. static const struct intel_device_info jsl_info = {
  762. GEN11_FEATURES,
  763. PLATFORM(INTEL_JASPERLAKE),
  764. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(VCS0) | BIT(VECS0),
  765. .__runtime.ppgtt_size = 36,
  766. };
  767. #define GEN12_FEATURES \
  768. GEN11_FEATURES, \
  769. GEN(12), \
  770. .display.abox_mask = GENMASK(2, 1), \
  771. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), \
  772. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) | \
  773. BIT(TRANSCODER_C) | BIT(TRANSCODER_D) | \
  774. BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1), \
  775. .display.pipe_offsets = { \
  776. [TRANSCODER_A] = PIPE_A_OFFSET, \
  777. [TRANSCODER_B] = PIPE_B_OFFSET, \
  778. [TRANSCODER_C] = PIPE_C_OFFSET, \
  779. [TRANSCODER_D] = PIPE_D_OFFSET, \
  780. [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
  781. [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
  782. }, \
  783. .display.trans_offsets = { \
  784. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  785. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  786. [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
  787. [TRANSCODER_D] = TRANSCODER_D_OFFSET, \
  788. [TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
  789. [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
  790. }, \
  791. TGL_CURSOR_OFFSETS, \
  792. .has_global_mocs = 1, \
  793. .has_pxp = 1, \
  794. .display.has_dsb = 0 /* FIXME: LUT load is broken with DSB */
  795. static const struct intel_device_info tgl_info = {
  796. GEN12_FEATURES,
  797. PLATFORM(INTEL_TIGERLAKE),
  798. .display.has_modular_fia = 1,
  799. .__runtime.platform_engine_mask =
  800. BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
  801. };
  802. static const struct intel_device_info rkl_info = {
  803. GEN12_FEATURES,
  804. PLATFORM(INTEL_ROCKETLAKE),
  805. .display.abox_mask = BIT(0),
  806. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C),
  807. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
  808. BIT(TRANSCODER_C),
  809. .display.has_hti = 1,
  810. .display.has_psr_hw_tracking = 0,
  811. .__runtime.platform_engine_mask =
  812. BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0),
  813. };
  814. #define DGFX_FEATURES \
  815. .__runtime.memory_regions = REGION_SMEM | REGION_LMEM | REGION_STOLEN_LMEM, \
  816. .has_llc = 0, \
  817. .has_pxp = 0, \
  818. .has_snoop = 1, \
  819. .is_dgfx = 1, \
  820. .has_heci_gscfi = 1
  821. static const struct intel_device_info dg1_info = {
  822. GEN12_FEATURES,
  823. DGFX_FEATURES,
  824. .__runtime.graphics.ip.rel = 10,
  825. PLATFORM(INTEL_DG1),
  826. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D),
  827. .require_force_probe = 1,
  828. .__runtime.platform_engine_mask =
  829. BIT(RCS0) | BIT(BCS0) | BIT(VECS0) |
  830. BIT(VCS0) | BIT(VCS2),
  831. /* Wa_16011227922 */
  832. .__runtime.ppgtt_size = 47,
  833. };
  834. static const struct intel_device_info adl_s_info = {
  835. GEN12_FEATURES,
  836. PLATFORM(INTEL_ALDERLAKE_S),
  837. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D),
  838. .display.has_hti = 1,
  839. .display.has_psr_hw_tracking = 0,
  840. .__runtime.platform_engine_mask =
  841. BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
  842. .dma_mask_size = 39,
  843. };
  844. #define XE_LPD_FEATURES \
  845. .display.abox_mask = GENMASK(1, 0), \
  846. .display.color = { \
  847. .degamma_lut_size = 128, .gamma_lut_size = 1024, \
  848. .degamma_lut_tests = DRM_COLOR_LUT_NON_DECREASING | \
  849. DRM_COLOR_LUT_EQUAL_CHANNELS, \
  850. }, \
  851. .display.dbuf.size = 4096, \
  852. .display.dbuf.slice_mask = BIT(DBUF_S1) | BIT(DBUF_S2) | BIT(DBUF_S3) | \
  853. BIT(DBUF_S4), \
  854. .display.has_ddi = 1, \
  855. .__runtime.has_dmc = 1, \
  856. .display.has_dp_mst = 1, \
  857. .display.has_dsb = 1, \
  858. .__runtime.has_dsc = 1, \
  859. .__runtime.fbc_mask = BIT(INTEL_FBC_A), \
  860. .display.has_fpga_dbg = 1, \
  861. .__runtime.has_hdcp = 1, \
  862. .display.has_hotplug = 1, \
  863. .display.has_ipc = 1, \
  864. .display.has_psr = 1, \
  865. .__runtime.display.ip.ver = 13, \
  866. .__runtime.pipe_mask = BIT(PIPE_A) | BIT(PIPE_B) | BIT(PIPE_C) | BIT(PIPE_D), \
  867. .display.pipe_offsets = { \
  868. [TRANSCODER_A] = PIPE_A_OFFSET, \
  869. [TRANSCODER_B] = PIPE_B_OFFSET, \
  870. [TRANSCODER_C] = PIPE_C_OFFSET, \
  871. [TRANSCODER_D] = PIPE_D_OFFSET, \
  872. [TRANSCODER_DSI_0] = PIPE_DSI0_OFFSET, \
  873. [TRANSCODER_DSI_1] = PIPE_DSI1_OFFSET, \
  874. }, \
  875. .display.trans_offsets = { \
  876. [TRANSCODER_A] = TRANSCODER_A_OFFSET, \
  877. [TRANSCODER_B] = TRANSCODER_B_OFFSET, \
  878. [TRANSCODER_C] = TRANSCODER_C_OFFSET, \
  879. [TRANSCODER_D] = TRANSCODER_D_OFFSET, \
  880. [TRANSCODER_DSI_0] = TRANSCODER_DSI0_OFFSET, \
  881. [TRANSCODER_DSI_1] = TRANSCODER_DSI1_OFFSET, \
  882. }, \
  883. TGL_CURSOR_OFFSETS
  884. static const struct intel_device_info adl_p_info = {
  885. GEN12_FEATURES,
  886. XE_LPD_FEATURES,
  887. PLATFORM(INTEL_ALDERLAKE_P),
  888. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
  889. BIT(TRANSCODER_C) | BIT(TRANSCODER_D) |
  890. BIT(TRANSCODER_DSI_0) | BIT(TRANSCODER_DSI_1),
  891. .display.has_cdclk_crawl = 1,
  892. .display.has_modular_fia = 1,
  893. .display.has_psr_hw_tracking = 0,
  894. .__runtime.platform_engine_mask =
  895. BIT(RCS0) | BIT(BCS0) | BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
  896. .__runtime.ppgtt_size = 48,
  897. .dma_mask_size = 39,
  898. };
  899. #undef GEN
  900. #define XE_HP_PAGE_SIZES \
  901. .__runtime.page_sizes = I915_GTT_PAGE_SIZE_4K | \
  902. I915_GTT_PAGE_SIZE_64K | \
  903. I915_GTT_PAGE_SIZE_2M
  904. #define XE_HP_FEATURES \
  905. .__runtime.graphics.ip.ver = 12, \
  906. .__runtime.graphics.ip.rel = 50, \
  907. XE_HP_PAGE_SIZES, \
  908. .dma_mask_size = 46, \
  909. .has_3d_pipeline = 1, \
  910. .has_64bit_reloc = 1, \
  911. .has_flat_ccs = 1, \
  912. .has_global_mocs = 1, \
  913. .has_gt_uc = 1, \
  914. .has_llc = 1, \
  915. .has_logical_ring_contexts = 1, \
  916. .has_logical_ring_elsq = 1, \
  917. .has_mslice_steering = 1, \
  918. .has_rc6 = 1, \
  919. .has_reset_engine = 1, \
  920. .has_rps = 1, \
  921. .has_runtime_pm = 1, \
  922. .__runtime.ppgtt_size = 48, \
  923. .__runtime.ppgtt_type = INTEL_PPGTT_FULL
  924. #define XE_HPM_FEATURES \
  925. .__runtime.media.ip.ver = 12, \
  926. .__runtime.media.ip.rel = 50
  927. __maybe_unused
  928. static const struct intel_device_info xehpsdv_info = {
  929. XE_HP_FEATURES,
  930. XE_HPM_FEATURES,
  931. DGFX_FEATURES,
  932. PLATFORM(INTEL_XEHPSDV),
  933. NO_DISPLAY,
  934. .has_64k_pages = 1,
  935. .needs_compact_pt = 1,
  936. .has_media_ratio_mode = 1,
  937. .__runtime.platform_engine_mask =
  938. BIT(RCS0) | BIT(BCS0) |
  939. BIT(VECS0) | BIT(VECS1) | BIT(VECS2) | BIT(VECS3) |
  940. BIT(VCS0) | BIT(VCS1) | BIT(VCS2) | BIT(VCS3) |
  941. BIT(VCS4) | BIT(VCS5) | BIT(VCS6) | BIT(VCS7) |
  942. BIT(CCS0) | BIT(CCS1) | BIT(CCS2) | BIT(CCS3),
  943. .require_force_probe = 1,
  944. };
  945. #define DG2_FEATURES \
  946. XE_HP_FEATURES, \
  947. XE_HPM_FEATURES, \
  948. DGFX_FEATURES, \
  949. .__runtime.graphics.ip.rel = 55, \
  950. .__runtime.media.ip.rel = 55, \
  951. PLATFORM(INTEL_DG2), \
  952. .has_4tile = 1, \
  953. .has_64k_pages = 1, \
  954. .has_guc_deprivilege = 1, \
  955. .has_heci_pxp = 1, \
  956. .needs_compact_pt = 1, \
  957. .has_media_ratio_mode = 1, \
  958. .__runtime.platform_engine_mask = \
  959. BIT(RCS0) | BIT(BCS0) | \
  960. BIT(VECS0) | BIT(VECS1) | \
  961. BIT(VCS0) | BIT(VCS2) | \
  962. BIT(CCS0) | BIT(CCS1) | BIT(CCS2) | BIT(CCS3)
  963. static const struct intel_device_info dg2_info = {
  964. DG2_FEATURES,
  965. XE_LPD_FEATURES,
  966. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
  967. BIT(TRANSCODER_C) | BIT(TRANSCODER_D),
  968. .require_force_probe = 1,
  969. };
  970. static const struct intel_device_info ats_m_info = {
  971. DG2_FEATURES,
  972. NO_DISPLAY,
  973. .require_force_probe = 1,
  974. .tuning_thread_rr_after_dep = 1,
  975. };
  976. #define XE_HPC_FEATURES \
  977. XE_HP_FEATURES, \
  978. .dma_mask_size = 52, \
  979. .has_3d_pipeline = 0, \
  980. .has_guc_deprivilege = 1, \
  981. .has_l3_ccs_read = 1, \
  982. .has_mslice_steering = 0, \
  983. .has_one_eu_per_fuse_bit = 1
  984. __maybe_unused
  985. static const struct intel_device_info pvc_info = {
  986. XE_HPC_FEATURES,
  987. XE_HPM_FEATURES,
  988. DGFX_FEATURES,
  989. .__runtime.graphics.ip.rel = 60,
  990. .__runtime.media.ip.rel = 60,
  991. PLATFORM(INTEL_PONTEVECCHIO),
  992. NO_DISPLAY,
  993. .has_flat_ccs = 0,
  994. .__runtime.platform_engine_mask =
  995. BIT(BCS0) |
  996. BIT(VCS0) |
  997. BIT(CCS0) | BIT(CCS1) | BIT(CCS2) | BIT(CCS3),
  998. .require_force_probe = 1,
  999. };
  1000. #define XE_LPDP_FEATURES \
  1001. XE_LPD_FEATURES, \
  1002. .__runtime.display.ip.ver = 14, \
  1003. .display.has_cdclk_crawl = 1, \
  1004. .__runtime.fbc_mask = BIT(INTEL_FBC_A) | BIT(INTEL_FBC_B)
  1005. static const struct intel_gt_definition xelpmp_extra_gt[] = {
  1006. {
  1007. .type = GT_MEDIA,
  1008. .name = "Standalone Media GT",
  1009. .gsi_offset = MTL_MEDIA_GSI_BASE,
  1010. .engine_mask = BIT(VECS0) | BIT(VCS0) | BIT(VCS2),
  1011. },
  1012. {}
  1013. };
  1014. static const struct intel_device_info mtl_info = {
  1015. XE_HP_FEATURES,
  1016. XE_LPDP_FEATURES,
  1017. .__runtime.cpu_transcoder_mask = BIT(TRANSCODER_A) | BIT(TRANSCODER_B) |
  1018. BIT(TRANSCODER_C) | BIT(TRANSCODER_D),
  1019. /*
  1020. * Real graphics IP version will be obtained from hardware GMD_ID
  1021. * register. Value provided here is just for sanity checking.
  1022. */
  1023. .__runtime.graphics.ip.ver = 12,
  1024. .__runtime.graphics.ip.rel = 70,
  1025. .__runtime.media.ip.ver = 13,
  1026. PLATFORM(INTEL_METEORLAKE),
  1027. .display.has_modular_fia = 1,
  1028. .extra_gt_list = xelpmp_extra_gt,
  1029. .has_flat_ccs = 0,
  1030. .has_snoop = 1,
  1031. .__runtime.memory_regions = REGION_SMEM | REGION_STOLEN_LMEM,
  1032. .__runtime.platform_engine_mask = BIT(RCS0) | BIT(BCS0) | BIT(CCS0),
  1033. .require_force_probe = 1,
  1034. };
  1035. #undef PLATFORM
  1036. /*
  1037. * Make sure any device matches here are from most specific to most
  1038. * general. For example, since the Quanta match is based on the subsystem
  1039. * and subvendor IDs, we need it to come before the more general IVB
  1040. * PCI ID matches, otherwise we'll use the wrong info struct above.
  1041. */
  1042. static const struct pci_device_id pciidlist[] = {
  1043. INTEL_I830_IDS(&i830_info),
  1044. INTEL_I845G_IDS(&i845g_info),
  1045. INTEL_I85X_IDS(&i85x_info),
  1046. INTEL_I865G_IDS(&i865g_info),
  1047. INTEL_I915G_IDS(&i915g_info),
  1048. INTEL_I915GM_IDS(&i915gm_info),
  1049. INTEL_I945G_IDS(&i945g_info),
  1050. INTEL_I945GM_IDS(&i945gm_info),
  1051. INTEL_I965G_IDS(&i965g_info),
  1052. INTEL_G33_IDS(&g33_info),
  1053. INTEL_I965GM_IDS(&i965gm_info),
  1054. INTEL_GM45_IDS(&gm45_info),
  1055. INTEL_G45_IDS(&g45_info),
  1056. INTEL_PINEVIEW_G_IDS(&pnv_g_info),
  1057. INTEL_PINEVIEW_M_IDS(&pnv_m_info),
  1058. INTEL_IRONLAKE_D_IDS(&ilk_d_info),
  1059. INTEL_IRONLAKE_M_IDS(&ilk_m_info),
  1060. INTEL_SNB_D_GT1_IDS(&snb_d_gt1_info),
  1061. INTEL_SNB_D_GT2_IDS(&snb_d_gt2_info),
  1062. INTEL_SNB_M_GT1_IDS(&snb_m_gt1_info),
  1063. INTEL_SNB_M_GT2_IDS(&snb_m_gt2_info),
  1064. INTEL_IVB_Q_IDS(&ivb_q_info), /* must be first IVB */
  1065. INTEL_IVB_M_GT1_IDS(&ivb_m_gt1_info),
  1066. INTEL_IVB_M_GT2_IDS(&ivb_m_gt2_info),
  1067. INTEL_IVB_D_GT1_IDS(&ivb_d_gt1_info),
  1068. INTEL_IVB_D_GT2_IDS(&ivb_d_gt2_info),
  1069. INTEL_HSW_GT1_IDS(&hsw_gt1_info),
  1070. INTEL_HSW_GT2_IDS(&hsw_gt2_info),
  1071. INTEL_HSW_GT3_IDS(&hsw_gt3_info),
  1072. INTEL_VLV_IDS(&vlv_info),
  1073. INTEL_BDW_GT1_IDS(&bdw_gt1_info),
  1074. INTEL_BDW_GT2_IDS(&bdw_gt2_info),
  1075. INTEL_BDW_GT3_IDS(&bdw_gt3_info),
  1076. INTEL_BDW_RSVD_IDS(&bdw_rsvd_info),
  1077. INTEL_CHV_IDS(&chv_info),
  1078. INTEL_SKL_GT1_IDS(&skl_gt1_info),
  1079. INTEL_SKL_GT2_IDS(&skl_gt2_info),
  1080. INTEL_SKL_GT3_IDS(&skl_gt3_info),
  1081. INTEL_SKL_GT4_IDS(&skl_gt4_info),
  1082. INTEL_BXT_IDS(&bxt_info),
  1083. INTEL_GLK_IDS(&glk_info),
  1084. INTEL_KBL_GT1_IDS(&kbl_gt1_info),
  1085. INTEL_KBL_GT2_IDS(&kbl_gt2_info),
  1086. INTEL_KBL_GT3_IDS(&kbl_gt3_info),
  1087. INTEL_KBL_GT4_IDS(&kbl_gt3_info),
  1088. INTEL_AML_KBL_GT2_IDS(&kbl_gt2_info),
  1089. INTEL_CFL_S_GT1_IDS(&cfl_gt1_info),
  1090. INTEL_CFL_S_GT2_IDS(&cfl_gt2_info),
  1091. INTEL_CFL_H_GT1_IDS(&cfl_gt1_info),
  1092. INTEL_CFL_H_GT2_IDS(&cfl_gt2_info),
  1093. INTEL_CFL_U_GT2_IDS(&cfl_gt2_info),
  1094. INTEL_CFL_U_GT3_IDS(&cfl_gt3_info),
  1095. INTEL_WHL_U_GT1_IDS(&cfl_gt1_info),
  1096. INTEL_WHL_U_GT2_IDS(&cfl_gt2_info),
  1097. INTEL_AML_CFL_GT2_IDS(&cfl_gt2_info),
  1098. INTEL_WHL_U_GT3_IDS(&cfl_gt3_info),
  1099. INTEL_CML_GT1_IDS(&cml_gt1_info),
  1100. INTEL_CML_GT2_IDS(&cml_gt2_info),
  1101. INTEL_CML_U_GT1_IDS(&cml_gt1_info),
  1102. INTEL_CML_U_GT2_IDS(&cml_gt2_info),
  1103. INTEL_ICL_11_IDS(&icl_info),
  1104. INTEL_EHL_IDS(&ehl_info),
  1105. INTEL_JSL_IDS(&jsl_info),
  1106. INTEL_TGL_12_IDS(&tgl_info),
  1107. INTEL_RKL_IDS(&rkl_info),
  1108. INTEL_ADLS_IDS(&adl_s_info),
  1109. INTEL_ADLP_IDS(&adl_p_info),
  1110. INTEL_ADLN_IDS(&adl_p_info),
  1111. INTEL_DG1_IDS(&dg1_info),
  1112. INTEL_RPLS_IDS(&adl_s_info),
  1113. INTEL_RPLP_IDS(&adl_p_info),
  1114. INTEL_DG2_IDS(&dg2_info),
  1115. INTEL_ATS_M_IDS(&ats_m_info),
  1116. INTEL_MTL_IDS(&mtl_info),
  1117. {0, 0, 0}
  1118. };
  1119. MODULE_DEVICE_TABLE(pci, pciidlist);
  1120. static void i915_pci_remove(struct pci_dev *pdev)
  1121. {
  1122. struct drm_i915_private *i915;
  1123. i915 = pci_get_drvdata(pdev);
  1124. if (!i915) /* driver load aborted, nothing to cleanup */
  1125. return;
  1126. i915_driver_remove(i915);
  1127. pci_set_drvdata(pdev, NULL);
  1128. }
  1129. /* is device_id present in comma separated list of ids */
  1130. static bool device_id_in_list(u16 device_id, const char *devices, bool negative)
  1131. {
  1132. char *s, *p, *tok;
  1133. bool ret;
  1134. if (!devices || !*devices)
  1135. return false;
  1136. /* match everything */
  1137. if (negative && strcmp(devices, "!*") == 0)
  1138. return true;
  1139. if (!negative && strcmp(devices, "*") == 0)
  1140. return true;
  1141. s = kstrdup(devices, GFP_KERNEL);
  1142. if (!s)
  1143. return false;
  1144. for (p = s, ret = false; (tok = strsep(&p, ",")) != NULL; ) {
  1145. u16 val;
  1146. if (negative && tok[0] == '!')
  1147. tok++;
  1148. else if ((negative && tok[0] != '!') ||
  1149. (!negative && tok[0] == '!'))
  1150. continue;
  1151. if (kstrtou16(tok, 16, &val) == 0 && val == device_id) {
  1152. ret = true;
  1153. break;
  1154. }
  1155. }
  1156. kfree(s);
  1157. return ret;
  1158. }
  1159. static bool id_forced(u16 device_id)
  1160. {
  1161. return device_id_in_list(device_id, i915_modparams.force_probe, false);
  1162. }
  1163. static bool id_blocked(u16 device_id)
  1164. {
  1165. return device_id_in_list(device_id, i915_modparams.force_probe, true);
  1166. }
  1167. bool i915_pci_resource_valid(struct pci_dev *pdev, int bar)
  1168. {
  1169. if (!pci_resource_flags(pdev, bar))
  1170. return false;
  1171. if (pci_resource_flags(pdev, bar) & IORESOURCE_UNSET)
  1172. return false;
  1173. if (!pci_resource_len(pdev, bar))
  1174. return false;
  1175. return true;
  1176. }
  1177. static bool intel_mmio_bar_valid(struct pci_dev *pdev, struct intel_device_info *intel_info)
  1178. {
  1179. int gttmmaddr_bar = intel_info->__runtime.graphics.ip.ver == 2 ? GEN2_GTTMMADR_BAR : GTTMMADR_BAR;
  1180. return i915_pci_resource_valid(pdev, gttmmaddr_bar);
  1181. }
  1182. static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
  1183. {
  1184. struct intel_device_info *intel_info =
  1185. (struct intel_device_info *) ent->driver_data;
  1186. int err;
  1187. if (intel_info->require_force_probe && !id_forced(pdev->device)) {
  1188. dev_info(&pdev->dev,
  1189. "Your graphics device %04x is not properly supported by i915 in this\n"
  1190. "kernel version. To force driver probe anyway, use i915.force_probe=%04x\n"
  1191. "module parameter or CONFIG_DRM_I915_FORCE_PROBE=%04x configuration option,\n"
  1192. "or (recommended) check for kernel updates.\n",
  1193. pdev->device, pdev->device, pdev->device);
  1194. return -ENODEV;
  1195. }
  1196. if (id_blocked(pdev->device)) {
  1197. dev_info(&pdev->dev, "I915 probe blocked for Device ID %04x.\n",
  1198. pdev->device);
  1199. return -ENODEV;
  1200. }
  1201. if (intel_info->require_force_probe) {
  1202. dev_info(&pdev->dev, "Force probing unsupported Device ID %04x, tainting kernel\n",
  1203. pdev->device);
  1204. add_taint(TAINT_USER, LOCKDEP_STILL_OK);
  1205. }
  1206. /* Only bind to function 0 of the device. Early generations
  1207. * used function 1 as a placeholder for multi-head. This causes
  1208. * us confusion instead, especially on the systems where both
  1209. * functions have the same PCI-ID!
  1210. */
  1211. if (PCI_FUNC(pdev->devfn))
  1212. return -ENODEV;
  1213. if (!intel_mmio_bar_valid(pdev, intel_info))
  1214. return -ENXIO;
  1215. /* Detect if we need to wait for other drivers early on */
  1216. if (intel_modeset_probe_defer(pdev))
  1217. return -EPROBE_DEFER;
  1218. err = i915_driver_probe(pdev, ent);
  1219. if (err)
  1220. return err;
  1221. if (i915_inject_probe_failure(pci_get_drvdata(pdev))) {
  1222. i915_pci_remove(pdev);
  1223. return -ENODEV;
  1224. }
  1225. err = i915_live_selftests(pdev);
  1226. if (err) {
  1227. i915_pci_remove(pdev);
  1228. return err > 0 ? -ENOTTY : err;
  1229. }
  1230. err = i915_perf_selftests(pdev);
  1231. if (err) {
  1232. i915_pci_remove(pdev);
  1233. return err > 0 ? -ENOTTY : err;
  1234. }
  1235. return 0;
  1236. }
  1237. static void i915_pci_shutdown(struct pci_dev *pdev)
  1238. {
  1239. struct drm_i915_private *i915 = pci_get_drvdata(pdev);
  1240. i915_driver_shutdown(i915);
  1241. }
  1242. static struct pci_driver i915_pci_driver = {
  1243. .name = DRIVER_NAME,
  1244. .id_table = pciidlist,
  1245. .probe = i915_pci_probe,
  1246. .remove = i915_pci_remove,
  1247. .shutdown = i915_pci_shutdown,
  1248. .driver.pm = &i915_pm_ops,
  1249. };
  1250. int i915_pci_register_driver(void)
  1251. {
  1252. return pci_register_driver(&i915_pci_driver);
  1253. }
  1254. void i915_pci_unregister_driver(void)
  1255. {
  1256. pci_unregister_driver(&i915_pci_driver);
  1257. }