forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
....@@ -1316,7 +1316,7 @@
13161316 .i2c = g94_i2c_new,
13171317 .imem = nv50_instmem_new,
13181318 .mc = gt215_mc_new,
1319
- .mmu = g84_mmu_new,
1319
+ .mmu = mcp77_mmu_new,
13201320 .mxm = nv50_mxm_new,
13211321 .pci = g94_pci_new,
13221322 .pmu = gt215_pmu_new,
....@@ -1987,6 +1987,8 @@
19871987 .dma = gf119_dma_new,
19881988 .fifo = gm107_fifo_new,
19891989 .gr = gm107_gr_new,
1990
+ .nvdec[0] = gm107_nvdec_new,
1991
+ .nvenc[0] = gm107_nvenc_new,
19901992 .sw = gf100_sw_new,
19911993 };
19921994
....@@ -2027,6 +2029,7 @@
20272029 static const struct nvkm_device_chip
20282030 nv120_chipset = {
20292031 .name = "GM200",
2032
+ .acr = gm200_acr_new,
20302033 .bar = gm107_bar_new,
20312034 .bios = nvkm_bios_new,
20322035 .bus = gf100_bus_new,
....@@ -2043,9 +2046,8 @@
20432046 .mmu = gm200_mmu_new,
20442047 .mxm = nv50_mxm_new,
20452048 .pci = gk104_pci_new,
2046
- .pmu = gm107_pmu_new,
2049
+ .pmu = gm200_pmu_new,
20472050 .therm = gm200_therm_new,
2048
- .secboot = gm200_secboot_new,
20492051 .timer = gk20a_timer_new,
20502052 .top = gk104_top_new,
20512053 .volt = gk104_volt_new,
....@@ -2056,12 +2058,16 @@
20562058 .dma = gf119_dma_new,
20572059 .fifo = gm200_fifo_new,
20582060 .gr = gm200_gr_new,
2061
+ .nvdec[0] = gm107_nvdec_new,
2062
+ .nvenc[0] = gm107_nvenc_new,
2063
+ .nvenc[1] = gm107_nvenc_new,
20592064 .sw = gf100_sw_new,
20602065 };
20612066
20622067 static const struct nvkm_device_chip
20632068 nv124_chipset = {
20642069 .name = "GM204",
2070
+ .acr = gm200_acr_new,
20652071 .bar = gm107_bar_new,
20662072 .bios = nvkm_bios_new,
20672073 .bus = gf100_bus_new,
....@@ -2078,9 +2084,8 @@
20782084 .mmu = gm200_mmu_new,
20792085 .mxm = nv50_mxm_new,
20802086 .pci = gk104_pci_new,
2081
- .pmu = gm107_pmu_new,
2087
+ .pmu = gm200_pmu_new,
20822088 .therm = gm200_therm_new,
2083
- .secboot = gm200_secboot_new,
20842089 .timer = gk20a_timer_new,
20852090 .top = gk104_top_new,
20862091 .volt = gk104_volt_new,
....@@ -2091,12 +2096,16 @@
20912096 .dma = gf119_dma_new,
20922097 .fifo = gm200_fifo_new,
20932098 .gr = gm200_gr_new,
2099
+ .nvdec[0] = gm107_nvdec_new,
2100
+ .nvenc[0] = gm107_nvenc_new,
2101
+ .nvenc[1] = gm107_nvenc_new,
20942102 .sw = gf100_sw_new,
20952103 };
20962104
20972105 static const struct nvkm_device_chip
20982106 nv126_chipset = {
20992107 .name = "GM206",
2108
+ .acr = gm200_acr_new,
21002109 .bar = gm107_bar_new,
21012110 .bios = nvkm_bios_new,
21022111 .bus = gf100_bus_new,
....@@ -2113,9 +2122,8 @@
21132122 .mmu = gm200_mmu_new,
21142123 .mxm = nv50_mxm_new,
21152124 .pci = gk104_pci_new,
2116
- .pmu = gm107_pmu_new,
2125
+ .pmu = gm200_pmu_new,
21172126 .therm = gm200_therm_new,
2118
- .secboot = gm200_secboot_new,
21192127 .timer = gk20a_timer_new,
21202128 .top = gk104_top_new,
21212129 .volt = gk104_volt_new,
....@@ -2126,12 +2134,15 @@
21262134 .dma = gf119_dma_new,
21272135 .fifo = gm200_fifo_new,
21282136 .gr = gm200_gr_new,
2137
+ .nvdec[0] = gm107_nvdec_new,
2138
+ .nvenc[0] = gm107_nvenc_new,
21292139 .sw = gf100_sw_new,
21302140 };
21312141
21322142 static const struct nvkm_device_chip
21332143 nv12b_chipset = {
21342144 .name = "GM20B",
2145
+ .acr = gm20b_acr_new,
21352146 .bar = gm20b_bar_new,
21362147 .bus = gf100_bus_new,
21372148 .clk = gm20b_clk_new,
....@@ -2143,7 +2154,6 @@
21432154 .mc = gk20a_mc_new,
21442155 .mmu = gm20b_mmu_new,
21452156 .pmu = gm20b_pmu_new,
2146
- .secboot = gm20b_secboot_new,
21472157 .timer = gk20a_timer_new,
21482158 .top = gk104_top_new,
21492159 .ce[2] = gm200_ce_new,
....@@ -2157,6 +2167,7 @@
21572167 static const struct nvkm_device_chip
21582168 nv130_chipset = {
21592169 .name = "GP100",
2170
+ .acr = gm200_acr_new,
21602171 .bar = gm107_bar_new,
21612172 .bios = nvkm_bios_new,
21622173 .bus = gf100_bus_new,
....@@ -2172,9 +2183,8 @@
21722183 .mc = gp100_mc_new,
21732184 .mmu = gp100_mmu_new,
21742185 .therm = gp100_therm_new,
2175
- .secboot = gm200_secboot_new,
21762186 .pci = gp100_pci_new,
2177
- .pmu = gp100_pmu_new,
2187
+ .pmu = gm200_pmu_new,
21782188 .timer = gk20a_timer_new,
21792189 .top = gk104_top_new,
21802190 .ce[0] = gp100_ce_new,
....@@ -2187,12 +2197,17 @@
21872197 .disp = gp100_disp_new,
21882198 .fifo = gp100_fifo_new,
21892199 .gr = gp100_gr_new,
2200
+ .nvdec[0] = gm107_nvdec_new,
2201
+ .nvenc[0] = gm107_nvenc_new,
2202
+ .nvenc[1] = gm107_nvenc_new,
2203
+ .nvenc[2] = gm107_nvenc_new,
21902204 .sw = gf100_sw_new,
21912205 };
21922206
21932207 static const struct nvkm_device_chip
21942208 nv132_chipset = {
21952209 .name = "GP102",
2210
+ .acr = gp102_acr_new,
21962211 .bar = gm107_bar_new,
21972212 .bios = nvkm_bios_new,
21982213 .bus = gf100_bus_new,
....@@ -2208,7 +2223,6 @@
22082223 .mc = gp100_mc_new,
22092224 .mmu = gp100_mmu_new,
22102225 .therm = gp100_therm_new,
2211
- .secboot = gp102_secboot_new,
22122226 .pci = gp100_pci_new,
22132227 .pmu = gp102_pmu_new,
22142228 .timer = gk20a_timer_new,
....@@ -2221,7 +2235,9 @@
22212235 .dma = gf119_dma_new,
22222236 .fifo = gp100_fifo_new,
22232237 .gr = gp102_gr_new,
2224
- .nvdec = gp102_nvdec_new,
2238
+ .nvdec[0] = gm107_nvdec_new,
2239
+ .nvenc[0] = gm107_nvenc_new,
2240
+ .nvenc[1] = gm107_nvenc_new,
22252241 .sec2 = gp102_sec2_new,
22262242 .sw = gf100_sw_new,
22272243 };
....@@ -2229,6 +2245,7 @@
22292245 static const struct nvkm_device_chip
22302246 nv134_chipset = {
22312247 .name = "GP104",
2248
+ .acr = gp102_acr_new,
22322249 .bar = gm107_bar_new,
22332250 .bios = nvkm_bios_new,
22342251 .bus = gf100_bus_new,
....@@ -2244,7 +2261,6 @@
22442261 .mc = gp100_mc_new,
22452262 .mmu = gp100_mmu_new,
22462263 .therm = gp100_therm_new,
2247
- .secboot = gp102_secboot_new,
22482264 .pci = gp100_pci_new,
22492265 .pmu = gp102_pmu_new,
22502266 .timer = gk20a_timer_new,
....@@ -2257,7 +2273,9 @@
22572273 .dma = gf119_dma_new,
22582274 .fifo = gp100_fifo_new,
22592275 .gr = gp104_gr_new,
2260
- .nvdec = gp102_nvdec_new,
2276
+ .nvdec[0] = gm107_nvdec_new,
2277
+ .nvenc[0] = gm107_nvenc_new,
2278
+ .nvenc[1] = gm107_nvenc_new,
22612279 .sec2 = gp102_sec2_new,
22622280 .sw = gf100_sw_new,
22632281 };
....@@ -2265,6 +2283,7 @@
22652283 static const struct nvkm_device_chip
22662284 nv136_chipset = {
22672285 .name = "GP106",
2286
+ .acr = gp102_acr_new,
22682287 .bar = gm107_bar_new,
22692288 .bios = nvkm_bios_new,
22702289 .bus = gf100_bus_new,
....@@ -2280,7 +2299,6 @@
22802299 .mc = gp100_mc_new,
22812300 .mmu = gp100_mmu_new,
22822301 .therm = gp100_therm_new,
2283
- .secboot = gp102_secboot_new,
22842302 .pci = gp100_pci_new,
22852303 .pmu = gp102_pmu_new,
22862304 .timer = gk20a_timer_new,
....@@ -2293,7 +2311,8 @@
22932311 .dma = gf119_dma_new,
22942312 .fifo = gp100_fifo_new,
22952313 .gr = gp104_gr_new,
2296
- .nvdec = gp102_nvdec_new,
2314
+ .nvdec[0] = gm107_nvdec_new,
2315
+ .nvenc[0] = gm107_nvenc_new,
22972316 .sec2 = gp102_sec2_new,
22982317 .sw = gf100_sw_new,
22992318 };
....@@ -2301,6 +2320,7 @@
23012320 static const struct nvkm_device_chip
23022321 nv137_chipset = {
23032322 .name = "GP107",
2323
+ .acr = gp102_acr_new,
23042324 .bar = gm107_bar_new,
23052325 .bios = nvkm_bios_new,
23062326 .bus = gf100_bus_new,
....@@ -2316,7 +2336,6 @@
23162336 .mc = gp100_mc_new,
23172337 .mmu = gp100_mmu_new,
23182338 .therm = gp100_therm_new,
2319
- .secboot = gp102_secboot_new,
23202339 .pci = gp100_pci_new,
23212340 .pmu = gp102_pmu_new,
23222341 .timer = gk20a_timer_new,
....@@ -2329,7 +2348,9 @@
23292348 .dma = gf119_dma_new,
23302349 .fifo = gp100_fifo_new,
23312350 .gr = gp107_gr_new,
2332
- .nvdec = gp102_nvdec_new,
2351
+ .nvdec[0] = gm107_nvdec_new,
2352
+ .nvenc[0] = gm107_nvenc_new,
2353
+ .nvenc[1] = gm107_nvenc_new,
23332354 .sec2 = gp102_sec2_new,
23342355 .sw = gf100_sw_new,
23352356 };
....@@ -2337,6 +2358,7 @@
23372358 static const struct nvkm_device_chip
23382359 nv138_chipset = {
23392360 .name = "GP108",
2361
+ .acr = gp108_acr_new,
23402362 .bar = gm107_bar_new,
23412363 .bios = nvkm_bios_new,
23422364 .bus = gf100_bus_new,
....@@ -2352,7 +2374,6 @@
23522374 .mc = gp100_mc_new,
23532375 .mmu = gp100_mmu_new,
23542376 .therm = gp100_therm_new,
2355
- .secboot = gp108_secboot_new,
23562377 .pci = gp100_pci_new,
23572378 .pmu = gp102_pmu_new,
23582379 .timer = gk20a_timer_new,
....@@ -2364,30 +2385,30 @@
23642385 .disp = gp102_disp_new,
23652386 .dma = gf119_dma_new,
23662387 .fifo = gp100_fifo_new,
2367
- .gr = gp107_gr_new,
2368
- .nvdec = gp102_nvdec_new,
2369
- .sec2 = gp102_sec2_new,
2388
+ .gr = gp108_gr_new,
2389
+ .nvdec[0] = gm107_nvdec_new,
2390
+ .sec2 = gp108_sec2_new,
23702391 .sw = gf100_sw_new,
23712392 };
23722393
23732394 static const struct nvkm_device_chip
23742395 nv13b_chipset = {
23752396 .name = "GP10B",
2397
+ .acr = gp10b_acr_new,
23762398 .bar = gm20b_bar_new,
23772399 .bus = gf100_bus_new,
2378
- .fault = gp100_fault_new,
2400
+ .fault = gp10b_fault_new,
23792401 .fb = gp10b_fb_new,
23802402 .fuse = gm107_fuse_new,
23812403 .ibus = gp10b_ibus_new,
23822404 .imem = gk20a_instmem_new,
2383
- .ltc = gp102_ltc_new,
2405
+ .ltc = gp10b_ltc_new,
23842406 .mc = gp10b_mc_new,
23852407 .mmu = gp10b_mmu_new,
2386
- .secboot = gp10b_secboot_new,
2387
- .pmu = gm20b_pmu_new,
2408
+ .pmu = gp10b_pmu_new,
23882409 .timer = gk20a_timer_new,
23892410 .top = gk104_top_new,
2390
- .ce[2] = gp102_ce_new,
2411
+ .ce[0] = gp100_ce_new,
23912412 .dma = gf119_dma_new,
23922413 .fifo = gp10b_fifo_new,
23932414 .gr = gp10b_gr_new,
....@@ -2397,6 +2418,7 @@
23972418 static const struct nvkm_device_chip
23982419 nv140_chipset = {
23992420 .name = "GV100",
2421
+ .acr = gp108_acr_new,
24002422 .bar = gm107_bar_new,
24012423 .bios = nvkm_bios_new,
24022424 .bus = gf100_bus_new,
....@@ -2405,6 +2427,7 @@
24052427 .fb = gv100_fb_new,
24062428 .fuse = gm107_fuse_new,
24072429 .gpio = gk104_gpio_new,
2430
+ .gsp = gv100_gsp_new,
24082431 .i2c = gm200_i2c_new,
24092432 .ibus = gm200_ibus_new,
24102433 .imem = nv50_instmem_new,
....@@ -2413,7 +2436,6 @@
24132436 .mmu = gv100_mmu_new,
24142437 .pci = gp100_pci_new,
24152438 .pmu = gp102_pmu_new,
2416
- .secboot = gp108_secboot_new,
24172439 .therm = gp100_therm_new,
24182440 .timer = gk20a_timer_new,
24192441 .top = gk104_top_new,
....@@ -2430,8 +2452,204 @@
24302452 .dma = gv100_dma_new,
24312453 .fifo = gv100_fifo_new,
24322454 .gr = gv100_gr_new,
2433
- .nvdec = gp102_nvdec_new,
2434
- .sec2 = gp102_sec2_new,
2455
+ .nvdec[0] = gm107_nvdec_new,
2456
+ .nvenc[0] = gm107_nvenc_new,
2457
+ .nvenc[1] = gm107_nvenc_new,
2458
+ .nvenc[2] = gm107_nvenc_new,
2459
+ .sec2 = gp108_sec2_new,
2460
+};
2461
+
2462
+static const struct nvkm_device_chip
2463
+nv162_chipset = {
2464
+ .name = "TU102",
2465
+ .acr = tu102_acr_new,
2466
+ .bar = tu102_bar_new,
2467
+ .bios = nvkm_bios_new,
2468
+ .bus = gf100_bus_new,
2469
+ .devinit = tu102_devinit_new,
2470
+ .fault = tu102_fault_new,
2471
+ .fb = gv100_fb_new,
2472
+ .fuse = gm107_fuse_new,
2473
+ .gpio = gk104_gpio_new,
2474
+ .gsp = gv100_gsp_new,
2475
+ .i2c = gm200_i2c_new,
2476
+ .ibus = gm200_ibus_new,
2477
+ .imem = nv50_instmem_new,
2478
+ .ltc = gp102_ltc_new,
2479
+ .mc = tu102_mc_new,
2480
+ .mmu = tu102_mmu_new,
2481
+ .pci = gp100_pci_new,
2482
+ .pmu = gp102_pmu_new,
2483
+ .therm = gp100_therm_new,
2484
+ .timer = gk20a_timer_new,
2485
+ .top = gk104_top_new,
2486
+ .ce[0] = tu102_ce_new,
2487
+ .ce[1] = tu102_ce_new,
2488
+ .ce[2] = tu102_ce_new,
2489
+ .ce[3] = tu102_ce_new,
2490
+ .ce[4] = tu102_ce_new,
2491
+ .disp = tu102_disp_new,
2492
+ .dma = gv100_dma_new,
2493
+ .fifo = tu102_fifo_new,
2494
+ .gr = tu102_gr_new,
2495
+ .nvdec[0] = gm107_nvdec_new,
2496
+ .nvenc[0] = gm107_nvenc_new,
2497
+ .sec2 = tu102_sec2_new,
2498
+};
2499
+
2500
+static const struct nvkm_device_chip
2501
+nv164_chipset = {
2502
+ .name = "TU104",
2503
+ .acr = tu102_acr_new,
2504
+ .bar = tu102_bar_new,
2505
+ .bios = nvkm_bios_new,
2506
+ .bus = gf100_bus_new,
2507
+ .devinit = tu102_devinit_new,
2508
+ .fault = tu102_fault_new,
2509
+ .fb = gv100_fb_new,
2510
+ .fuse = gm107_fuse_new,
2511
+ .gpio = gk104_gpio_new,
2512
+ .gsp = gv100_gsp_new,
2513
+ .i2c = gm200_i2c_new,
2514
+ .ibus = gm200_ibus_new,
2515
+ .imem = nv50_instmem_new,
2516
+ .ltc = gp102_ltc_new,
2517
+ .mc = tu102_mc_new,
2518
+ .mmu = tu102_mmu_new,
2519
+ .pci = gp100_pci_new,
2520
+ .pmu = gp102_pmu_new,
2521
+ .therm = gp100_therm_new,
2522
+ .timer = gk20a_timer_new,
2523
+ .top = gk104_top_new,
2524
+ .ce[0] = tu102_ce_new,
2525
+ .ce[1] = tu102_ce_new,
2526
+ .ce[2] = tu102_ce_new,
2527
+ .ce[3] = tu102_ce_new,
2528
+ .ce[4] = tu102_ce_new,
2529
+ .disp = tu102_disp_new,
2530
+ .dma = gv100_dma_new,
2531
+ .fifo = tu102_fifo_new,
2532
+ .gr = tu102_gr_new,
2533
+ .nvdec[0] = gm107_nvdec_new,
2534
+ .nvdec[1] = gm107_nvdec_new,
2535
+ .nvenc[0] = gm107_nvenc_new,
2536
+ .sec2 = tu102_sec2_new,
2537
+};
2538
+
2539
+static const struct nvkm_device_chip
2540
+nv166_chipset = {
2541
+ .name = "TU106",
2542
+ .acr = tu102_acr_new,
2543
+ .bar = tu102_bar_new,
2544
+ .bios = nvkm_bios_new,
2545
+ .bus = gf100_bus_new,
2546
+ .devinit = tu102_devinit_new,
2547
+ .fault = tu102_fault_new,
2548
+ .fb = gv100_fb_new,
2549
+ .fuse = gm107_fuse_new,
2550
+ .gpio = gk104_gpio_new,
2551
+ .gsp = gv100_gsp_new,
2552
+ .i2c = gm200_i2c_new,
2553
+ .ibus = gm200_ibus_new,
2554
+ .imem = nv50_instmem_new,
2555
+ .ltc = gp102_ltc_new,
2556
+ .mc = tu102_mc_new,
2557
+ .mmu = tu102_mmu_new,
2558
+ .pci = gp100_pci_new,
2559
+ .pmu = gp102_pmu_new,
2560
+ .therm = gp100_therm_new,
2561
+ .timer = gk20a_timer_new,
2562
+ .top = gk104_top_new,
2563
+ .ce[0] = tu102_ce_new,
2564
+ .ce[1] = tu102_ce_new,
2565
+ .ce[2] = tu102_ce_new,
2566
+ .ce[3] = tu102_ce_new,
2567
+ .ce[4] = tu102_ce_new,
2568
+ .disp = tu102_disp_new,
2569
+ .dma = gv100_dma_new,
2570
+ .fifo = tu102_fifo_new,
2571
+ .gr = tu102_gr_new,
2572
+ .nvdec[0] = gm107_nvdec_new,
2573
+ .nvdec[1] = gm107_nvdec_new,
2574
+ .nvdec[2] = gm107_nvdec_new,
2575
+ .nvenc[0] = gm107_nvenc_new,
2576
+ .sec2 = tu102_sec2_new,
2577
+};
2578
+
2579
+static const struct nvkm_device_chip
2580
+nv167_chipset = {
2581
+ .name = "TU117",
2582
+ .acr = tu102_acr_new,
2583
+ .bar = tu102_bar_new,
2584
+ .bios = nvkm_bios_new,
2585
+ .bus = gf100_bus_new,
2586
+ .devinit = tu102_devinit_new,
2587
+ .fault = tu102_fault_new,
2588
+ .fb = gv100_fb_new,
2589
+ .fuse = gm107_fuse_new,
2590
+ .gpio = gk104_gpio_new,
2591
+ .gsp = gv100_gsp_new,
2592
+ .i2c = gm200_i2c_new,
2593
+ .ibus = gm200_ibus_new,
2594
+ .imem = nv50_instmem_new,
2595
+ .ltc = gp102_ltc_new,
2596
+ .mc = tu102_mc_new,
2597
+ .mmu = tu102_mmu_new,
2598
+ .pci = gp100_pci_new,
2599
+ .pmu = gp102_pmu_new,
2600
+ .therm = gp100_therm_new,
2601
+ .timer = gk20a_timer_new,
2602
+ .top = gk104_top_new,
2603
+ .ce[0] = tu102_ce_new,
2604
+ .ce[1] = tu102_ce_new,
2605
+ .ce[2] = tu102_ce_new,
2606
+ .ce[3] = tu102_ce_new,
2607
+ .ce[4] = tu102_ce_new,
2608
+ .disp = tu102_disp_new,
2609
+ .dma = gv100_dma_new,
2610
+ .fifo = tu102_fifo_new,
2611
+ .gr = tu102_gr_new,
2612
+ .nvdec[0] = gm107_nvdec_new,
2613
+ .nvenc[0] = gm107_nvenc_new,
2614
+ .sec2 = tu102_sec2_new,
2615
+};
2616
+
2617
+static const struct nvkm_device_chip
2618
+nv168_chipset = {
2619
+ .name = "TU116",
2620
+ .acr = tu102_acr_new,
2621
+ .bar = tu102_bar_new,
2622
+ .bios = nvkm_bios_new,
2623
+ .bus = gf100_bus_new,
2624
+ .devinit = tu102_devinit_new,
2625
+ .fault = tu102_fault_new,
2626
+ .fb = gv100_fb_new,
2627
+ .fuse = gm107_fuse_new,
2628
+ .gpio = gk104_gpio_new,
2629
+ .gsp = gv100_gsp_new,
2630
+ .i2c = gm200_i2c_new,
2631
+ .ibus = gm200_ibus_new,
2632
+ .imem = nv50_instmem_new,
2633
+ .ltc = gp102_ltc_new,
2634
+ .mc = tu102_mc_new,
2635
+ .mmu = tu102_mmu_new,
2636
+ .pci = gp100_pci_new,
2637
+ .pmu = gp102_pmu_new,
2638
+ .therm = gp100_therm_new,
2639
+ .timer = gk20a_timer_new,
2640
+ .top = gk104_top_new,
2641
+ .ce[0] = tu102_ce_new,
2642
+ .ce[1] = tu102_ce_new,
2643
+ .ce[2] = tu102_ce_new,
2644
+ .ce[3] = tu102_ce_new,
2645
+ .ce[4] = tu102_ce_new,
2646
+ .disp = tu102_disp_new,
2647
+ .dma = gv100_dma_new,
2648
+ .fifo = tu102_fifo_new,
2649
+ .gr = tu102_gr_new,
2650
+ .nvdec[0] = gm107_nvdec_new,
2651
+ .nvenc[0] = gm107_nvenc_new,
2652
+ .sec2 = tu102_sec2_new,
24352653 };
24362654
24372655 static int
....@@ -2462,6 +2680,7 @@
24622680
24632681 switch (index) {
24642682 #define _(n,p,m) case NVKM_SUBDEV_##n: if (p) return (m); break
2683
+ _(ACR , device->acr , &device->acr->subdev);
24652684 _(BAR , device->bar , &device->bar->subdev);
24662685 _(VBIOS , device->bios , &device->bios->subdev);
24672686 _(BUS , device->bus , &device->bus->subdev);
....@@ -2471,6 +2690,7 @@
24712690 _(FB , device->fb , &device->fb->subdev);
24722691 _(FUSE , device->fuse , &device->fuse->subdev);
24732692 _(GPIO , device->gpio , &device->gpio->subdev);
2693
+ _(GSP , device->gsp , &device->gsp->subdev);
24742694 _(I2C , device->i2c , &device->i2c->subdev);
24752695 _(IBUS , device->ibus , device->ibus);
24762696 _(ICCSENSE, device->iccsense, &device->iccsense->subdev);
....@@ -2481,7 +2701,6 @@
24812701 _(MXM , device->mxm , device->mxm);
24822702 _(PCI , device->pci , &device->pci->subdev);
24832703 _(PMU , device->pmu , &device->pmu->subdev);
2484
- _(SECBOOT , device->secboot , &device->secboot->subdev);
24852704 _(THERM , device->therm , &device->therm->subdev);
24862705 _(TIMER , device->timer , &device->timer->subdev);
24872706 _(TOP , device->top , &device->top->subdev);
....@@ -2526,10 +2745,12 @@
25262745 _(MSPDEC , device->mspdec , device->mspdec);
25272746 _(MSPPP , device->msppp , device->msppp);
25282747 _(MSVLD , device->msvld , device->msvld);
2529
- _(NVENC0 , device->nvenc[0], device->nvenc[0]);
2530
- _(NVENC1 , device->nvenc[1], device->nvenc[1]);
2531
- _(NVENC2 , device->nvenc[2], device->nvenc[2]);
2532
- _(NVDEC , device->nvdec , &device->nvdec->engine);
2748
+ _(NVENC0 , device->nvenc[0], &device->nvenc[0]->engine);
2749
+ _(NVENC1 , device->nvenc[1], &device->nvenc[1]->engine);
2750
+ _(NVENC2 , device->nvenc[2], &device->nvenc[2]->engine);
2751
+ _(NVDEC0 , device->nvdec[0], &device->nvdec[0]->engine);
2752
+ _(NVDEC1 , device->nvdec[1], &device->nvdec[1]->engine);
2753
+ _(NVDEC2 , device->nvdec[2], &device->nvdec[2]->engine);
25332754 _(PM , device->pm , &device->pm->engine);
25342755 _(SEC , device->sec , device->sec);
25352756 _(SEC2 , device->sec2 , &device->sec2->engine);
....@@ -2703,6 +2924,37 @@
27032924 }
27042925 }
27052926
2927
+/* returns true if the GPU is in the CPU native byte order */
2928
+static inline bool
2929
+nvkm_device_endianness(struct nvkm_device *device)
2930
+{
2931
+#ifdef __BIG_ENDIAN
2932
+ const bool big_endian = true;
2933
+#else
2934
+ const bool big_endian = false;
2935
+#endif
2936
+
2937
+ /* Read NV_PMC_BOOT_1, and assume non-functional endian switch if it
2938
+ * doesn't contain the expected values.
2939
+ */
2940
+ u32 pmc_boot_1 = nvkm_rd32(device, 0x000004);
2941
+ if (pmc_boot_1 && pmc_boot_1 != 0x01000001)
2942
+ return !big_endian; /* Assume GPU is LE in this case. */
2943
+
2944
+ /* 0 means LE and 0x01000001 means BE GPU. Condition is true when
2945
+ * GPU/CPU endianness don't match.
2946
+ */
2947
+ if (big_endian == !pmc_boot_1) {
2948
+ nvkm_wr32(device, 0x000004, 0x01000001);
2949
+ nvkm_rd32(device, 0x000000);
2950
+ if (nvkm_rd32(device, 0x000004) != (big_endian ? 0x01000001 : 0x00000000))
2951
+ return !big_endian; /* Assume GPU is LE on any unexpected read-back. */
2952
+ }
2953
+
2954
+ /* CPU/GPU endianness should (hopefully) match. */
2955
+ return true;
2956
+}
2957
+
27062958 int
27072959 nvkm_device_ctor(const struct nvkm_device_func *func,
27082960 const struct nvkm_device_quirk *quirk,
....@@ -2713,10 +2965,9 @@
27132965 {
27142966 struct nvkm_subdev *subdev;
27152967 u64 mmio_base, mmio_size;
2716
- u32 boot0, strap;
2717
- void __iomem *map;
2718
- int ret = -EEXIST;
2719
- int i;
2968
+ u32 boot0, boot1, strap;
2969
+ int ret = -EEXIST, i;
2970
+ unsigned chipset;
27202971
27212972 mutex_lock(&nv_devices_mutex);
27222973 if (nvkm_device_find_locked(handle))
....@@ -2740,26 +2991,46 @@
27402991 mmio_base = device->func->resource_addr(device, 0);
27412992 mmio_size = device->func->resource_size(device, 0);
27422993
2994
+ if (detect || mmio) {
2995
+ device->pri = ioremap(mmio_base, mmio_size);
2996
+ if (device->pri == NULL) {
2997
+ nvdev_error(device, "unable to map PRI\n");
2998
+ ret = -ENOMEM;
2999
+ goto done;
3000
+ }
3001
+ }
3002
+
27433003 /* identify the chipset, and determine classes of subdev/engines */
27443004 if (detect) {
2745
- map = ioremap(mmio_base, 0x102000);
2746
- if (ret = -ENOMEM, map == NULL)
2747
- goto done;
2748
-
27493005 /* switch mmio to cpu's native endianness */
2750
-#ifndef __BIG_ENDIAN
2751
- if (ioread32_native(map + 0x000004) != 0x00000000) {
2752
-#else
2753
- if (ioread32_native(map + 0x000004) == 0x00000000) {
2754
-#endif
2755
- iowrite32_native(0x01000001, map + 0x000004);
2756
- ioread32_native(map);
3006
+ if (!nvkm_device_endianness(device)) {
3007
+ nvdev_error(device,
3008
+ "Couldn't switch GPU to CPUs endianess\n");
3009
+ ret = -ENOSYS;
3010
+ goto done;
27573011 }
27583012
2759
- /* read boot0 and strapping information */
2760
- boot0 = ioread32_native(map + 0x000000);
2761
- strap = ioread32_native(map + 0x101000);
2762
- iounmap(map);
3013
+ boot0 = nvkm_rd32(device, 0x000000);
3014
+
3015
+ /* chipset can be overridden for devel/testing purposes */
3016
+ chipset = nvkm_longopt(device->cfgopt, "NvChipset", 0);
3017
+ if (chipset) {
3018
+ u32 override_boot0;
3019
+
3020
+ if (chipset >= 0x10) {
3021
+ override_boot0 = ((chipset & 0x1ff) << 20);
3022
+ override_boot0 |= 0x000000a1;
3023
+ } else {
3024
+ if (chipset != 0x04)
3025
+ override_boot0 = 0x20104000;
3026
+ else
3027
+ override_boot0 = 0x20004000;
3028
+ }
3029
+
3030
+ nvdev_warn(device, "CHIPSET OVERRIDE: %08x -> %08x\n",
3031
+ boot0, override_boot0);
3032
+ boot0 = override_boot0;
3033
+ }
27633034
27643035 /* determine chipset and derive architecture from it */
27653036 if ((boot0 & 0x1f000000) > 0) {
....@@ -2791,6 +3062,7 @@
27913062 case 0x120: device->card_type = GM100; break;
27923063 case 0x130: device->card_type = GP100; break;
27933064 case 0x140: device->card_type = GV100; break;
3065
+ case 0x160: device->card_type = TU100; break;
27943066 default:
27953067 break;
27963068 }
....@@ -2883,13 +3155,30 @@
28833155 case 0x138: device->chip = &nv138_chipset; break;
28843156 case 0x13b: device->chip = &nv13b_chipset; break;
28853157 case 0x140: device->chip = &nv140_chipset; break;
3158
+ case 0x162: device->chip = &nv162_chipset; break;
3159
+ case 0x164: device->chip = &nv164_chipset; break;
3160
+ case 0x166: device->chip = &nv166_chipset; break;
3161
+ case 0x167: device->chip = &nv167_chipset; break;
3162
+ case 0x168: device->chip = &nv168_chipset; break;
28863163 default:
28873164 nvdev_error(device, "unknown chipset (%08x)\n", boot0);
3165
+ ret = -ENODEV;
28883166 goto done;
28893167 }
28903168
28913169 nvdev_info(device, "NVIDIA %s (%08x)\n",
28923170 device->chip->name, boot0);
3171
+
3172
+ /* vGPU detection */
3173
+ boot1 = nvkm_rd32(device, 0x0000004);
3174
+ if (device->card_type >= TU100 && (boot1 & 0x00030000)) {
3175
+ nvdev_info(device, "vGPUs are not supported\n");
3176
+ ret = -ENODEV;
3177
+ goto done;
3178
+ }
3179
+
3180
+ /* read strapping information */
3181
+ strap = nvkm_rd32(device, 0x101000);
28933182
28943183 /* determine frequency of timing crystal */
28953184 if ( device->card_type <= NV_10 || device->chipset < 0x17 ||
....@@ -2911,15 +3200,6 @@
29113200 if (!device->name)
29123201 device->name = device->chip->name;
29133202
2914
- if (mmio) {
2915
- device->pri = ioremap(mmio_base, mmio_size);
2916
- if (!device->pri) {
2917
- nvdev_error(device, "unable to map PRI\n");
2918
- ret = -ENOMEM;
2919
- goto done;
2920
- }
2921
- }
2922
-
29233203 mutex_init(&device->mutex);
29243204
29253205 for (i = 0; i < NVKM_SUBDEV_NR; i++) {
....@@ -2939,6 +3219,7 @@
29393219 } \
29403220 break
29413221 switch (i) {
3222
+ _(NVKM_SUBDEV_ACR , acr);
29423223 _(NVKM_SUBDEV_BAR , bar);
29433224 _(NVKM_SUBDEV_VBIOS , bios);
29443225 _(NVKM_SUBDEV_BUS , bus);
....@@ -2948,6 +3229,7 @@
29483229 _(NVKM_SUBDEV_FB , fb);
29493230 _(NVKM_SUBDEV_FUSE , fuse);
29503231 _(NVKM_SUBDEV_GPIO , gpio);
3232
+ _(NVKM_SUBDEV_GSP , gsp);
29513233 _(NVKM_SUBDEV_I2C , i2c);
29523234 _(NVKM_SUBDEV_IBUS , ibus);
29533235 _(NVKM_SUBDEV_ICCSENSE, iccsense);
....@@ -2958,7 +3240,6 @@
29583240 _(NVKM_SUBDEV_MXM , mxm);
29593241 _(NVKM_SUBDEV_PCI , pci);
29603242 _(NVKM_SUBDEV_PMU , pmu);
2961
- _(NVKM_SUBDEV_SECBOOT , secboot);
29623243 _(NVKM_SUBDEV_THERM , therm);
29633244 _(NVKM_SUBDEV_TIMER , timer);
29643245 _(NVKM_SUBDEV_TOP , top);
....@@ -2988,7 +3269,9 @@
29883269 _(NVKM_ENGINE_NVENC0 , nvenc[0]);
29893270 _(NVKM_ENGINE_NVENC1 , nvenc[1]);
29903271 _(NVKM_ENGINE_NVENC2 , nvenc[2]);
2991
- _(NVKM_ENGINE_NVDEC , nvdec);
3272
+ _(NVKM_ENGINE_NVDEC0 , nvdec[0]);
3273
+ _(NVKM_ENGINE_NVDEC1 , nvdec[1]);
3274
+ _(NVKM_ENGINE_NVDEC2 , nvdec[2]);
29923275 _(NVKM_ENGINE_PM , pm);
29933276 _(NVKM_ENGINE_SEC , sec);
29943277 _(NVKM_ENGINE_SEC2 , sec2);
....@@ -3004,6 +3287,10 @@
30043287
30053288 ret = 0;
30063289 done:
3290
+ if (device->pri && (!mmio || ret)) {
3291
+ iounmap(device->pri);
3292
+ device->pri = NULL;
3293
+ }
30073294 mutex_unlock(&nv_devices_mutex);
30083295 return ret;
30093296 }