diff options
author | Dave Airlie <airlied@redhat.com> | 2016-05-20 16:12:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-05-20 16:12:13 -0400 |
commit | d5fa33f28401414959b68591075c8053e8276547 (patch) | |
tree | 3edc168bca11a47c59f99349f1076ae53b1995e0 | |
parent | 24e04d72eb43d36d28fa7908f9f8d506d1cb06e7 (diff) | |
parent | ca79e49d6add77b69be3362ddfe5b068f62bf1de (diff) |
Merge branch 'linux-4.7' of git://github.com/skeggsb/linux into drm-next
Nothing too exciting here, there's a larger chunk of work that still
needs more testing but not likely to get that done today - so - here's
the rest of it. Assuming nothing else goes horribly wrong, I should be
able to send the rest Monday if it isn't too late....
Changes:
- Improvements to power sensor support
- Initial attempt at GM108 support
- Minor fixes to GR init + ucode
- Make use of topology information (provided by the GPU) in various
places, should at least fix some fault recovery issues and
engine/runlist mapping confusion on newer GPUs.
* 'linux-4.7' of git://github.com/skeggsb/linux: (51 commits)
drm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode
drm/nouveau/core: recognise GM108 chipsets
drm/nouveau/gr/gm107-: fix touching non-existent ppcs in attrib cb setup
drm/nouveau/gr/gk104-: share implementation of ppc exception init
drm/nouveau/gr/gk104-: move rop_active_fbps init to nonctx
drm/nouveau/bios/pll: check BIT table version before trying to parse it
drm/nouveau/bios/pll: prevent oops when limits table can't be parsed
drm/nouveau/volt/gk104: round up in gk104_volt_set
drm/nouveau/fb/gm200: setup mmu debug buffer registers at init()
drm/nouveau/fb/gk20a,gm20b: setup mmu debug buffer registers at init()
drm/nouveau/fb/gf100-: allocate mmu debug buffers
drm/nouveau/fb: allow chipset-specific actions for oneinit()
drm/nouveau/gr/gm200-: fix bad hardcoding of a max-tpcs-per-gpc value
drm/nouveau/gr/gm200-: rop count == ltc count
drm/nouveau/gr/gm200: modify the mask when copying mmu settings from fb
drm/nouveau/gr/gm200: move some code into init_gpc_mmu() hook
drm/nouveau/gr/gm200: make generate_main() static
drm/nouveau/gr/gf100-: abstract fetching rop count
drm/nouveau/gr/gf100-: rename magic_not_rop_nr to screen_tile_row_offset
drm/nouveau/gr/gf100-: remove hardcoded idle_timeout values
...
203 files changed, 1853 insertions, 843 deletions
diff --git a/drivers/gpu/drm/nouveau/dispnv04/arb.c b/drivers/gpu/drm/nouveau/dispnv04/arb.c index 82bd4658aa58..a555681c3096 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/arb.c +++ b/drivers/gpu/drm/nouveau/dispnv04/arb.c | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | #include <drm/drmP.h> | 24 | #include <drm/drmP.h> |
25 | 25 | ||
26 | #include "nouveau_drm.h" | 26 | #include "nouveau_drv.h" |
27 | #include "nouveau_reg.h" | 27 | #include "nouveau_reg.h" |
28 | #include "hw.h" | 28 | #include "hw.h" |
29 | 29 | ||
diff --git a/drivers/gpu/drm/nouveau/dispnv04/crtc.c b/drivers/gpu/drm/nouveau/dispnv04/crtc.c index ef9a3299f716..6f318c54da33 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/crtc.c +++ b/drivers/gpu/drm/nouveau/dispnv04/crtc.c | |||
@@ -28,8 +28,9 @@ | |||
28 | #include <drm/drm_crtc_helper.h> | 28 | #include <drm/drm_crtc_helper.h> |
29 | #include <drm/drm_plane_helper.h> | 29 | #include <drm/drm_plane_helper.h> |
30 | 30 | ||
31 | #include "nouveau_drm.h" | 31 | #include "nouveau_drv.h" |
32 | #include "nouveau_reg.h" | 32 | #include "nouveau_reg.h" |
33 | #include "nouveau_ttm.h" | ||
33 | #include "nouveau_bo.h" | 34 | #include "nouveau_bo.h" |
34 | #include "nouveau_gem.h" | 35 | #include "nouveau_gem.h" |
35 | #include "nouveau_encoder.h" | 36 | #include "nouveau_encoder.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/cursor.c b/drivers/gpu/drm/nouveau/dispnv04/cursor.c index 4e61173c3353..c83116a308a4 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/cursor.c +++ b/drivers/gpu/drm/nouveau/dispnv04/cursor.c | |||
@@ -1,6 +1,6 @@ | |||
1 | #include <drm/drmP.h> | 1 | #include <drm/drmP.h> |
2 | #include <drm/drm_mode.h> | 2 | #include <drm/drm_mode.h> |
3 | #include "nouveau_drm.h" | 3 | #include "nouveau_drv.h" |
4 | #include "nouveau_reg.h" | 4 | #include "nouveau_reg.h" |
5 | #include "nouveau_crtc.h" | 5 | #include "nouveau_crtc.h" |
6 | #include "hw.h" | 6 | #include "hw.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/dac.c b/drivers/gpu/drm/nouveau/dispnv04/dac.c index b48eec395f07..b6cc7766e6f7 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/dac.c +++ b/drivers/gpu/drm/nouveau/dispnv04/dac.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include <drm/drm_crtc_helper.h> | 28 | #include <drm/drm_crtc_helper.h> |
29 | 29 | ||
30 | #include "nouveau_drm.h" | 30 | #include "nouveau_drv.h" |
31 | #include "nouveau_encoder.h" | 31 | #include "nouveau_encoder.h" |
32 | #include "nouveau_connector.h" | 32 | #include "nouveau_connector.h" |
33 | #include "nouveau_crtc.h" | 33 | #include "nouveau_crtc.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/dfp.c b/drivers/gpu/drm/nouveau/dispnv04/dfp.c index 05bfd151d1d8..c2947ef7d4fc 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/dfp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/dfp.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include <drm/drm_crtc_helper.h> | 28 | #include <drm/drm_crtc_helper.h> |
29 | 29 | ||
30 | #include "nouveau_drm.h" | 30 | #include "nouveau_drv.h" |
31 | #include "nouveau_reg.h" | 31 | #include "nouveau_reg.h" |
32 | #include "nouveau_encoder.h" | 32 | #include "nouveau_encoder.h" |
33 | #include "nouveau_connector.h" | 33 | #include "nouveau_connector.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.c b/drivers/gpu/drm/nouveau/dispnv04/disp.c index b4a6bc433ef5..aea81a547e85 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.c +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | #include <drm/drm_crtc_helper.h> | 26 | #include <drm/drm_crtc_helper.h> |
27 | 27 | ||
28 | #include "nouveau_drm.h" | 28 | #include "nouveau_drv.h" |
29 | #include "nouveau_reg.h" | 29 | #include "nouveau_reg.h" |
30 | #include "hw.h" | 30 | #include "hw.h" |
31 | #include "nouveau_encoder.h" | 31 | #include "nouveau_encoder.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/disp.h b/drivers/gpu/drm/nouveau/dispnv04/disp.h index 6c9a1e89810f..7030307d2d48 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/disp.h +++ b/drivers/gpu/drm/nouveau/dispnv04/disp.h | |||
@@ -1,6 +1,6 @@ | |||
1 | #ifndef __NV04_DISPLAY_H__ | 1 | #ifndef __NV04_DISPLAY_H__ |
2 | #define __NV04_DISPLAY_H__ | 2 | #define __NV04_DISPLAY_H__ |
3 | 3 | #include <subdev/bios.h> | |
4 | #include <subdev/bios/pll.h> | 4 | #include <subdev/bios/pll.h> |
5 | 5 | ||
6 | #include "nouveau_display.h" | 6 | #include "nouveau_display.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/hw.c b/drivers/gpu/drm/nouveau/dispnv04/hw.c index 956a833b8200..74856a8b8f35 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/hw.c +++ b/drivers/gpu/drm/nouveau/dispnv04/hw.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | #include "nouveau_drm.h" | 26 | #include "nouveau_drv.h" |
27 | #include "hw.h" | 27 | #include "hw.h" |
28 | 28 | ||
29 | #include <subdev/bios/pll.h> | 29 | #include <subdev/bios/pll.h> |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/overlay.c b/drivers/gpu/drm/nouveau/dispnv04/overlay.c index aeebdd402478..ec444eac6258 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/overlay.c +++ b/drivers/gpu/drm/nouveau/dispnv04/overlay.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include <drm/drm_crtc.h> | 27 | #include <drm/drm_crtc.h> |
28 | #include <drm/drm_fourcc.h> | 28 | #include <drm/drm_fourcc.h> |
29 | 29 | ||
30 | #include "nouveau_drm.h" | 30 | #include "nouveau_drv.h" |
31 | 31 | ||
32 | #include "nouveau_bo.h" | 32 | #include "nouveau_bo.h" |
33 | #include "nouveau_connector.h" | 33 | #include "nouveau_connector.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c index 903c473d266f..2b83b2c39d1d 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvmodesnv17.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include <drm/drm_crtc_helper.h> | 28 | #include <drm/drm_crtc_helper.h> |
29 | #include "nouveau_drm.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_encoder.h" | 30 | #include "nouveau_encoder.h" |
31 | #include "nouveau_crtc.h" | 31 | #include "nouveau_crtc.h" |
32 | #include "hw.h" | 32 | #include "hw.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c index 54e9fb9eb5c0..477a8d072af4 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv04.c | |||
@@ -25,7 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include "nouveau_drm.h" | 28 | #include "nouveau_drv.h" |
29 | #include "nouveau_reg.h" | 29 | #include "nouveau_reg.h" |
30 | #include "nouveau_encoder.h" | 30 | #include "nouveau_encoder.h" |
31 | #include "nouveau_connector.h" | 31 | #include "nouveau_connector.h" |
diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c index 163317d26de9..a665b78b2af5 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | #include <drm/drmP.h> | 27 | #include <drm/drmP.h> |
28 | #include <drm/drm_crtc_helper.h> | 28 | #include <drm/drm_crtc_helper.h> |
29 | #include "nouveau_drm.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_reg.h" | 30 | #include "nouveau_reg.h" |
31 | #include "nouveau_encoder.h" | 31 | #include "nouveau_encoder.h" |
32 | #include "nouveau_connector.h" | 32 | #include "nouveau_connector.h" |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h index 4993a863adb9..c612dc1f1eb4 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/device.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/device.h | |||
@@ -7,6 +7,7 @@ enum nvkm_devidx { | |||
7 | NVKM_SUBDEV_PCI, | 7 | NVKM_SUBDEV_PCI, |
8 | NVKM_SUBDEV_VBIOS, | 8 | NVKM_SUBDEV_VBIOS, |
9 | NVKM_SUBDEV_DEVINIT, | 9 | NVKM_SUBDEV_DEVINIT, |
10 | NVKM_SUBDEV_TOP, | ||
10 | NVKM_SUBDEV_IBUS, | 11 | NVKM_SUBDEV_IBUS, |
11 | NVKM_SUBDEV_GPIO, | 12 | NVKM_SUBDEV_GPIO, |
12 | NVKM_SUBDEV_I2C, | 13 | NVKM_SUBDEV_I2C, |
@@ -131,6 +132,7 @@ struct nvkm_device { | |||
131 | struct nvkm_secboot *secboot; | 132 | struct nvkm_secboot *secboot; |
132 | struct nvkm_therm *therm; | 133 | struct nvkm_therm *therm; |
133 | struct nvkm_timer *timer; | 134 | struct nvkm_timer *timer; |
135 | struct nvkm_top *top; | ||
134 | struct nvkm_volt *volt; | 136 | struct nvkm_volt *volt; |
135 | 137 | ||
136 | struct nvkm_engine *bsp; | 138 | struct nvkm_engine *bsp; |
@@ -200,6 +202,7 @@ struct nvkm_device_chip { | |||
200 | int (*secboot )(struct nvkm_device *, int idx, struct nvkm_secboot **); | 202 | int (*secboot )(struct nvkm_device *, int idx, struct nvkm_secboot **); |
201 | int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); | 203 | int (*therm )(struct nvkm_device *, int idx, struct nvkm_therm **); |
202 | int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **); | 204 | int (*timer )(struct nvkm_device *, int idx, struct nvkm_timer **); |
205 | int (*top )(struct nvkm_device *, int idx, struct nvkm_top **); | ||
203 | int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **); | 206 | int (*volt )(struct nvkm_device *, int idx, struct nvkm_volt **); |
204 | 207 | ||
205 | int (*bsp )(struct nvkm_device *, int idx, struct nvkm_engine **); | 208 | int (*bsp )(struct nvkm_device *, int idx, struct nvkm_engine **); |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/engine.h b/drivers/gpu/drm/nouveau/include/nvkm/core/engine.h index 48bf128456a1..9ebfd8782366 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/engine.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/engine.h | |||
@@ -38,11 +38,9 @@ struct nvkm_engine_func { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | int nvkm_engine_ctor(const struct nvkm_engine_func *, struct nvkm_device *, | 40 | int nvkm_engine_ctor(const struct nvkm_engine_func *, struct nvkm_device *, |
41 | int index, u32 pmc_enable, bool enable, | 41 | int index, bool enable, struct nvkm_engine *); |
42 | struct nvkm_engine *); | ||
43 | int nvkm_engine_new_(const struct nvkm_engine_func *, struct nvkm_device *, | 42 | int nvkm_engine_new_(const struct nvkm_engine_func *, struct nvkm_device *, |
44 | int index, u32 pmc_enable, bool enable, | 43 | int index, bool enable, struct nvkm_engine **); |
45 | struct nvkm_engine **); | ||
46 | struct nvkm_engine *nvkm_engine_ref(struct nvkm_engine *); | 44 | struct nvkm_engine *nvkm_engine_ref(struct nvkm_engine *); |
47 | void nvkm_engine_unref(struct nvkm_engine **); | 45 | void nvkm_engine_unref(struct nvkm_engine **); |
48 | void nvkm_engine_tile(struct nvkm_engine *, int region); | 46 | void nvkm_engine_tile(struct nvkm_engine *, int region); |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h index 3b5dc9c63069..57adefa8b08e 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/core/subdev.h | |||
@@ -6,7 +6,6 @@ struct nvkm_subdev { | |||
6 | const struct nvkm_subdev_func *func; | 6 | const struct nvkm_subdev_func *func; |
7 | struct nvkm_device *device; | 7 | struct nvkm_device *device; |
8 | enum nvkm_devidx index; | 8 | enum nvkm_devidx index; |
9 | u32 pmc_enable; | ||
10 | struct mutex mutex; | 9 | struct mutex mutex; |
11 | u32 debug; | 10 | u32 debug; |
12 | 11 | ||
@@ -24,7 +23,7 @@ struct nvkm_subdev_func { | |||
24 | 23 | ||
25 | extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR]; | 24 | extern const char *nvkm_subdev_name[NVKM_SUBDEV_NR]; |
26 | void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *, | 25 | void nvkm_subdev_ctor(const struct nvkm_subdev_func *, struct nvkm_device *, |
27 | int index, u32 pmc_enable, struct nvkm_subdev *); | 26 | int index, struct nvkm_subdev *); |
28 | void nvkm_subdev_del(struct nvkm_subdev **); | 27 | void nvkm_subdev_del(struct nvkm_subdev **); |
29 | int nvkm_subdev_preinit(struct nvkm_subdev *); | 28 | int nvkm_subdev_preinit(struct nvkm_subdev *); |
30 | int nvkm_subdev_init(struct nvkm_subdev *); | 29 | int nvkm_subdev_init(struct nvkm_subdev *); |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h index 81c0bc66a9f8..e6baf039c269 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h | |||
@@ -40,7 +40,6 @@ struct nvkm_falcon_func { | |||
40 | u32 *data; | 40 | u32 *data; |
41 | u32 size; | 41 | u32 size; |
42 | } data; | 42 | } data; |
43 | u32 pmc_enable; | ||
44 | void (*init)(struct nvkm_falcon *); | 43 | void (*init)(struct nvkm_falcon *); |
45 | void (*intr)(struct nvkm_falcon *, struct nvkm_fifo_chan *); | 44 | void (*intr)(struct nvkm_falcon *, struct nvkm_fifo_chan *); |
46 | struct nvkm_sclass sclass[]; | 45 | struct nvkm_sclass sclass[]; |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/engine/xtensa.h b/drivers/gpu/drm/nouveau/include/nvkm/engine/xtensa.h index 3128d21a5d1a..b1fcc416732f 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/engine/xtensa.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/engine/xtensa.h | |||
@@ -15,7 +15,6 @@ int nvkm_xtensa_new_(const struct nvkm_xtensa_func *, struct nvkm_device *, | |||
15 | int index, bool enable, u32 addr, struct nvkm_engine **); | 15 | int index, bool enable, u32 addr, struct nvkm_engine **); |
16 | 16 | ||
17 | struct nvkm_xtensa_func { | 17 | struct nvkm_xtensa_func { |
18 | u32 pmc_enable; | ||
19 | u32 fifo_val; | 18 | u32 fifo_val; |
20 | u32 unkd28; | 19 | u32 unkd28; |
21 | struct nvkm_sclass sclass[]; | 20 | struct nvkm_sclass sclass[]; |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h index 193626c69517..709d786f1808 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/devinit.h | |||
@@ -7,6 +7,7 @@ struct nvkm_devinit { | |||
7 | const struct nvkm_devinit_func *func; | 7 | const struct nvkm_devinit_func *func; |
8 | struct nvkm_subdev subdev; | 8 | struct nvkm_subdev subdev; |
9 | bool post; | 9 | bool post; |
10 | bool force_post; | ||
10 | }; | 11 | }; |
11 | 12 | ||
12 | u32 nvkm_devinit_mmio(struct nvkm_devinit *, u32 addr); | 13 | u32 nvkm_devinit_mmio(struct nvkm_devinit *, u32 addr); |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h index 85ab72c7f821..0a734fd06acf 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h | |||
@@ -55,6 +55,9 @@ struct nvkm_fb { | |||
55 | struct nvkm_fb_tile region[16]; | 55 | struct nvkm_fb_tile region[16]; |
56 | int regions; | 56 | int regions; |
57 | } tile; | 57 | } tile; |
58 | |||
59 | struct nvkm_memory *mmu_rd; | ||
60 | struct nvkm_memory *mmu_wr; | ||
58 | }; | 61 | }; |
59 | 62 | ||
60 | bool nvkm_fb_memtype_valid(struct nvkm_fb *, u32 memtype); | 63 | bool nvkm_fb_memtype_valid(struct nvkm_fb *, u32 memtype); |
@@ -87,6 +90,7 @@ int gf100_fb_new(struct nvkm_device *, int, struct nvkm_fb **); | |||
87 | int gk104_fb_new(struct nvkm_device *, int, struct nvkm_fb **); | 90 | int gk104_fb_new(struct nvkm_device *, int, struct nvkm_fb **); |
88 | int gk20a_fb_new(struct nvkm_device *, int, struct nvkm_fb **); | 91 | int gk20a_fb_new(struct nvkm_device *, int, struct nvkm_fb **); |
89 | int gm107_fb_new(struct nvkm_device *, int, struct nvkm_fb **); | 92 | int gm107_fb_new(struct nvkm_device *, int, struct nvkm_fb **); |
93 | int gm200_fb_new(struct nvkm_device *, int, struct nvkm_fb **); | ||
90 | 94 | ||
91 | #include <subdev/bios.h> | 95 | #include <subdev/bios.h> |
92 | #include <subdev/bios/ramcfg.h> | 96 | #include <subdev/bios/ramcfg.h> |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h index 530c6215fe4f..3c2ddd975273 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/iccsense.h | |||
@@ -3,15 +3,13 @@ | |||
3 | 3 | ||
4 | #include <core/subdev.h> | 4 | #include <core/subdev.h> |
5 | 5 | ||
6 | struct nkvm_iccsense_rail; | ||
7 | struct nvkm_iccsense { | 6 | struct nvkm_iccsense { |
8 | struct nvkm_subdev subdev; | 7 | struct nvkm_subdev subdev; |
9 | u8 rail_count; | ||
10 | bool data_valid; | 8 | bool data_valid; |
11 | struct nvkm_iccsense_rail *rails; | 9 | struct list_head sensors; |
10 | struct list_head rails; | ||
12 | }; | 11 | }; |
13 | 12 | ||
14 | int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **); | 13 | int gf100_iccsense_new(struct nvkm_device *, int index, struct nvkm_iccsense **); |
15 | int nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx); | ||
16 | int nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense); | 14 | int nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense); |
17 | #endif | 15 | #endif |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h index 4de05e718f83..2e80682b2da1 100644 --- a/drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/mc.h | |||
@@ -10,12 +10,18 @@ struct nvkm_mc { | |||
10 | void nvkm_mc_intr(struct nvkm_mc *, bool *handled); | 10 | void nvkm_mc_intr(struct nvkm_mc *, bool *handled); |
11 | void nvkm_mc_intr_unarm(struct nvkm_mc *); | 11 | void nvkm_mc_intr_unarm(struct nvkm_mc *); |
12 | void nvkm_mc_intr_rearm(struct nvkm_mc *); | 12 | void nvkm_mc_intr_rearm(struct nvkm_mc *); |
13 | void nvkm_mc_reset(struct nvkm_mc *, enum nvkm_devidx); | ||
13 | void nvkm_mc_unk260(struct nvkm_mc *, u32 data); | 14 | void nvkm_mc_unk260(struct nvkm_mc *, u32 data); |
14 | 15 | ||
15 | int nv04_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | 16 | int nv04_mc_new(struct nvkm_device *, int, struct nvkm_mc **); |
17 | int nv11_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | ||
18 | int nv17_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | ||
16 | int nv44_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | 19 | int nv44_mc_new(struct nvkm_device *, int, struct nvkm_mc **); |
17 | int nv50_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | 20 | int nv50_mc_new(struct nvkm_device *, int, struct nvkm_mc **); |
21 | int g84_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | ||
18 | int g98_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | 22 | int g98_mc_new(struct nvkm_device *, int, struct nvkm_mc **); |
23 | int gt215_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | ||
19 | int gf100_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | 24 | int gf100_mc_new(struct nvkm_device *, int, struct nvkm_mc **); |
25 | int gk104_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | ||
20 | int gk20a_mc_new(struct nvkm_device *, int, struct nvkm_mc **); | 26 | int gk20a_mc_new(struct nvkm_device *, int, struct nvkm_mc **); |
21 | #endif | 27 | #endif |
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/subdev/top.h b/drivers/gpu/drm/nouveau/include/nvkm/subdev/top.h new file mode 100644 index 000000000000..8fb575a92c48 --- /dev/null +++ b/drivers/gpu/drm/nouveau/include/nvkm/subdev/top.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef __NVKM_TOP_H__ | ||
2 | #define __NVKM_TOP_H__ | ||
3 | #include <core/subdev.h> | ||
4 | |||
5 | struct nvkm_top { | ||
6 | const struct nvkm_top_func *func; | ||
7 | struct nvkm_subdev subdev; | ||
8 | struct list_head device; | ||
9 | }; | ||
10 | |||
11 | u32 nvkm_top_reset(struct nvkm_top *, enum nvkm_devidx); | ||
12 | u32 nvkm_top_intr(struct nvkm_top *, u32 intr, u64 *subdevs); | ||
13 | enum nvkm_devidx nvkm_top_fault(struct nvkm_top *, int fault); | ||
14 | enum nvkm_devidx nvkm_top_engine(struct nvkm_top *, int, int *runl, int *engn); | ||
15 | |||
16 | int gk104_top_new(struct nvkm_device *, int, struct nvkm_top **); | ||
17 | #endif | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c index a59e524c028c..eb7de487a2b3 100644 --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <nvif/cla06f.h> | 29 | #include <nvif/cla06f.h> |
30 | #include <nvif/unpack.h> | 30 | #include <nvif/unpack.h> |
31 | 31 | ||
32 | #include "nouveau_drm.h" | 32 | #include "nouveau_drv.h" |
33 | #include "nouveau_dma.h" | 33 | #include "nouveau_dma.h" |
34 | #include "nouveau_gem.h" | 34 | #include "nouveau_gem.h" |
35 | #include "nouveau_chan.h" | 35 | #include "nouveau_chan.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c index cdf522770cfa..db76b94e6e26 100644 --- a/drivers/gpu/drm/nouveau/nouveau_acpi.c +++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c | |||
@@ -6,7 +6,7 @@ | |||
6 | #include <drm/drm_edid.h> | 6 | #include <drm/drm_edid.h> |
7 | #include <acpi/video.h> | 7 | #include <acpi/video.h> |
8 | 8 | ||
9 | #include "nouveau_drm.h" | 9 | #include "nouveau_drv.h" |
10 | #include "nouveau_acpi.h" | 10 | #include "nouveau_acpi.h" |
11 | 11 | ||
12 | #define NOUVEAU_DSM_LED 0x02 | 12 | #define NOUVEAU_DSM_LED 0x02 |
diff --git a/drivers/gpu/drm/nouveau/nouveau_backlight.c b/drivers/gpu/drm/nouveau/nouveau_backlight.c index 89eb46040b13..f5101be806cb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_backlight.c +++ b/drivers/gpu/drm/nouveau/nouveau_backlight.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include <linux/backlight.h> | 33 | #include <linux/backlight.h> |
34 | 34 | ||
35 | #include "nouveau_drm.h" | 35 | #include "nouveau_drv.h" |
36 | #include "nouveau_reg.h" | 36 | #include "nouveau_reg.h" |
37 | #include "nouveau_encoder.h" | 37 | #include "nouveau_encoder.h" |
38 | 38 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index 4dca65a63b92..a1570b109434 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | 26 | ||
27 | #include "nouveau_drm.h" | 27 | #include "nouveau_drv.h" |
28 | #include "nouveau_reg.h" | 28 | #include "nouveau_reg.h" |
29 | #include "dispnv04/hw.h" | 29 | #include "dispnv04/hw.h" |
30 | #include "nouveau_encoder.h" | 30 | #include "nouveau_encoder.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c index 74a8a2ca89ee..5e3f3e826476 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bo.c +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include <linux/dma-mapping.h> | 30 | #include <linux/dma-mapping.h> |
31 | #include <linux/swiotlb.h> | 31 | #include <linux/swiotlb.h> |
32 | 32 | ||
33 | #include "nouveau_drm.h" | 33 | #include "nouveau_drv.h" |
34 | #include "nouveau_dma.h" | 34 | #include "nouveau_dma.h" |
35 | #include "nouveau_fence.h" | 35 | #include "nouveau_fence.h" |
36 | 36 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c b/drivers/gpu/drm/nouveau/nouveau_chan.c index 879655c03ae9..b1d2527c5625 100644 --- a/drivers/gpu/drm/nouveau/nouveau_chan.c +++ b/drivers/gpu/drm/nouveau/nouveau_chan.c | |||
@@ -34,7 +34,7 @@ | |||
34 | /*XXX*/ | 34 | /*XXX*/ |
35 | #include <core/client.h> | 35 | #include <core/client.h> |
36 | 36 | ||
37 | #include "nouveau_drm.h" | 37 | #include "nouveau_drv.h" |
38 | #include "nouveau_dma.h" | 38 | #include "nouveau_dma.h" |
39 | #include "nouveau_bo.h" | 39 | #include "nouveau_bo.h" |
40 | #include "nouveau_chan.h" | 40 | #include "nouveau_chan.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index e81aefe5ffa7..c1084088f9e4 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <drm/drm_crtc_helper.h> | 34 | #include <drm/drm_crtc_helper.h> |
35 | 35 | ||
36 | #include "nouveau_reg.h" | 36 | #include "nouveau_reg.h" |
37 | #include "nouveau_drm.h" | 37 | #include "nouveau_drv.h" |
38 | #include "dispnv04/hw.h" | 38 | #include "dispnv04/hw.h" |
39 | #include "nouveau_acpi.h" | 39 | #include "nouveau_acpi.h" |
40 | 40 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.c b/drivers/gpu/drm/nouveau/nouveau_debugfs.c index 3d0dc199b253..411c12cdb249 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.c +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <nvif/class.h> | 32 | #include <nvif/class.h> |
33 | #include <nvif/if0001.h> | 33 | #include <nvif/if0001.h> |
34 | #include "nouveau_debugfs.h" | 34 | #include "nouveau_debugfs.h" |
35 | #include "nouveau_drm.h" | 35 | #include "nouveau_drv.h" |
36 | 36 | ||
37 | static int | 37 | static int |
38 | nouveau_debugfs_vbios_image(struct seq_file *m, void *data) | 38 | nouveau_debugfs_vbios_image(struct seq_file *m, void *data) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_debugfs.h b/drivers/gpu/drm/nouveau/nouveau_debugfs.h index b8c03ff5bf05..eab58811417a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_debugfs.h +++ b/drivers/gpu/drm/nouveau/nouveau_debugfs.h | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | #if defined(CONFIG_DEBUG_FS) | 6 | #if defined(CONFIG_DEBUG_FS) |
7 | 7 | ||
8 | #include "nouveau_drm.h" | 8 | #include "nouveau_drv.h" |
9 | 9 | ||
10 | struct nouveau_debugfs { | 10 | struct nouveau_debugfs { |
11 | struct nvif_object ctrl; | 11 | struct nvif_object ctrl; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_display.h b/drivers/gpu/drm/nouveau/nouveau_display.h index 5a57d8b472c4..24273bacd885 100644 --- a/drivers/gpu/drm/nouveau/nouveau_display.h +++ b/drivers/gpu/drm/nouveau/nouveau_display.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <subdev/mmu.h> | 4 | #include <subdev/mmu.h> |
5 | 5 | ||
6 | #include "nouveau_drm.h" | 6 | #include "nouveau_drv.h" |
7 | 7 | ||
8 | struct nouveau_framebuffer { | 8 | struct nouveau_framebuffer { |
9 | struct drm_framebuffer base; | 9 | struct drm_framebuffer base; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dma.c b/drivers/gpu/drm/nouveau/nouveau_dma.c index d168c63533c1..2634a1a79888 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dma.c +++ b/drivers/gpu/drm/nouveau/nouveau_dma.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "nouveau_drm.h" | 27 | #include "nouveau_drv.h" |
28 | #include "nouveau_dma.h" | 28 | #include "nouveau_dma.h" |
29 | 29 | ||
30 | void | 30 | void |
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index e17e15ec7d43..87d52d36f4fc 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | #include <drm/drm_dp_helper.h> | 26 | #include <drm/drm_dp_helper.h> |
27 | 27 | ||
28 | #include "nouveau_drm.h" | 28 | #include "nouveau_drv.h" |
29 | #include "nouveau_connector.h" | 29 | #include "nouveau_connector.h" |
30 | #include "nouveau_encoder.h" | 30 | #include "nouveau_encoder.h" |
31 | #include "nouveau_crtc.h" | 31 | #include "nouveau_crtc.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c index db5c7d0cc25c..11f8dd9c0edb 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.c +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c | |||
@@ -44,7 +44,7 @@ | |||
44 | #include <nvif/cla06f.h> | 44 | #include <nvif/cla06f.h> |
45 | #include <nvif/if0004.h> | 45 | #include <nvif/if0004.h> |
46 | 46 | ||
47 | #include "nouveau_drm.h" | 47 | #include "nouveau_drv.h" |
48 | #include "nouveau_dma.h" | 48 | #include "nouveau_dma.h" |
49 | #include "nouveau_ttm.h" | 49 | #include "nouveau_ttm.h" |
50 | #include "nouveau_gem.h" | 50 | #include "nouveau_gem.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 5c363ed1c842..822a0212cd48 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drm.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifndef __NOUVEAU_DRMCLI_H__ | 1 | #ifndef __NOUVEAU_DRV_H__ |
2 | #define __NOUVEAU_DRMCLI_H__ | 2 | #define __NOUVEAU_DRV_H__ |
3 | 3 | ||
4 | #define DRIVER_AUTHOR "Nouveau Project" | 4 | #define DRIVER_AUTHOR "Nouveau Project" |
5 | #define DRIVER_EMAIL "nouveau@lists.freedesktop.org" | 5 | #define DRIVER_EMAIL "nouveau@lists.freedesktop.org" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fbcon.c b/drivers/gpu/drm/nouveau/nouveau_fbcon.c index 3bae706126bd..57aaf98a26f9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #include <drm/drm_crtc_helper.h> | 43 | #include <drm/drm_crtc_helper.h> |
44 | #include <drm/drm_fb_helper.h> | 44 | #include <drm/drm_fb_helper.h> |
45 | 45 | ||
46 | #include "nouveau_drm.h" | 46 | #include "nouveau_drv.h" |
47 | #include "nouveau_gem.h" | 47 | #include "nouveau_gem.h" |
48 | #include "nouveau_bo.h" | 48 | #include "nouveau_bo.h" |
49 | #include "nouveau_fbcon.h" | 49 | #include "nouveau_fbcon.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 9a8c5b727f59..4bb9ab892ae1 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <nvif/notify.h> | 34 | #include <nvif/notify.h> |
35 | #include <nvif/event.h> | 35 | #include <nvif/event.h> |
36 | 36 | ||
37 | #include "nouveau_drm.h" | 37 | #include "nouveau_drv.h" |
38 | #include "nouveau_dma.h" | 38 | #include "nouveau_dma.h" |
39 | #include "nouveau_fence.h" | 39 | #include "nouveau_fence.h" |
40 | 40 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index a030e218adf7..72e2399bce39 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * | 24 | * |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "nouveau_drm.h" | 27 | #include "nouveau_drv.h" |
28 | #include "nouveau_dma.h" | 28 | #include "nouveau_dma.h" |
29 | #include "nouveau_fence.h" | 29 | #include "nouveau_fence.h" |
30 | #include "nouveau_abi16.h" | 30 | #include "nouveau_abi16.h" |
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.h b/drivers/gpu/drm/nouveau/nouveau_gem.h index e4049faca780..7e32da2e037a 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.h +++ b/drivers/gpu/drm/nouveau/nouveau_gem.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | #include <drm/drmP.h> | 4 | #include <drm/drmP.h> |
5 | 5 | ||
6 | #include "nouveau_drm.h" | 6 | #include "nouveau_drv.h" |
7 | #include "nouveau_bo.h" | 7 | #include "nouveau_bo.h" |
8 | 8 | ||
9 | #define nouveau_bo_tile_layout(nvbo) \ | 9 | #define nouveau_bo_tile_layout(nvbo) \ |
diff --git a/drivers/gpu/drm/nouveau/nouveau_hwmon.c b/drivers/gpu/drm/nouveau/nouveau_hwmon.c index 67edd2f5b71a..1ff4166af26e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_hwmon.c +++ b/drivers/gpu/drm/nouveau/nouveau_hwmon.c | |||
@@ -31,7 +31,7 @@ | |||
31 | 31 | ||
32 | #include <drm/drmP.h> | 32 | #include <drm/drmP.h> |
33 | 33 | ||
34 | #include "nouveau_drm.h" | 34 | #include "nouveau_drv.h" |
35 | #include "nouveau_hwmon.h" | 35 | #include "nouveau_hwmon.h" |
36 | 36 | ||
37 | #include <nvkm/subdev/iccsense.h> | 37 | #include <nvkm/subdev/iccsense.h> |
@@ -689,7 +689,7 @@ nouveau_hwmon_init(struct drm_device *dev) | |||
689 | goto error; | 689 | goto error; |
690 | } | 690 | } |
691 | 691 | ||
692 | if (iccsense && iccsense->data_valid && iccsense->rail_count) { | 692 | if (iccsense && iccsense->data_valid && !list_empty(&iccsense->rails)) { |
693 | ret = sysfs_create_group(&hwmon_dev->kobj, | 693 | ret = sysfs_create_group(&hwmon_dev->kobj, |
694 | &hwmon_power_attrgroup); | 694 | &hwmon_power_attrgroup); |
695 | if (ret) | 695 | if (ret) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_nvif.c b/drivers/gpu/drm/nouveau/nouveau_nvif.c index 55eb942847fa..15f0925ea13b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_nvif.c +++ b/drivers/gpu/drm/nouveau/nouveau_nvif.c | |||
@@ -36,7 +36,7 @@ | |||
36 | #include <nvif/event.h> | 36 | #include <nvif/event.h> |
37 | #include <nvif/ioctl.h> | 37 | #include <nvif/ioctl.h> |
38 | 38 | ||
39 | #include "nouveau_drm.h" | 39 | #include "nouveau_drv.h" |
40 | #include "nouveau_usif.h" | 40 | #include "nouveau_usif.h" |
41 | 41 | ||
42 | static void | 42 | static void |
diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.h b/drivers/gpu/drm/nouveau/nouveau_platform.h index f41056d0f5f4..a90d72767b8b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_platform.h +++ b/drivers/gpu/drm/nouveau/nouveau_platform.h | |||
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | #ifndef __NOUVEAU_PLATFORM_H__ | 22 | #ifndef __NOUVEAU_PLATFORM_H__ |
23 | #define __NOUVEAU_PLATFORM_H__ | 23 | #define __NOUVEAU_PLATFORM_H__ |
24 | #include "nouveau_drm.h" | 24 | #include "nouveau_drv.h" |
25 | 25 | ||
26 | extern struct platform_driver nouveau_platform_driver; | 26 | extern struct platform_driver nouveau_platform_driver; |
27 | #endif | 27 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nouveau_prime.c b/drivers/gpu/drm/nouveau/nouveau_prime.c index dd32ad6db53d..a0a9704cfe2b 100644 --- a/drivers/gpu/drm/nouveau/nouveau_prime.c +++ b/drivers/gpu/drm/nouveau/nouveau_prime.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <drm/drmP.h> | 25 | #include <drm/drmP.h> |
26 | #include <linux/dma-buf.h> | 26 | #include <linux/dma-buf.h> |
27 | 27 | ||
28 | #include "nouveau_drm.h" | 28 | #include "nouveau_drv.h" |
29 | #include "nouveau_gem.h" | 29 | #include "nouveau_gem.h" |
30 | 30 | ||
31 | struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *obj) | 31 | struct sg_table *nouveau_gem_prime_get_sg_table(struct drm_gem_object *obj) |
diff --git a/drivers/gpu/drm/nouveau/nouveau_sgdma.c b/drivers/gpu/drm/nouveau/nouveau_sgdma.c index 8c3053a177d6..db35ab5883ac 100644 --- a/drivers/gpu/drm/nouveau/nouveau_sgdma.c +++ b/drivers/gpu/drm/nouveau/nouveau_sgdma.c | |||
@@ -1,7 +1,7 @@ | |||
1 | #include <linux/pagemap.h> | 1 | #include <linux/pagemap.h> |
2 | #include <linux/slab.h> | 2 | #include <linux/slab.h> |
3 | 3 | ||
4 | #include "nouveau_drm.h" | 4 | #include "nouveau_drv.h" |
5 | #include "nouveau_ttm.h" | 5 | #include "nouveau_ttm.h" |
6 | 6 | ||
7 | struct nouveau_sgdma_be { | 7 | struct nouveau_sgdma_be { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_ttm.c b/drivers/gpu/drm/nouveau/nouveau_ttm.c index d2e7d209f651..bcee91497eb9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_ttm.c +++ b/drivers/gpu/drm/nouveau/nouveau_ttm.c | |||
@@ -24,7 +24,7 @@ | |||
24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. | 24 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include "nouveau_drm.h" | 27 | #include "nouveau_drv.h" |
28 | #include "nouveau_ttm.h" | 28 | #include "nouveau_ttm.h" |
29 | #include "nouveau_gem.h" | 29 | #include "nouveau_gem.h" |
30 | 30 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_usif.c b/drivers/gpu/drm/nouveau/nouveau_usif.c index e9f52ef0be83..675e9e077a95 100644 --- a/drivers/gpu/drm/nouveau/nouveau_usif.c +++ b/drivers/gpu/drm/nouveau/nouveau_usif.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | 22 | * Authors: Ben Skeggs <bskeggs@redhat.com> |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_usif.h" | 26 | #include "nouveau_usif.h" |
27 | #include "nouveau_abi16.h" | 27 | #include "nouveau_abi16.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c index af89c3665b2a..c6a180a0c284 100644 --- a/drivers/gpu/drm/nouveau/nouveau_vga.c +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c | |||
@@ -4,7 +4,7 @@ | |||
4 | #include <drm/drmP.h> | 4 | #include <drm/drmP.h> |
5 | #include <drm/drm_crtc_helper.h> | 5 | #include <drm/drm_crtc_helper.h> |
6 | 6 | ||
7 | #include "nouveau_drm.h" | 7 | #include "nouveau_drv.h" |
8 | #include "nouveau_acpi.h" | 8 | #include "nouveau_acpi.h" |
9 | #include "nouveau_fbcon.h" | 9 | #include "nouveau_fbcon.h" |
10 | #include "nouveau_vga.h" | 10 | #include "nouveau_vga.h" |
diff --git a/drivers/gpu/drm/nouveau/nv04_fbcon.c b/drivers/gpu/drm/nouveau/nv04_fbcon.c index 789dc2993b0d..0f3e4bb411cc 100644 --- a/drivers/gpu/drm/nouveau/nv04_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv04_fbcon.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * DEALINGS IN THE SOFTWARE. | 22 | * DEALINGS IN THE SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nouveau_fbcon.h" | 27 | #include "nouveau_fbcon.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nv04_fence.c b/drivers/gpu/drm/nouveau/nv04_fence.c index 3022d24ed88b..1915b7b82a59 100644 --- a/drivers/gpu/drm/nouveau/nv04_fence.c +++ b/drivers/gpu/drm/nouveau/nv04_fence.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs | 22 | * Authors: Ben Skeggs |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nouveau_fence.h" | 27 | #include "nouveau_fence.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nv10_fence.c b/drivers/gpu/drm/nouveau/nv10_fence.c index 2c35213da275..4e3de34ff6f4 100644 --- a/drivers/gpu/drm/nouveau/nv10_fence.c +++ b/drivers/gpu/drm/nouveau/nv10_fence.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | 22 | * Authors: Ben Skeggs <bskeggs@redhat.com> |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nv10_fence.h" | 27 | #include "nv10_fence.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nv17_fence.c b/drivers/gpu/drm/nouveau/nv17_fence.c index 6a141c9bf5b7..7d5e562a55c5 100644 --- a/drivers/gpu/drm/nouveau/nv17_fence.c +++ b/drivers/gpu/drm/nouveau/nv17_fence.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <nvif/class.h> | 26 | #include <nvif/class.h> |
27 | #include <nvif/cl0002.h> | 27 | #include <nvif/cl0002.h> |
28 | 28 | ||
29 | #include "nouveau_drm.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_dma.h" | 30 | #include "nouveau_dma.h" |
31 | #include "nv10_fence.h" | 31 | #include "nv10_fence.h" |
32 | 32 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index ec2e67eb8980..3ffc2b0057bf 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <nvif/cl507d.h> | 39 | #include <nvif/cl507d.h> |
40 | #include <nvif/cl507e.h> | 40 | #include <nvif/cl507e.h> |
41 | 41 | ||
42 | #include "nouveau_drm.h" | 42 | #include "nouveau_drv.h" |
43 | #include "nouveau_dma.h" | 43 | #include "nouveau_dma.h" |
44 | #include "nouveau_gem.h" | 44 | #include "nouveau_gem.h" |
45 | #include "nouveau_connector.h" | 45 | #include "nouveau_connector.h" |
diff --git a/drivers/gpu/drm/nouveau/nv50_fbcon.c b/drivers/gpu/drm/nouveau/nv50_fbcon.c index e05499d6ed83..33d9ee0fac40 100644 --- a/drivers/gpu/drm/nouveau/nv50_fbcon.c +++ b/drivers/gpu/drm/nouveau/nv50_fbcon.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs | 22 | * Authors: Ben Skeggs |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nouveau_fbcon.h" | 27 | #include "nouveau_fbcon.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nv50_fence.c b/drivers/gpu/drm/nouveau/nv50_fence.c index 3695ccce68c7..4d6f202b7770 100644 --- a/drivers/gpu/drm/nouveau/nv50_fence.c +++ b/drivers/gpu/drm/nouveau/nv50_fence.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include <nvif/class.h> | 26 | #include <nvif/class.h> |
27 | #include <nvif/cl0002.h> | 27 | #include <nvif/cl0002.h> |
28 | 28 | ||
29 | #include "nouveau_drm.h" | 29 | #include "nouveau_drv.h" |
30 | #include "nouveau_dma.h" | 30 | #include "nouveau_dma.h" |
31 | #include "nv10_fence.h" | 31 | #include "nv10_fence.h" |
32 | 32 | ||
diff --git a/drivers/gpu/drm/nouveau/nv84_fence.c b/drivers/gpu/drm/nouveau/nv84_fence.c index 412c5be5a9ca..18bde9d8e6d6 100644 --- a/drivers/gpu/drm/nouveau/nv84_fence.c +++ b/drivers/gpu/drm/nouveau/nv84_fence.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs | 22 | * Authors: Ben Skeggs |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nouveau_fence.h" | 27 | #include "nouveau_fence.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_fbcon.c b/drivers/gpu/drm/nouveau/nvc0_fbcon.c index c97395b4a312..a0913359ac05 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fbcon.c +++ b/drivers/gpu/drm/nouveau/nvc0_fbcon.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs | 22 | * Authors: Ben Skeggs |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nouveau_fbcon.h" | 27 | #include "nouveau_fbcon.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nvc0_fence.c b/drivers/gpu/drm/nouveau/nvc0_fence.c index becf19abda2d..b79775788bbd 100644 --- a/drivers/gpu/drm/nouveau/nvc0_fence.c +++ b/drivers/gpu/drm/nouveau/nvc0_fence.c | |||
@@ -22,7 +22,7 @@ | |||
22 | * Authors: Ben Skeggs | 22 | * Authors: Ben Skeggs |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "nouveau_drm.h" | 25 | #include "nouveau_drv.h" |
26 | #include "nouveau_dma.h" | 26 | #include "nouveau_dma.h" |
27 | #include "nouveau_fence.h" | 27 | #include "nouveau_fence.h" |
28 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/engine.c b/drivers/gpu/drm/nouveau/nvkm/core/engine.c index 8a7bae7bd995..ee8e5831fe37 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/engine.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/engine.c | |||
@@ -137,11 +137,10 @@ nvkm_engine_func = { | |||
137 | 137 | ||
138 | int | 138 | int |
139 | nvkm_engine_ctor(const struct nvkm_engine_func *func, | 139 | nvkm_engine_ctor(const struct nvkm_engine_func *func, |
140 | struct nvkm_device *device, int index, u32 pmc_enable, | 140 | struct nvkm_device *device, int index, bool enable, |
141 | bool enable, struct nvkm_engine *engine) | 141 | struct nvkm_engine *engine) |
142 | { | 142 | { |
143 | nvkm_subdev_ctor(&nvkm_engine_func, device, index, | 143 | nvkm_subdev_ctor(&nvkm_engine_func, device, index, &engine->subdev); |
144 | pmc_enable, &engine->subdev); | ||
145 | engine->func = func; | 144 | engine->func = func; |
146 | 145 | ||
147 | if (!nvkm_boolopt(device->cfgopt, nvkm_subdev_name[index], enable)) { | 146 | if (!nvkm_boolopt(device->cfgopt, nvkm_subdev_name[index], enable)) { |
@@ -155,11 +154,10 @@ nvkm_engine_ctor(const struct nvkm_engine_func *func, | |||
155 | 154 | ||
156 | int | 155 | int |
157 | nvkm_engine_new_(const struct nvkm_engine_func *func, | 156 | nvkm_engine_new_(const struct nvkm_engine_func *func, |
158 | struct nvkm_device *device, int index, u32 pmc_enable, | 157 | struct nvkm_device *device, int index, bool enable, |
159 | bool enable, struct nvkm_engine **pengine) | 158 | struct nvkm_engine **pengine) |
160 | { | 159 | { |
161 | if (!(*pengine = kzalloc(sizeof(**pengine), GFP_KERNEL))) | 160 | if (!(*pengine = kzalloc(sizeof(**pengine), GFP_KERNEL))) |
162 | return -ENOMEM; | 161 | return -ENOMEM; |
163 | return nvkm_engine_ctor(func, device, index, pmc_enable, | 162 | return nvkm_engine_ctor(func, device, index, enable, *pengine); |
164 | enable, *pengine); | ||
165 | } | 163 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c index 3bf08cb1a289..b18557858f19 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/subdev.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/subdev.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <core/subdev.h> | 24 | #include <core/subdev.h> |
25 | #include <core/device.h> | 25 | #include <core/device.h> |
26 | #include <core/option.h> | 26 | #include <core/option.h> |
27 | #include <subdev/mc.h> | ||
27 | 28 | ||
28 | static struct lock_class_key nvkm_subdev_lock_class[NVKM_SUBDEV_NR]; | 29 | static struct lock_class_key nvkm_subdev_lock_class[NVKM_SUBDEV_NR]; |
29 | 30 | ||
@@ -50,6 +51,7 @@ nvkm_subdev_name[NVKM_SUBDEV_NR] = { | |||
50 | [NVKM_SUBDEV_SECBOOT ] = "secboot", | 51 | [NVKM_SUBDEV_SECBOOT ] = "secboot", |
51 | [NVKM_SUBDEV_THERM ] = "therm", | 52 | [NVKM_SUBDEV_THERM ] = "therm", |
52 | [NVKM_SUBDEV_TIMER ] = "tmr", | 53 | [NVKM_SUBDEV_TIMER ] = "tmr", |
54 | [NVKM_SUBDEV_TOP ] = "top", | ||
53 | [NVKM_SUBDEV_VOLT ] = "volt", | 55 | [NVKM_SUBDEV_VOLT ] = "volt", |
54 | [NVKM_ENGINE_BSP ] = "bsp", | 56 | [NVKM_ENGINE_BSP ] = "bsp", |
55 | [NVKM_ENGINE_CE0 ] = "ce0", | 57 | [NVKM_ENGINE_CE0 ] = "ce0", |
@@ -89,7 +91,6 @@ nvkm_subdev_fini(struct nvkm_subdev *subdev, bool suspend) | |||
89 | { | 91 | { |
90 | struct nvkm_device *device = subdev->device; | 92 | struct nvkm_device *device = subdev->device; |
91 | const char *action = suspend ? "suspend" : "fini"; | 93 | const char *action = suspend ? "suspend" : "fini"; |
92 | u32 pmc_enable = subdev->pmc_enable; | ||
93 | s64 time; | 94 | s64 time; |
94 | 95 | ||
95 | nvkm_trace(subdev, "%s running...\n", action); | 96 | nvkm_trace(subdev, "%s running...\n", action); |
@@ -104,11 +105,7 @@ nvkm_subdev_fini(struct nvkm_subdev *subdev, bool suspend) | |||
104 | } | 105 | } |
105 | } | 106 | } |
106 | 107 | ||
107 | if (pmc_enable) { | 108 | nvkm_mc_reset(device->mc, subdev->index); |
108 | nvkm_mask(device, 0x000200, pmc_enable, 0x00000000); | ||
109 | nvkm_mask(device, 0x000200, pmc_enable, pmc_enable); | ||
110 | nvkm_rd32(device, 0x000200); | ||
111 | } | ||
112 | 109 | ||
113 | time = ktime_to_us(ktime_get()) - time; | 110 | time = ktime_to_us(ktime_get()) - time; |
114 | nvkm_trace(subdev, "%s completed in %lldus\n", action, time); | 111 | nvkm_trace(subdev, "%s completed in %lldus\n", action, time); |
@@ -193,14 +190,13 @@ nvkm_subdev_del(struct nvkm_subdev **psubdev) | |||
193 | 190 | ||
194 | void | 191 | void |
195 | nvkm_subdev_ctor(const struct nvkm_subdev_func *func, | 192 | nvkm_subdev_ctor(const struct nvkm_subdev_func *func, |
196 | struct nvkm_device *device, int index, u32 pmc_enable, | 193 | struct nvkm_device *device, int index, |
197 | struct nvkm_subdev *subdev) | 194 | struct nvkm_subdev *subdev) |
198 | { | 195 | { |
199 | const char *name = nvkm_subdev_name[index]; | 196 | const char *name = nvkm_subdev_name[index]; |
200 | subdev->func = func; | 197 | subdev->func = func; |
201 | subdev->device = device; | 198 | subdev->device = device; |
202 | subdev->index = index; | 199 | subdev->index = index; |
203 | subdev->pmc_enable = pmc_enable; | ||
204 | 200 | ||
205 | __mutex_init(&subdev->mutex, name, &nvkm_subdev_lock_class[index]); | 201 | __mutex_init(&subdev->mutex, name, &nvkm_subdev_lock_class[index]); |
206 | subdev->debug = nvkm_dbgopt(device->dbgopt, name); | 202 | subdev->debug = nvkm_dbgopt(device->dbgopt, name); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/bsp/g84.c b/drivers/gpu/drm/nouveau/nvkm/engine/bsp/g84.c index 3ef01071f073..8e2e24a74774 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/bsp/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/bsp/g84.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_xtensa_func | 28 | static const struct nvkm_xtensa_func |
29 | g84_bsp = { | 29 | g84_bsp = { |
30 | .pmc_enable = 0x04008000, | ||
31 | .fifo_val = 0x1111, | 30 | .fifo_val = 0x1111, |
32 | .unkd28 = 0x90044, | 31 | .unkd28 = 0x90044, |
33 | .sclass = { | 32 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c index 92a9f35df1a6..ad9f855c9a40 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gf100.c | |||
@@ -40,7 +40,6 @@ gf100_ce0 = { | |||
40 | .code.size = sizeof(gf100_ce_code), | 40 | .code.size = sizeof(gf100_ce_code), |
41 | .data.data = gf100_ce_data, | 41 | .data.data = gf100_ce_data, |
42 | .data.size = sizeof(gf100_ce_data), | 42 | .data.size = sizeof(gf100_ce_data), |
43 | .pmc_enable = 0x00000040, | ||
44 | .init = gf100_ce_init, | 43 | .init = gf100_ce_init, |
45 | .intr = gt215_ce_intr, | 44 | .intr = gt215_ce_intr, |
46 | .sclass = { | 45 | .sclass = { |
@@ -55,7 +54,6 @@ gf100_ce1 = { | |||
55 | .code.size = sizeof(gf100_ce_code), | 54 | .code.size = sizeof(gf100_ce_code), |
56 | .data.data = gf100_ce_data, | 55 | .data.data = gf100_ce_data, |
57 | .data.size = sizeof(gf100_ce_data), | 56 | .data.size = sizeof(gf100_ce_data), |
58 | .pmc_enable = 0x00000080, | ||
59 | .init = gf100_ce_init, | 57 | .init = gf100_ce_init, |
60 | .intr = gt215_ce_intr, | 58 | .intr = gt215_ce_intr, |
61 | .sclass = { | 59 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gk104.c index e2b944dce9b8..9e0b53a10f77 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gk104.c | |||
@@ -97,17 +97,5 @@ int | |||
97 | gk104_ce_new(struct nvkm_device *device, int index, | 97 | gk104_ce_new(struct nvkm_device *device, int index, |
98 | struct nvkm_engine **pengine) | 98 | struct nvkm_engine **pengine) |
99 | { | 99 | { |
100 | if (index == NVKM_ENGINE_CE0) { | 100 | return nvkm_engine_new_(&gk104_ce, device, index, true, pengine); |
101 | return nvkm_engine_new_(&gk104_ce, device, index, | ||
102 | 0x00000040, true, pengine); | ||
103 | } else | ||
104 | if (index == NVKM_ENGINE_CE1) { | ||
105 | return nvkm_engine_new_(&gk104_ce, device, index, | ||
106 | 0x00000080, true, pengine); | ||
107 | } else | ||
108 | if (index == NVKM_ENGINE_CE2) { | ||
109 | return nvkm_engine_new_(&gk104_ce, device, index, | ||
110 | 0x00200000, true, pengine); | ||
111 | } | ||
112 | return -ENODEV; | ||
113 | } | 101 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c index 4c2f42919c1f..c0df7daa85e2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm107.c | |||
@@ -39,17 +39,5 @@ int | |||
39 | gm107_ce_new(struct nvkm_device *device, int index, | 39 | gm107_ce_new(struct nvkm_device *device, int index, |
40 | struct nvkm_engine **pengine) | 40 | struct nvkm_engine **pengine) |
41 | { | 41 | { |
42 | if (index == NVKM_ENGINE_CE0) { | 42 | return nvkm_engine_new_(&gm107_ce, device, index, true, pengine); |
43 | return nvkm_engine_new_(&gm107_ce, device, index, | ||
44 | 0x00000040, true, pengine); | ||
45 | } else | ||
46 | if (index == NVKM_ENGINE_CE1) { | ||
47 | return nvkm_engine_new_(&gm107_ce, device, index, | ||
48 | 0x00000080, true, pengine); | ||
49 | } else | ||
50 | if (index == NVKM_ENGINE_CE2) { | ||
51 | return nvkm_engine_new_(&gm107_ce, device, index, | ||
52 | 0x00200000, true, pengine); | ||
53 | } | ||
54 | return -ENODEV; | ||
55 | } | 43 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c index 13f07b32cd9c..c6fa8b20737e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gm200.c | |||
@@ -38,17 +38,5 @@ int | |||
38 | gm200_ce_new(struct nvkm_device *device, int index, | 38 | gm200_ce_new(struct nvkm_device *device, int index, |
39 | struct nvkm_engine **pengine) | 39 | struct nvkm_engine **pengine) |
40 | { | 40 | { |
41 | if (index == NVKM_ENGINE_CE0) { | 41 | return nvkm_engine_new_(&gm200_ce, device, index, true, pengine); |
42 | return nvkm_engine_new_(&gm200_ce, device, index, | ||
43 | 0x00000040, true, pengine); | ||
44 | } else | ||
45 | if (index == NVKM_ENGINE_CE1) { | ||
46 | return nvkm_engine_new_(&gm200_ce, device, index, | ||
47 | 0x00000080, true, pengine); | ||
48 | } else | ||
49 | if (index == NVKM_ENGINE_CE2) { | ||
50 | return nvkm_engine_new_(&gm200_ce, device, index, | ||
51 | 0x00200000, true, pengine); | ||
52 | } | ||
53 | return -ENODEV; | ||
54 | } | 42 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c index 402dcbcc2192..63ac51a54fd3 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/ce/gt215.c | |||
@@ -67,7 +67,6 @@ gt215_ce = { | |||
67 | .code.size = sizeof(gt215_ce_code), | 67 | .code.size = sizeof(gt215_ce_code), |
68 | .data.data = gt215_ce_data, | 68 | .data.data = gt215_ce_data, |
69 | .data.size = sizeof(gt215_ce_data), | 69 | .data.size = sizeof(gt215_ce_data), |
70 | .pmc_enable = 0x00802000, | ||
71 | .intr = gt215_ce_intr, | 70 | .intr = gt215_ce_intr, |
72 | .sclass = { | 71 | .sclass = { |
73 | { -1, -1, GT212_DMA }, | 72 | { -1, -1, GT212_DMA }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c b/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c index bfd01625ec7f..68ffb520531e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/cipher/g84.c | |||
@@ -130,6 +130,5 @@ int | |||
130 | g84_cipher_new(struct nvkm_device *device, int index, | 130 | g84_cipher_new(struct nvkm_device *device, int index, |
131 | struct nvkm_engine **pengine) | 131 | struct nvkm_engine **pengine) |
132 | { | 132 | { |
133 | return nvkm_engine_new_(&g84_cipher, device, index, | 133 | return nvkm_engine_new_(&g84_cipher, device, index, true, pengine); |
134 | 0x00004000, true, pengine); | ||
135 | } | 134 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c index 9f32c8739254..4572debcb0c9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/base.c | |||
@@ -146,7 +146,7 @@ nv11_chipset = { | |||
146 | .gpio = nv10_gpio_new, | 146 | .gpio = nv10_gpio_new, |
147 | .i2c = nv04_i2c_new, | 147 | .i2c = nv04_i2c_new, |
148 | .imem = nv04_instmem_new, | 148 | .imem = nv04_instmem_new, |
149 | .mc = nv04_mc_new, | 149 | .mc = nv11_mc_new, |
150 | .mmu = nv04_mmu_new, | 150 | .mmu = nv04_mmu_new, |
151 | .pci = nv04_pci_new, | 151 | .pci = nv04_pci_new, |
152 | .timer = nv04_timer_new, | 152 | .timer = nv04_timer_new, |
@@ -190,7 +190,7 @@ nv17_chipset = { | |||
190 | .gpio = nv10_gpio_new, | 190 | .gpio = nv10_gpio_new, |
191 | .i2c = nv04_i2c_new, | 191 | .i2c = nv04_i2c_new, |
192 | .imem = nv04_instmem_new, | 192 | .imem = nv04_instmem_new, |
193 | .mc = nv04_mc_new, | 193 | .mc = nv17_mc_new, |
194 | .mmu = nv04_mmu_new, | 194 | .mmu = nv04_mmu_new, |
195 | .pci = nv04_pci_new, | 195 | .pci = nv04_pci_new, |
196 | .timer = nv04_timer_new, | 196 | .timer = nv04_timer_new, |
@@ -212,7 +212,7 @@ nv18_chipset = { | |||
212 | .gpio = nv10_gpio_new, | 212 | .gpio = nv10_gpio_new, |
213 | .i2c = nv04_i2c_new, | 213 | .i2c = nv04_i2c_new, |
214 | .imem = nv04_instmem_new, | 214 | .imem = nv04_instmem_new, |
215 | .mc = nv04_mc_new, | 215 | .mc = nv17_mc_new, |
216 | .mmu = nv04_mmu_new, | 216 | .mmu = nv04_mmu_new, |
217 | .pci = nv04_pci_new, | 217 | .pci = nv04_pci_new, |
218 | .timer = nv04_timer_new, | 218 | .timer = nv04_timer_new, |
@@ -256,7 +256,7 @@ nv1f_chipset = { | |||
256 | .gpio = nv10_gpio_new, | 256 | .gpio = nv10_gpio_new, |
257 | .i2c = nv04_i2c_new, | 257 | .i2c = nv04_i2c_new, |
258 | .imem = nv04_instmem_new, | 258 | .imem = nv04_instmem_new, |
259 | .mc = nv04_mc_new, | 259 | .mc = nv17_mc_new, |
260 | .mmu = nv04_mmu_new, | 260 | .mmu = nv04_mmu_new, |
261 | .pci = nv04_pci_new, | 261 | .pci = nv04_pci_new, |
262 | .timer = nv04_timer_new, | 262 | .timer = nv04_timer_new, |
@@ -278,7 +278,7 @@ nv20_chipset = { | |||
278 | .gpio = nv10_gpio_new, | 278 | .gpio = nv10_gpio_new, |
279 | .i2c = nv04_i2c_new, | 279 | .i2c = nv04_i2c_new, |
280 | .imem = nv04_instmem_new, | 280 | .imem = nv04_instmem_new, |
281 | .mc = nv04_mc_new, | 281 | .mc = nv17_mc_new, |
282 | .mmu = nv04_mmu_new, | 282 | .mmu = nv04_mmu_new, |
283 | .pci = nv04_pci_new, | 283 | .pci = nv04_pci_new, |
284 | .timer = nv04_timer_new, | 284 | .timer = nv04_timer_new, |
@@ -300,7 +300,7 @@ nv25_chipset = { | |||
300 | .gpio = nv10_gpio_new, | 300 | .gpio = nv10_gpio_new, |
301 | .i2c = nv04_i2c_new, | 301 | .i2c = nv04_i2c_new, |
302 | .imem = nv04_instmem_new, | 302 | .imem = nv04_instmem_new, |
303 | .mc = nv04_mc_new, | 303 | .mc = nv17_mc_new, |
304 | .mmu = nv04_mmu_new, | 304 | .mmu = nv04_mmu_new, |
305 | .pci = nv04_pci_new, | 305 | .pci = nv04_pci_new, |
306 | .timer = nv04_timer_new, | 306 | .timer = nv04_timer_new, |
@@ -322,7 +322,7 @@ nv28_chipset = { | |||
322 | .gpio = nv10_gpio_new, | 322 | .gpio = nv10_gpio_new, |
323 | .i2c = nv04_i2c_new, | 323 | .i2c = nv04_i2c_new, |
324 | .imem = nv04_instmem_new, | 324 | .imem = nv04_instmem_new, |
325 | .mc = nv04_mc_new, | 325 | .mc = nv17_mc_new, |
326 | .mmu = nv04_mmu_new, | 326 | .mmu = nv04_mmu_new, |
327 | .pci = nv04_pci_new, | 327 | .pci = nv04_pci_new, |
328 | .timer = nv04_timer_new, | 328 | .timer = nv04_timer_new, |
@@ -344,7 +344,7 @@ nv2a_chipset = { | |||
344 | .gpio = nv10_gpio_new, | 344 | .gpio = nv10_gpio_new, |
345 | .i2c = nv04_i2c_new, | 345 | .i2c = nv04_i2c_new, |
346 | .imem = nv04_instmem_new, | 346 | .imem = nv04_instmem_new, |
347 | .mc = nv04_mc_new, | 347 | .mc = nv17_mc_new, |
348 | .mmu = nv04_mmu_new, | 348 | .mmu = nv04_mmu_new, |
349 | .pci = nv04_pci_new, | 349 | .pci = nv04_pci_new, |
350 | .timer = nv04_timer_new, | 350 | .timer = nv04_timer_new, |
@@ -366,7 +366,7 @@ nv30_chipset = { | |||
366 | .gpio = nv10_gpio_new, | 366 | .gpio = nv10_gpio_new, |
367 | .i2c = nv04_i2c_new, | 367 | .i2c = nv04_i2c_new, |
368 | .imem = nv04_instmem_new, | 368 | .imem = nv04_instmem_new, |
369 | .mc = nv04_mc_new, | 369 | .mc = nv17_mc_new, |
370 | .mmu = nv04_mmu_new, | 370 | .mmu = nv04_mmu_new, |
371 | .pci = nv04_pci_new, | 371 | .pci = nv04_pci_new, |
372 | .timer = nv04_timer_new, | 372 | .timer = nv04_timer_new, |
@@ -388,7 +388,7 @@ nv31_chipset = { | |||
388 | .gpio = nv10_gpio_new, | 388 | .gpio = nv10_gpio_new, |
389 | .i2c = nv04_i2c_new, | 389 | .i2c = nv04_i2c_new, |
390 | .imem = nv04_instmem_new, | 390 | .imem = nv04_instmem_new, |
391 | .mc = nv04_mc_new, | 391 | .mc = nv17_mc_new, |
392 | .mmu = nv04_mmu_new, | 392 | .mmu = nv04_mmu_new, |
393 | .pci = nv04_pci_new, | 393 | .pci = nv04_pci_new, |
394 | .timer = nv04_timer_new, | 394 | .timer = nv04_timer_new, |
@@ -411,7 +411,7 @@ nv34_chipset = { | |||
411 | .gpio = nv10_gpio_new, | 411 | .gpio = nv10_gpio_new, |
412 | .i2c = nv04_i2c_new, | 412 | .i2c = nv04_i2c_new, |
413 | .imem = nv04_instmem_new, | 413 | .imem = nv04_instmem_new, |
414 | .mc = nv04_mc_new, | 414 | .mc = nv17_mc_new, |
415 | .mmu = nv04_mmu_new, | 415 | .mmu = nv04_mmu_new, |
416 | .pci = nv04_pci_new, | 416 | .pci = nv04_pci_new, |
417 | .timer = nv04_timer_new, | 417 | .timer = nv04_timer_new, |
@@ -434,7 +434,7 @@ nv35_chipset = { | |||
434 | .gpio = nv10_gpio_new, | 434 | .gpio = nv10_gpio_new, |
435 | .i2c = nv04_i2c_new, | 435 | .i2c = nv04_i2c_new, |
436 | .imem = nv04_instmem_new, | 436 | .imem = nv04_instmem_new, |
437 | .mc = nv04_mc_new, | 437 | .mc = nv17_mc_new, |
438 | .mmu = nv04_mmu_new, | 438 | .mmu = nv04_mmu_new, |
439 | .pci = nv04_pci_new, | 439 | .pci = nv04_pci_new, |
440 | .timer = nv04_timer_new, | 440 | .timer = nv04_timer_new, |
@@ -456,7 +456,7 @@ nv36_chipset = { | |||
456 | .gpio = nv10_gpio_new, | 456 | .gpio = nv10_gpio_new, |
457 | .i2c = nv04_i2c_new, | 457 | .i2c = nv04_i2c_new, |
458 | .imem = nv04_instmem_new, | 458 | .imem = nv04_instmem_new, |
459 | .mc = nv04_mc_new, | 459 | .mc = nv17_mc_new, |
460 | .mmu = nv04_mmu_new, | 460 | .mmu = nv04_mmu_new, |
461 | .pci = nv04_pci_new, | 461 | .pci = nv04_pci_new, |
462 | .timer = nv04_timer_new, | 462 | .timer = nv04_timer_new, |
@@ -479,7 +479,7 @@ nv40_chipset = { | |||
479 | .gpio = nv10_gpio_new, | 479 | .gpio = nv10_gpio_new, |
480 | .i2c = nv04_i2c_new, | 480 | .i2c = nv04_i2c_new, |
481 | .imem = nv40_instmem_new, | 481 | .imem = nv40_instmem_new, |
482 | .mc = nv04_mc_new, | 482 | .mc = nv17_mc_new, |
483 | .mmu = nv04_mmu_new, | 483 | .mmu = nv04_mmu_new, |
484 | .pci = nv40_pci_new, | 484 | .pci = nv40_pci_new, |
485 | .therm = nv40_therm_new, | 485 | .therm = nv40_therm_new, |
@@ -505,7 +505,7 @@ nv41_chipset = { | |||
505 | .gpio = nv10_gpio_new, | 505 | .gpio = nv10_gpio_new, |
506 | .i2c = nv04_i2c_new, | 506 | .i2c = nv04_i2c_new, |
507 | .imem = nv40_instmem_new, | 507 | .imem = nv40_instmem_new, |
508 | .mc = nv04_mc_new, | 508 | .mc = nv17_mc_new, |
509 | .mmu = nv41_mmu_new, | 509 | .mmu = nv41_mmu_new, |
510 | .pci = nv40_pci_new, | 510 | .pci = nv40_pci_new, |
511 | .therm = nv40_therm_new, | 511 | .therm = nv40_therm_new, |
@@ -531,7 +531,7 @@ nv42_chipset = { | |||
531 | .gpio = nv10_gpio_new, | 531 | .gpio = nv10_gpio_new, |
532 | .i2c = nv04_i2c_new, | 532 | .i2c = nv04_i2c_new, |
533 | .imem = nv40_instmem_new, | 533 | .imem = nv40_instmem_new, |
534 | .mc = nv04_mc_new, | 534 | .mc = nv17_mc_new, |
535 | .mmu = nv41_mmu_new, | 535 | .mmu = nv41_mmu_new, |
536 | .pci = nv40_pci_new, | 536 | .pci = nv40_pci_new, |
537 | .therm = nv40_therm_new, | 537 | .therm = nv40_therm_new, |
@@ -557,7 +557,7 @@ nv43_chipset = { | |||
557 | .gpio = nv10_gpio_new, | 557 | .gpio = nv10_gpio_new, |
558 | .i2c = nv04_i2c_new, | 558 | .i2c = nv04_i2c_new, |
559 | .imem = nv40_instmem_new, | 559 | .imem = nv40_instmem_new, |
560 | .mc = nv04_mc_new, | 560 | .mc = nv17_mc_new, |
561 | .mmu = nv41_mmu_new, | 561 | .mmu = nv41_mmu_new, |
562 | .pci = nv40_pci_new, | 562 | .pci = nv40_pci_new, |
563 | .therm = nv40_therm_new, | 563 | .therm = nv40_therm_new, |
@@ -609,7 +609,7 @@ nv45_chipset = { | |||
609 | .gpio = nv10_gpio_new, | 609 | .gpio = nv10_gpio_new, |
610 | .i2c = nv04_i2c_new, | 610 | .i2c = nv04_i2c_new, |
611 | .imem = nv40_instmem_new, | 611 | .imem = nv40_instmem_new, |
612 | .mc = nv04_mc_new, | 612 | .mc = nv17_mc_new, |
613 | .mmu = nv04_mmu_new, | 613 | .mmu = nv04_mmu_new, |
614 | .pci = nv40_pci_new, | 614 | .pci = nv40_pci_new, |
615 | .therm = nv40_therm_new, | 615 | .therm = nv40_therm_new, |
@@ -661,7 +661,7 @@ nv47_chipset = { | |||
661 | .gpio = nv10_gpio_new, | 661 | .gpio = nv10_gpio_new, |
662 | .i2c = nv04_i2c_new, | 662 | .i2c = nv04_i2c_new, |
663 | .imem = nv40_instmem_new, | 663 | .imem = nv40_instmem_new, |
664 | .mc = nv04_mc_new, | 664 | .mc = nv17_mc_new, |
665 | .mmu = nv41_mmu_new, | 665 | .mmu = nv41_mmu_new, |
666 | .pci = nv40_pci_new, | 666 | .pci = nv40_pci_new, |
667 | .therm = nv40_therm_new, | 667 | .therm = nv40_therm_new, |
@@ -687,7 +687,7 @@ nv49_chipset = { | |||
687 | .gpio = nv10_gpio_new, | 687 | .gpio = nv10_gpio_new, |
688 | .i2c = nv04_i2c_new, | 688 | .i2c = nv04_i2c_new, |
689 | .imem = nv40_instmem_new, | 689 | .imem = nv40_instmem_new, |
690 | .mc = nv04_mc_new, | 690 | .mc = nv17_mc_new, |
691 | .mmu = nv41_mmu_new, | 691 | .mmu = nv41_mmu_new, |
692 | .pci = nv40_pci_new, | 692 | .pci = nv40_pci_new, |
693 | .therm = nv40_therm_new, | 693 | .therm = nv40_therm_new, |
@@ -739,7 +739,7 @@ nv4b_chipset = { | |||
739 | .gpio = nv10_gpio_new, | 739 | .gpio = nv10_gpio_new, |
740 | .i2c = nv04_i2c_new, | 740 | .i2c = nv04_i2c_new, |
741 | .imem = nv40_instmem_new, | 741 | .imem = nv40_instmem_new, |
742 | .mc = nv04_mc_new, | 742 | .mc = nv17_mc_new, |
743 | .mmu = nv41_mmu_new, | 743 | .mmu = nv41_mmu_new, |
744 | .pci = nv40_pci_new, | 744 | .pci = nv40_pci_new, |
745 | .therm = nv40_therm_new, | 745 | .therm = nv40_therm_new, |
@@ -926,7 +926,7 @@ nv84_chipset = { | |||
926 | .gpio = nv50_gpio_new, | 926 | .gpio = nv50_gpio_new, |
927 | .i2c = nv50_i2c_new, | 927 | .i2c = nv50_i2c_new, |
928 | .imem = nv50_instmem_new, | 928 | .imem = nv50_instmem_new, |
929 | .mc = nv50_mc_new, | 929 | .mc = g84_mc_new, |
930 | .mmu = nv50_mmu_new, | 930 | .mmu = nv50_mmu_new, |
931 | .mxm = nv50_mxm_new, | 931 | .mxm = nv50_mxm_new, |
932 | .pci = g84_pci_new, | 932 | .pci = g84_pci_new, |
@@ -958,7 +958,7 @@ nv86_chipset = { | |||
958 | .gpio = nv50_gpio_new, | 958 | .gpio = nv50_gpio_new, |
959 | .i2c = nv50_i2c_new, | 959 | .i2c = nv50_i2c_new, |
960 | .imem = nv50_instmem_new, | 960 | .imem = nv50_instmem_new, |
961 | .mc = nv50_mc_new, | 961 | .mc = g84_mc_new, |
962 | .mmu = nv50_mmu_new, | 962 | .mmu = nv50_mmu_new, |
963 | .mxm = nv50_mxm_new, | 963 | .mxm = nv50_mxm_new, |
964 | .pci = g84_pci_new, | 964 | .pci = g84_pci_new, |
@@ -990,7 +990,7 @@ nv92_chipset = { | |||
990 | .gpio = nv50_gpio_new, | 990 | .gpio = nv50_gpio_new, |
991 | .i2c = nv50_i2c_new, | 991 | .i2c = nv50_i2c_new, |
992 | .imem = nv50_instmem_new, | 992 | .imem = nv50_instmem_new, |
993 | .mc = nv50_mc_new, | 993 | .mc = g84_mc_new, |
994 | .mmu = nv50_mmu_new, | 994 | .mmu = nv50_mmu_new, |
995 | .mxm = nv50_mxm_new, | 995 | .mxm = nv50_mxm_new, |
996 | .pci = g84_pci_new, | 996 | .pci = g84_pci_new, |
@@ -1022,7 +1022,7 @@ nv94_chipset = { | |||
1022 | .gpio = g94_gpio_new, | 1022 | .gpio = g94_gpio_new, |
1023 | .i2c = g94_i2c_new, | 1023 | .i2c = g94_i2c_new, |
1024 | .imem = nv50_instmem_new, | 1024 | .imem = nv50_instmem_new, |
1025 | .mc = nv50_mc_new, | 1025 | .mc = g84_mc_new, |
1026 | .mmu = nv50_mmu_new, | 1026 | .mmu = nv50_mmu_new, |
1027 | .mxm = nv50_mxm_new, | 1027 | .mxm = nv50_mxm_new, |
1028 | .pci = g94_pci_new, | 1028 | .pci = g94_pci_new, |
@@ -1054,7 +1054,7 @@ nv96_chipset = { | |||
1054 | .gpio = g94_gpio_new, | 1054 | .gpio = g94_gpio_new, |
1055 | .i2c = g94_i2c_new, | 1055 | .i2c = g94_i2c_new, |
1056 | .imem = nv50_instmem_new, | 1056 | .imem = nv50_instmem_new, |
1057 | .mc = nv50_mc_new, | 1057 | .mc = g84_mc_new, |
1058 | .mmu = nv50_mmu_new, | 1058 | .mmu = nv50_mmu_new, |
1059 | .mxm = nv50_mxm_new, | 1059 | .mxm = nv50_mxm_new, |
1060 | .pci = g94_pci_new, | 1060 | .pci = g94_pci_new, |
@@ -1118,7 +1118,7 @@ nva0_chipset = { | |||
1118 | .gpio = g94_gpio_new, | 1118 | .gpio = g94_gpio_new, |
1119 | .i2c = nv50_i2c_new, | 1119 | .i2c = nv50_i2c_new, |
1120 | .imem = nv50_instmem_new, | 1120 | .imem = nv50_instmem_new, |
1121 | .mc = g98_mc_new, | 1121 | .mc = g84_mc_new, |
1122 | .mmu = nv50_mmu_new, | 1122 | .mmu = nv50_mmu_new, |
1123 | .mxm = nv50_mxm_new, | 1123 | .mxm = nv50_mxm_new, |
1124 | .pci = g94_pci_new, | 1124 | .pci = g94_pci_new, |
@@ -1150,7 +1150,7 @@ nva3_chipset = { | |||
1150 | .gpio = g94_gpio_new, | 1150 | .gpio = g94_gpio_new, |
1151 | .i2c = g94_i2c_new, | 1151 | .i2c = g94_i2c_new, |
1152 | .imem = nv50_instmem_new, | 1152 | .imem = nv50_instmem_new, |
1153 | .mc = g98_mc_new, | 1153 | .mc = gt215_mc_new, |
1154 | .mmu = nv50_mmu_new, | 1154 | .mmu = nv50_mmu_new, |
1155 | .mxm = nv50_mxm_new, | 1155 | .mxm = nv50_mxm_new, |
1156 | .pci = g94_pci_new, | 1156 | .pci = g94_pci_new, |
@@ -1184,7 +1184,7 @@ nva5_chipset = { | |||
1184 | .gpio = g94_gpio_new, | 1184 | .gpio = g94_gpio_new, |
1185 | .i2c = g94_i2c_new, | 1185 | .i2c = g94_i2c_new, |
1186 | .imem = nv50_instmem_new, | 1186 | .imem = nv50_instmem_new, |
1187 | .mc = g98_mc_new, | 1187 | .mc = gt215_mc_new, |
1188 | .mmu = nv50_mmu_new, | 1188 | .mmu = nv50_mmu_new, |
1189 | .mxm = nv50_mxm_new, | 1189 | .mxm = nv50_mxm_new, |
1190 | .pci = g94_pci_new, | 1190 | .pci = g94_pci_new, |
@@ -1217,7 +1217,7 @@ nva8_chipset = { | |||
1217 | .gpio = g94_gpio_new, | 1217 | .gpio = g94_gpio_new, |
1218 | .i2c = g94_i2c_new, | 1218 | .i2c = g94_i2c_new, |
1219 | .imem = nv50_instmem_new, | 1219 | .imem = nv50_instmem_new, |
1220 | .mc = g98_mc_new, | 1220 | .mc = gt215_mc_new, |
1221 | .mmu = nv50_mmu_new, | 1221 | .mmu = nv50_mmu_new, |
1222 | .mxm = nv50_mxm_new, | 1222 | .mxm = nv50_mxm_new, |
1223 | .pci = g94_pci_new, | 1223 | .pci = g94_pci_new, |
@@ -1314,7 +1314,7 @@ nvaf_chipset = { | |||
1314 | .gpio = g94_gpio_new, | 1314 | .gpio = g94_gpio_new, |
1315 | .i2c = g94_i2c_new, | 1315 | .i2c = g94_i2c_new, |
1316 | .imem = nv50_instmem_new, | 1316 | .imem = nv50_instmem_new, |
1317 | .mc = g98_mc_new, | 1317 | .mc = gt215_mc_new, |
1318 | .mmu = nv50_mmu_new, | 1318 | .mmu = nv50_mmu_new, |
1319 | .mxm = nv50_mxm_new, | 1319 | .mxm = nv50_mxm_new, |
1320 | .pci = g94_pci_new, | 1320 | .pci = g94_pci_new, |
@@ -1676,13 +1676,14 @@ nve4_chipset = { | |||
1676 | .iccsense = gf100_iccsense_new, | 1676 | .iccsense = gf100_iccsense_new, |
1677 | .imem = nv50_instmem_new, | 1677 | .imem = nv50_instmem_new, |
1678 | .ltc = gk104_ltc_new, | 1678 | .ltc = gk104_ltc_new, |
1679 | .mc = gf100_mc_new, | 1679 | .mc = gk104_mc_new, |
1680 | .mmu = gf100_mmu_new, | 1680 | .mmu = gf100_mmu_new, |
1681 | .mxm = nv50_mxm_new, | 1681 | .mxm = nv50_mxm_new, |
1682 | .pci = gk104_pci_new, | 1682 | .pci = gk104_pci_new, |
1683 | .pmu = gk104_pmu_new, | 1683 | .pmu = gk104_pmu_new, |
1684 | .therm = gf119_therm_new, | 1684 | .therm = gf119_therm_new, |
1685 | .timer = nv41_timer_new, | 1685 | .timer = nv41_timer_new, |
1686 | .top = gk104_top_new, | ||
1686 | .volt = gk104_volt_new, | 1687 | .volt = gk104_volt_new, |
1687 | .ce[0] = gk104_ce_new, | 1688 | .ce[0] = gk104_ce_new, |
1688 | .ce[1] = gk104_ce_new, | 1689 | .ce[1] = gk104_ce_new, |
@@ -1714,13 +1715,14 @@ nve6_chipset = { | |||
1714 | .iccsense = gf100_iccsense_new, | 1715 | .iccsense = gf100_iccsense_new, |
1715 | .imem = nv50_instmem_new, | 1716 | .imem = nv50_instmem_new, |
1716 | .ltc = gk104_ltc_new, | 1717 | .ltc = gk104_ltc_new, |
1717 | .mc = gf100_mc_new, | 1718 | .mc = gk104_mc_new, |
1718 | .mmu = gf100_mmu_new, | 1719 | .mmu = gf100_mmu_new, |
1719 | .mxm = nv50_mxm_new, | 1720 | .mxm = nv50_mxm_new, |
1720 | .pci = gk104_pci_new, | 1721 | .pci = gk104_pci_new, |
1721 | .pmu = gk104_pmu_new, | 1722 | .pmu = gk104_pmu_new, |
1722 | .therm = gf119_therm_new, | 1723 | .therm = gf119_therm_new, |
1723 | .timer = nv41_timer_new, | 1724 | .timer = nv41_timer_new, |
1725 | .top = gk104_top_new, | ||
1724 | .volt = gk104_volt_new, | 1726 | .volt = gk104_volt_new, |
1725 | .ce[0] = gk104_ce_new, | 1727 | .ce[0] = gk104_ce_new, |
1726 | .ce[1] = gk104_ce_new, | 1728 | .ce[1] = gk104_ce_new, |
@@ -1752,13 +1754,14 @@ nve7_chipset = { | |||
1752 | .iccsense = gf100_iccsense_new, | 1754 | .iccsense = gf100_iccsense_new, |
1753 | .imem = nv50_instmem_new, | 1755 | .imem = nv50_instmem_new, |
1754 | .ltc = gk104_ltc_new, | 1756 | .ltc = gk104_ltc_new, |
1755 | .mc = gf100_mc_new, | 1757 | .mc = gk104_mc_new, |
1756 | .mmu = gf100_mmu_new, | 1758 | .mmu = gf100_mmu_new, |
1757 | .mxm = nv50_mxm_new, | 1759 | .mxm = nv50_mxm_new, |
1758 | .pci = gk104_pci_new, | 1760 | .pci = gk104_pci_new, |
1759 | .pmu = gk104_pmu_new, | 1761 | .pmu = gk104_pmu_new, |
1760 | .therm = gf119_therm_new, | 1762 | .therm = gf119_therm_new, |
1761 | .timer = nv41_timer_new, | 1763 | .timer = nv41_timer_new, |
1764 | .top = gk104_top_new, | ||
1762 | .volt = gk104_volt_new, | 1765 | .volt = gk104_volt_new, |
1763 | .ce[0] = gk104_ce_new, | 1766 | .ce[0] = gk104_ce_new, |
1764 | .ce[1] = gk104_ce_new, | 1767 | .ce[1] = gk104_ce_new, |
@@ -1789,6 +1792,7 @@ nvea_chipset = { | |||
1789 | .mmu = gf100_mmu_new, | 1792 | .mmu = gf100_mmu_new, |
1790 | .pmu = gk20a_pmu_new, | 1793 | .pmu = gk20a_pmu_new, |
1791 | .timer = gk20a_timer_new, | 1794 | .timer = gk20a_timer_new, |
1795 | .top = gk104_top_new, | ||
1792 | .volt = gk20a_volt_new, | 1796 | .volt = gk20a_volt_new, |
1793 | .ce[2] = gk104_ce_new, | 1797 | .ce[2] = gk104_ce_new, |
1794 | .dma = gf119_dma_new, | 1798 | .dma = gf119_dma_new, |
@@ -1814,13 +1818,14 @@ nvf0_chipset = { | |||
1814 | .iccsense = gf100_iccsense_new, | 1818 | .iccsense = gf100_iccsense_new, |
1815 | .imem = nv50_instmem_new, | 1819 | .imem = nv50_instmem_new, |
1816 | .ltc = gk104_ltc_new, | 1820 | .ltc = gk104_ltc_new, |
1817 | .mc = gf100_mc_new, | 1821 | .mc = gk104_mc_new, |
1818 | .mmu = gf100_mmu_new, | 1822 | .mmu = gf100_mmu_new, |
1819 | .mxm = nv50_mxm_new, | 1823 | .mxm = nv50_mxm_new, |
1820 | .pci = gk104_pci_new, | 1824 | .pci = gk104_pci_new, |
1821 | .pmu = gk110_pmu_new, | 1825 | .pmu = gk110_pmu_new, |
1822 | .therm = gf119_therm_new, | 1826 | .therm = gf119_therm_new, |
1823 | .timer = nv41_timer_new, | 1827 | .timer = nv41_timer_new, |
1828 | .top = gk104_top_new, | ||
1824 | .volt = gk104_volt_new, | 1829 | .volt = gk104_volt_new, |
1825 | .ce[0] = gk104_ce_new, | 1830 | .ce[0] = gk104_ce_new, |
1826 | .ce[1] = gk104_ce_new, | 1831 | .ce[1] = gk104_ce_new, |
@@ -1851,13 +1856,14 @@ nvf1_chipset = { | |||
1851 | .iccsense = gf100_iccsense_new, | 1856 | .iccsense = gf100_iccsense_new, |
1852 | .imem = nv50_instmem_new, | 1857 | .imem = nv50_instmem_new, |
1853 | .ltc = gk104_ltc_new, | 1858 | .ltc = gk104_ltc_new, |
1854 | .mc = gf100_mc_new, | 1859 | .mc = gk104_mc_new, |
1855 | .mmu = gf100_mmu_new, | 1860 | .mmu = gf100_mmu_new, |
1856 | .mxm = nv50_mxm_new, | 1861 | .mxm = nv50_mxm_new, |
1857 | .pci = gk104_pci_new, | 1862 | .pci = gk104_pci_new, |
1858 | .pmu = gk110_pmu_new, | 1863 | .pmu = gk110_pmu_new, |
1859 | .therm = gf119_therm_new, | 1864 | .therm = gf119_therm_new, |
1860 | .timer = nv41_timer_new, | 1865 | .timer = nv41_timer_new, |
1866 | .top = gk104_top_new, | ||
1861 | .volt = gk104_volt_new, | 1867 | .volt = gk104_volt_new, |
1862 | .ce[0] = gk104_ce_new, | 1868 | .ce[0] = gk104_ce_new, |
1863 | .ce[1] = gk104_ce_new, | 1869 | .ce[1] = gk104_ce_new, |
@@ -1895,6 +1901,7 @@ nv106_chipset = { | |||
1895 | .pmu = gk208_pmu_new, | 1901 | .pmu = gk208_pmu_new, |
1896 | .therm = gf119_therm_new, | 1902 | .therm = gf119_therm_new, |
1897 | .timer = nv41_timer_new, | 1903 | .timer = nv41_timer_new, |
1904 | .top = gk104_top_new, | ||
1898 | .volt = gk104_volt_new, | 1905 | .volt = gk104_volt_new, |
1899 | .ce[0] = gk104_ce_new, | 1906 | .ce[0] = gk104_ce_new, |
1900 | .ce[1] = gk104_ce_new, | 1907 | .ce[1] = gk104_ce_new, |
@@ -1932,6 +1939,7 @@ nv108_chipset = { | |||
1932 | .pmu = gk208_pmu_new, | 1939 | .pmu = gk208_pmu_new, |
1933 | .therm = gf119_therm_new, | 1940 | .therm = gf119_therm_new, |
1934 | .timer = nv41_timer_new, | 1941 | .timer = nv41_timer_new, |
1942 | .top = gk104_top_new, | ||
1935 | .volt = gk104_volt_new, | 1943 | .volt = gk104_volt_new, |
1936 | .ce[0] = gk104_ce_new, | 1944 | .ce[0] = gk104_ce_new, |
1937 | .ce[1] = gk104_ce_new, | 1945 | .ce[1] = gk104_ce_new, |
@@ -1969,6 +1977,41 @@ nv117_chipset = { | |||
1969 | .pmu = gm107_pmu_new, | 1977 | .pmu = gm107_pmu_new, |
1970 | .therm = gm107_therm_new, | 1978 | .therm = gm107_therm_new, |
1971 | .timer = gk20a_timer_new, | 1979 | .timer = gk20a_timer_new, |
1980 | .top = gk104_top_new, | ||
1981 | .volt = gk104_volt_new, | ||
1982 | .ce[0] = gm107_ce_new, | ||
1983 | .ce[2] = gm107_ce_new, | ||
1984 | .disp = gm107_disp_new, | ||
1985 | .dma = gf119_dma_new, | ||
1986 | .fifo = gm107_fifo_new, | ||
1987 | .gr = gm107_gr_new, | ||
1988 | .sw = gf100_sw_new, | ||
1989 | }; | ||
1990 | |||
1991 | static const struct nvkm_device_chip | ||
1992 | nv118_chipset = { | ||
1993 | .name = "GM108", | ||
1994 | .bar = gf100_bar_new, | ||
1995 | .bios = nvkm_bios_new, | ||
1996 | .bus = gf100_bus_new, | ||
1997 | .clk = gk104_clk_new, | ||
1998 | .devinit = gm107_devinit_new, | ||
1999 | .fb = gm107_fb_new, | ||
2000 | .fuse = gm107_fuse_new, | ||
2001 | .gpio = gk104_gpio_new, | ||
2002 | .i2c = gf119_i2c_new, | ||
2003 | .ibus = gk104_ibus_new, | ||
2004 | .iccsense = gf100_iccsense_new, | ||
2005 | .imem = nv50_instmem_new, | ||
2006 | .ltc = gm107_ltc_new, | ||
2007 | .mc = gk20a_mc_new, | ||
2008 | .mmu = gf100_mmu_new, | ||
2009 | .mxm = nv50_mxm_new, | ||
2010 | .pci = gk104_pci_new, | ||
2011 | .pmu = gm107_pmu_new, | ||
2012 | .therm = gm107_therm_new, | ||
2013 | .timer = gk20a_timer_new, | ||
2014 | .top = gk104_top_new, | ||
1972 | .volt = gk104_volt_new, | 2015 | .volt = gk104_volt_new, |
1973 | .ce[0] = gm107_ce_new, | 2016 | .ce[0] = gm107_ce_new, |
1974 | .ce[2] = gm107_ce_new, | 2017 | .ce[2] = gm107_ce_new, |
@@ -1986,7 +2029,7 @@ nv120_chipset = { | |||
1986 | .bios = nvkm_bios_new, | 2029 | .bios = nvkm_bios_new, |
1987 | .bus = gf100_bus_new, | 2030 | .bus = gf100_bus_new, |
1988 | .devinit = gm200_devinit_new, | 2031 | .devinit = gm200_devinit_new, |
1989 | .fb = gm107_fb_new, | 2032 | .fb = gm200_fb_new, |
1990 | .fuse = gm107_fuse_new, | 2033 | .fuse = gm107_fuse_new, |
1991 | .gpio = gk104_gpio_new, | 2034 | .gpio = gk104_gpio_new, |
1992 | .i2c = gm200_i2c_new, | 2035 | .i2c = gm200_i2c_new, |
@@ -2001,6 +2044,7 @@ nv120_chipset = { | |||
2001 | .pmu = gm107_pmu_new, | 2044 | .pmu = gm107_pmu_new, |
2002 | .secboot = gm200_secboot_new, | 2045 | .secboot = gm200_secboot_new, |
2003 | .timer = gk20a_timer_new, | 2046 | .timer = gk20a_timer_new, |
2047 | .top = gk104_top_new, | ||
2004 | .volt = gk104_volt_new, | 2048 | .volt = gk104_volt_new, |
2005 | .ce[0] = gm200_ce_new, | 2049 | .ce[0] = gm200_ce_new, |
2006 | .ce[1] = gm200_ce_new, | 2050 | .ce[1] = gm200_ce_new, |
@@ -2019,7 +2063,7 @@ nv124_chipset = { | |||
2019 | .bios = nvkm_bios_new, | 2063 | .bios = nvkm_bios_new, |
2020 | .bus = gf100_bus_new, | 2064 | .bus = gf100_bus_new, |
2021 | .devinit = gm200_devinit_new, | 2065 | .devinit = gm200_devinit_new, |
2022 | .fb = gm107_fb_new, | 2066 | .fb = gm200_fb_new, |
2023 | .fuse = gm107_fuse_new, | 2067 | .fuse = gm107_fuse_new, |
2024 | .gpio = gk104_gpio_new, | 2068 | .gpio = gk104_gpio_new, |
2025 | .i2c = gm200_i2c_new, | 2069 | .i2c = gm200_i2c_new, |
@@ -2034,6 +2078,7 @@ nv124_chipset = { | |||
2034 | .pmu = gm107_pmu_new, | 2078 | .pmu = gm107_pmu_new, |
2035 | .secboot = gm200_secboot_new, | 2079 | .secboot = gm200_secboot_new, |
2036 | .timer = gk20a_timer_new, | 2080 | .timer = gk20a_timer_new, |
2081 | .top = gk104_top_new, | ||
2037 | .volt = gk104_volt_new, | 2082 | .volt = gk104_volt_new, |
2038 | .ce[0] = gm200_ce_new, | 2083 | .ce[0] = gm200_ce_new, |
2039 | .ce[1] = gm200_ce_new, | 2084 | .ce[1] = gm200_ce_new, |
@@ -2052,7 +2097,7 @@ nv126_chipset = { | |||
2052 | .bios = nvkm_bios_new, | 2097 | .bios = nvkm_bios_new, |
2053 | .bus = gf100_bus_new, | 2098 | .bus = gf100_bus_new, |
2054 | .devinit = gm200_devinit_new, | 2099 | .devinit = gm200_devinit_new, |
2055 | .fb = gm107_fb_new, | 2100 | .fb = gm200_fb_new, |
2056 | .fuse = gm107_fuse_new, | 2101 | .fuse = gm107_fuse_new, |
2057 | .gpio = gk104_gpio_new, | 2102 | .gpio = gk104_gpio_new, |
2058 | .i2c = gm200_i2c_new, | 2103 | .i2c = gm200_i2c_new, |
@@ -2067,6 +2112,7 @@ nv126_chipset = { | |||
2067 | .pmu = gm107_pmu_new, | 2112 | .pmu = gm107_pmu_new, |
2068 | .secboot = gm200_secboot_new, | 2113 | .secboot = gm200_secboot_new, |
2069 | .timer = gk20a_timer_new, | 2114 | .timer = gk20a_timer_new, |
2115 | .top = gk104_top_new, | ||
2070 | .volt = gk104_volt_new, | 2116 | .volt = gk104_volt_new, |
2071 | .ce[0] = gm200_ce_new, | 2117 | .ce[0] = gm200_ce_new, |
2072 | .ce[1] = gm200_ce_new, | 2118 | .ce[1] = gm200_ce_new, |
@@ -2093,6 +2139,7 @@ nv12b_chipset = { | |||
2093 | .mmu = gf100_mmu_new, | 2139 | .mmu = gf100_mmu_new, |
2094 | .secboot = gm20b_secboot_new, | 2140 | .secboot = gm20b_secboot_new, |
2095 | .timer = gk20a_timer_new, | 2141 | .timer = gk20a_timer_new, |
2142 | .top = gk104_top_new, | ||
2096 | .ce[2] = gm200_ce_new, | 2143 | .ce[2] = gm200_ce_new, |
2097 | .volt = gm20b_volt_new, | 2144 | .volt = gm20b_volt_new, |
2098 | .dma = gf119_dma_new, | 2145 | .dma = gf119_dma_new, |
@@ -2150,6 +2197,7 @@ nvkm_device_subdev(struct nvkm_device *device, int index) | |||
2150 | _(SECBOOT , device->secboot , &device->secboot->subdev); | 2197 | _(SECBOOT , device->secboot , &device->secboot->subdev); |
2151 | _(THERM , device->therm , &device->therm->subdev); | 2198 | _(THERM , device->therm , &device->therm->subdev); |
2152 | _(TIMER , device->timer , &device->timer->subdev); | 2199 | _(TIMER , device->timer , &device->timer->subdev); |
2200 | _(TOP , device->top , &device->top->subdev); | ||
2153 | _(VOLT , device->volt , &device->volt->subdev); | 2201 | _(VOLT , device->volt , &device->volt->subdev); |
2154 | #undef _ | 2202 | #undef _ |
2155 | default: | 2203 | default: |
@@ -2523,6 +2571,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, | |||
2523 | case 0x106: device->chip = &nv106_chipset; break; | 2571 | case 0x106: device->chip = &nv106_chipset; break; |
2524 | case 0x108: device->chip = &nv108_chipset; break; | 2572 | case 0x108: device->chip = &nv108_chipset; break; |
2525 | case 0x117: device->chip = &nv117_chipset; break; | 2573 | case 0x117: device->chip = &nv117_chipset; break; |
2574 | case 0x118: device->chip = &nv118_chipset; break; | ||
2526 | case 0x120: device->chip = &nv120_chipset; break; | 2575 | case 0x120: device->chip = &nv120_chipset; break; |
2527 | case 0x124: device->chip = &nv124_chipset; break; | 2576 | case 0x124: device->chip = &nv124_chipset; break; |
2528 | case 0x126: device->chip = &nv126_chipset; break; | 2577 | case 0x126: device->chip = &nv126_chipset; break; |
@@ -2604,6 +2653,7 @@ nvkm_device_ctor(const struct nvkm_device_func *func, | |||
2604 | _(NVKM_SUBDEV_SECBOOT , secboot); | 2653 | _(NVKM_SUBDEV_SECBOOT , secboot); |
2605 | _(NVKM_SUBDEV_THERM , therm); | 2654 | _(NVKM_SUBDEV_THERM , therm); |
2606 | _(NVKM_SUBDEV_TIMER , timer); | 2655 | _(NVKM_SUBDEV_TIMER , timer); |
2656 | _(NVKM_SUBDEV_TOP , top); | ||
2607 | _(NVKM_SUBDEV_VOLT , volt); | 2657 | _(NVKM_SUBDEV_VOLT , volt); |
2608 | _(NVKM_ENGINE_BSP , bsp); | 2658 | _(NVKM_ENGINE_BSP , bsp); |
2609 | _(NVKM_ENGINE_CE0 , ce[0]); | 2659 | _(NVKM_ENGINE_CE0 , ce[0]); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h index e80f6ab1c415..1a06ac175f55 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/priv.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <subdev/pmu.h> | 22 | #include <subdev/pmu.h> |
23 | #include <subdev/therm.h> | 23 | #include <subdev/therm.h> |
24 | #include <subdev/timer.h> | 24 | #include <subdev/timer.h> |
25 | #include <subdev/top.h> | ||
25 | #include <subdev/volt.h> | 26 | #include <subdev/volt.h> |
26 | #include <subdev/secboot.h> | 27 | #include <subdev/secboot.h> |
27 | 28 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c index 785fa76d0fbf..1efe91b1e22b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/base.c | |||
@@ -298,8 +298,7 @@ nvkm_disp_ctor(const struct nvkm_disp_func *func, struct nvkm_device *device, | |||
298 | disp->func = func; | 298 | disp->func = func; |
299 | disp->head.nr = heads; | 299 | disp->head.nr = heads; |
300 | 300 | ||
301 | ret = nvkm_engine_ctor(&nvkm_disp, device, index, 0, | 301 | ret = nvkm_engine_ctor(&nvkm_disp, device, index, true, &disp->engine); |
302 | true, &disp->engine); | ||
303 | if (ret) | 302 | if (ret) |
304 | return ret; | 303 | return ret; |
305 | 304 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c index 9769fc0d5351..f11ebdd16c77 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/dma/base.c | |||
@@ -152,6 +152,5 @@ nvkm_dma_new_(const struct nvkm_dma_func *func, struct nvkm_device *device, | |||
152 | return -ENOMEM; | 152 | return -ENOMEM; |
153 | dma->func = func; | 153 | dma->func = func; |
154 | 154 | ||
155 | return nvkm_engine_ctor(&nvkm_dma, device, index, | 155 | return nvkm_engine_ctor(&nvkm_dma, device, index, true, &dma->engine); |
156 | 0, true, &dma->engine); | ||
157 | } | 156 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c index 74000602fbb1..2e7b4e2105ef 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/falcon.c | |||
@@ -348,6 +348,6 @@ nvkm_falcon_new_(const struct nvkm_falcon_func *func, | |||
348 | falcon->data.size = func->data.size; | 348 | falcon->data.size = func->data.size; |
349 | *pengine = &falcon->engine; | 349 | *pengine = &falcon->engine; |
350 | 350 | ||
351 | return nvkm_engine_ctor(&nvkm_falcon, device, index, func->pmc_enable, | 351 | return nvkm_engine_ctor(&nvkm_falcon, device, index, |
352 | enable, &falcon->engine); | 352 | enable, &falcon->engine); |
353 | } | 353 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c index cfc7d5725a61..1c9682ae3a6b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c | |||
@@ -178,6 +178,17 @@ nvkm_fifo_class_get(struct nvkm_oclass *oclass, int index, | |||
178 | const struct nvkm_fifo_chan_oclass *sclass; | 178 | const struct nvkm_fifo_chan_oclass *sclass; |
179 | int c = 0; | 179 | int c = 0; |
180 | 180 | ||
181 | if (fifo->func->class_get) { | ||
182 | int ret = fifo->func->class_get(fifo, index, &sclass); | ||
183 | if (ret == 0) { | ||
184 | oclass->base = sclass->base; | ||
185 | oclass->engn = sclass; | ||
186 | *class = &nvkm_fifo_class; | ||
187 | return 0; | ||
188 | } | ||
189 | return ret; | ||
190 | } | ||
191 | |||
181 | while ((sclass = fifo->func->chan[c])) { | 192 | while ((sclass = fifo->func->chan[c])) { |
182 | if (c++ == index) { | 193 | if (c++ == index) { |
183 | oclass->base = sclass->base; | 194 | oclass->base = sclass->base; |
@@ -261,8 +272,7 @@ nvkm_fifo_ctor(const struct nvkm_fifo_func *func, struct nvkm_device *device, | |||
261 | fifo->nr = nr; | 272 | fifo->nr = nr; |
262 | bitmap_clear(fifo->mask, 0, fifo->nr); | 273 | bitmap_clear(fifo->mask, 0, fifo->nr); |
263 | 274 | ||
264 | ret = nvkm_engine_ctor(&nvkm_fifo, device, index, 0x00000100, | 275 | ret = nvkm_engine_ctor(&nvkm_fifo, device, index, true, &fifo->engine); |
265 | true, &fifo->engine); | ||
266 | if (ret) | 276 | if (ret) |
267 | return ret; | 277 | return ret; |
268 | 278 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c index 68acb36b3e6d..743f3a189f28 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c | |||
@@ -25,21 +25,36 @@ | |||
25 | #include "changk104.h" | 25 | #include "changk104.h" |
26 | 26 | ||
27 | #include <core/client.h> | 27 | #include <core/client.h> |
28 | #include <core/enum.h> | ||
29 | #include <core/gpuobj.h> | 28 | #include <core/gpuobj.h> |
30 | #include <subdev/bar.h> | 29 | #include <subdev/bar.h> |
30 | #include <subdev/top.h> | ||
31 | #include <engine/sw.h> | 31 | #include <engine/sw.h> |
32 | 32 | ||
33 | #include <nvif/class.h> | 33 | #include <nvif/class.h> |
34 | 34 | ||
35 | void | 35 | static int |
36 | gk104_fifo_class_get(struct nvkm_fifo *base, int index, | ||
37 | const struct nvkm_fifo_chan_oclass **psclass) | ||
38 | { | ||
39 | struct gk104_fifo *fifo = gk104_fifo(base); | ||
40 | int c = 0; | ||
41 | |||
42 | while ((*psclass = fifo->func->chan[c])) { | ||
43 | if (c++ == index) | ||
44 | return 0; | ||
45 | } | ||
46 | |||
47 | return c; | ||
48 | } | ||
49 | |||
50 | static void | ||
36 | gk104_fifo_uevent_fini(struct nvkm_fifo *fifo) | 51 | gk104_fifo_uevent_fini(struct nvkm_fifo *fifo) |
37 | { | 52 | { |
38 | struct nvkm_device *device = fifo->engine.subdev.device; | 53 | struct nvkm_device *device = fifo->engine.subdev.device; |
39 | nvkm_mask(device, 0x002140, 0x80000000, 0x00000000); | 54 | nvkm_mask(device, 0x002140, 0x80000000, 0x00000000); |
40 | } | 55 | } |
41 | 56 | ||
42 | void | 57 | static void |
43 | gk104_fifo_uevent_init(struct nvkm_fifo *fifo) | 58 | gk104_fifo_uevent_init(struct nvkm_fifo *fifo) |
44 | { | 59 | { |
45 | struct nvkm_device *device = fifo->engine.subdev.device; | 60 | struct nvkm_device *device = fifo->engine.subdev.device; |
@@ -267,111 +282,6 @@ gk104_fifo_intr_dropped_fault(struct gk104_fifo *fifo) | |||
267 | nvkm_error(subdev, "DROPPED_MMU_FAULT %08x\n", stat); | 282 | nvkm_error(subdev, "DROPPED_MMU_FAULT %08x\n", stat); |
268 | } | 283 | } |
269 | 284 | ||
270 | static const struct nvkm_enum | ||
271 | gk104_fifo_fault_engine[] = { | ||
272 | { 0x00, "GR", NULL, NVKM_ENGINE_GR }, | ||
273 | { 0x03, "IFB", NULL, NVKM_ENGINE_IFB }, | ||
274 | { 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR }, | ||
275 | { 0x05, "BAR3", NULL, NVKM_SUBDEV_INSTMEM }, | ||
276 | { 0x07, "PBDMA0", NULL, NVKM_ENGINE_FIFO }, | ||
277 | { 0x08, "PBDMA1", NULL, NVKM_ENGINE_FIFO }, | ||
278 | { 0x09, "PBDMA2", NULL, NVKM_ENGINE_FIFO }, | ||
279 | { 0x10, "MSVLD", NULL, NVKM_ENGINE_MSVLD }, | ||
280 | { 0x11, "MSPPP", NULL, NVKM_ENGINE_MSPPP }, | ||
281 | { 0x13, "PERF" }, | ||
282 | { 0x14, "MSPDEC", NULL, NVKM_ENGINE_MSPDEC }, | ||
283 | { 0x15, "CE0", NULL, NVKM_ENGINE_CE0 }, | ||
284 | { 0x16, "CE1", NULL, NVKM_ENGINE_CE1 }, | ||
285 | { 0x17, "PMU" }, | ||
286 | { 0x19, "MSENC", NULL, NVKM_ENGINE_MSENC }, | ||
287 | { 0x1b, "CE2", NULL, NVKM_ENGINE_CE2 }, | ||
288 | {} | ||
289 | }; | ||
290 | |||
291 | static const struct nvkm_enum | ||
292 | gk104_fifo_fault_reason[] = { | ||
293 | { 0x00, "PDE" }, | ||
294 | { 0x01, "PDE_SIZE" }, | ||
295 | { 0x02, "PTE" }, | ||
296 | { 0x03, "VA_LIMIT_VIOLATION" }, | ||
297 | { 0x04, "UNBOUND_INST_BLOCK" }, | ||
298 | { 0x05, "PRIV_VIOLATION" }, | ||
299 | { 0x06, "RO_VIOLATION" }, | ||
300 | { 0x07, "WO_VIOLATION" }, | ||
301 | { 0x08, "PITCH_MASK_VIOLATION" }, | ||
302 | { 0x09, "WORK_CREATION" }, | ||
303 | { 0x0a, "UNSUPPORTED_APERTURE" }, | ||
304 | { 0x0b, "COMPRESSION_FAILURE" }, | ||
305 | { 0x0c, "UNSUPPORTED_KIND" }, | ||
306 | { 0x0d, "REGION_VIOLATION" }, | ||
307 | { 0x0e, "BOTH_PTES_VALID" }, | ||
308 | { 0x0f, "INFO_TYPE_POISONED" }, | ||
309 | {} | ||
310 | }; | ||
311 | |||
312 | static const struct nvkm_enum | ||
313 | gk104_fifo_fault_hubclient[] = { | ||
314 | { 0x00, "VIP" }, | ||
315 | { 0x01, "CE0" }, | ||
316 | { 0x02, "CE1" }, | ||
317 | { 0x03, "DNISO" }, | ||
318 | { 0x04, "FE" }, | ||
319 | { 0x05, "FECS" }, | ||
320 | { 0x06, "HOST" }, | ||
321 | { 0x07, "HOST_CPU" }, | ||
322 | { 0x08, "HOST_CPU_NB" }, | ||
323 | { 0x09, "ISO" }, | ||
324 | { 0x0a, "MMU" }, | ||
325 | { 0x0b, "MSPDEC" }, | ||
326 | { 0x0c, "MSPPP" }, | ||
327 | { 0x0d, "MSVLD" }, | ||
328 | { 0x0e, "NISO" }, | ||
329 | { 0x0f, "P2P" }, | ||
330 | { 0x10, "PD" }, | ||
331 | { 0x11, "PERF" }, | ||
332 | { 0x12, "PMU" }, | ||
333 | { 0x13, "RASTERTWOD" }, | ||
334 | { 0x14, "SCC" }, | ||
335 | { 0x15, "SCC_NB" }, | ||
336 | { 0x16, "SEC" }, | ||
337 | { 0x17, "SSYNC" }, | ||
338 | { 0x18, "GR_CE" }, | ||
339 | { 0x19, "CE2" }, | ||
340 | { 0x1a, "XV" }, | ||
341 | { 0x1b, "MMU_NB" }, | ||
342 | { 0x1c, "MSENC" }, | ||
343 | { 0x1d, "DFALCON" }, | ||
344 | { 0x1e, "SKED" }, | ||
345 | { 0x1f, "AFALCON" }, | ||
346 | {} | ||
347 | }; | ||
348 | |||
349 | static const struct nvkm_enum | ||
350 | gk104_fifo_fault_gpcclient[] = { | ||
351 | { 0x00, "L1_0" }, { 0x01, "T1_0" }, { 0x02, "PE_0" }, | ||
352 | { 0x03, "L1_1" }, { 0x04, "T1_1" }, { 0x05, "PE_1" }, | ||
353 | { 0x06, "L1_2" }, { 0x07, "T1_2" }, { 0x08, "PE_2" }, | ||
354 | { 0x09, "L1_3" }, { 0x0a, "T1_3" }, { 0x0b, "PE_3" }, | ||
355 | { 0x0c, "RAST" }, | ||
356 | { 0x0d, "GCC" }, | ||
357 | { 0x0e, "GPCCS" }, | ||
358 | { 0x0f, "PROP_0" }, | ||
359 | { 0x10, "PROP_1" }, | ||
360 | { 0x11, "PROP_2" }, | ||
361 | { 0x12, "PROP_3" }, | ||
362 | { 0x13, "L1_4" }, { 0x14, "T1_4" }, { 0x15, "PE_4" }, | ||
363 | { 0x16, "L1_5" }, { 0x17, "T1_5" }, { 0x18, "PE_5" }, | ||
364 | { 0x19, "L1_6" }, { 0x1a, "T1_6" }, { 0x1b, "PE_6" }, | ||
365 | { 0x1c, "L1_7" }, { 0x1d, "T1_7" }, { 0x1e, "PE_7" }, | ||
366 | { 0x1f, "GPM" }, | ||
367 | { 0x20, "LTP_UTLB_0" }, | ||
368 | { 0x21, "LTP_UTLB_1" }, | ||
369 | { 0x22, "LTP_UTLB_2" }, | ||
370 | { 0x23, "LTP_UTLB_3" }, | ||
371 | { 0x24, "GPC_RGG_UTLB" }, | ||
372 | {} | ||
373 | }; | ||
374 | |||
375 | static void | 285 | static void |
376 | gk104_fifo_intr_fault(struct gk104_fifo *fifo, int unit) | 286 | gk104_fifo_intr_fault(struct gk104_fifo *fifo, int unit) |
377 | { | 287 | { |
@@ -390,14 +300,14 @@ gk104_fifo_intr_fault(struct gk104_fifo *fifo, int unit) | |||
390 | struct nvkm_engine *engine = NULL; | 300 | struct nvkm_engine *engine = NULL; |
391 | struct nvkm_fifo_chan *chan; | 301 | struct nvkm_fifo_chan *chan; |
392 | unsigned long flags; | 302 | unsigned long flags; |
393 | char gpcid[8] = ""; | 303 | char gpcid[8] = "", en[16] = ""; |
394 | 304 | ||
395 | er = nvkm_enum_find(gk104_fifo_fault_reason, reason); | 305 | er = nvkm_enum_find(fifo->func->fault.reason, reason); |
396 | eu = nvkm_enum_find(gk104_fifo_fault_engine, unit); | 306 | eu = nvkm_enum_find(fifo->func->fault.engine, unit); |
397 | if (hub) { | 307 | if (hub) { |
398 | ec = nvkm_enum_find(gk104_fifo_fault_hubclient, client); | 308 | ec = nvkm_enum_find(fifo->func->fault.hubclient, client); |
399 | } else { | 309 | } else { |
400 | ec = nvkm_enum_find(gk104_fifo_fault_gpcclient, client); | 310 | ec = nvkm_enum_find(fifo->func->fault.gpcclient, client); |
401 | snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc); | 311 | snprintf(gpcid, sizeof(gpcid), "GPC%d/", gpc); |
402 | } | 312 | } |
403 | 313 | ||
@@ -418,13 +328,27 @@ gk104_fifo_intr_fault(struct gk104_fifo *fifo, int unit) | |||
418 | } | 328 | } |
419 | } | 329 | } |
420 | 330 | ||
331 | if (eu == NULL) { | ||
332 | enum nvkm_devidx engidx = nvkm_top_fault(device->top, unit); | ||
333 | if (engidx < NVKM_SUBDEV_NR) { | ||
334 | const char *src = nvkm_subdev_name[engidx]; | ||
335 | char *dst = en; | ||
336 | do { | ||
337 | *dst++ = toupper(*src++); | ||
338 | } while(*src); | ||
339 | engine = nvkm_device_engine(device, engidx); | ||
340 | } | ||
341 | } else { | ||
342 | snprintf(en, sizeof(en), "%s", eu->name); | ||
343 | } | ||
344 | |||
421 | chan = nvkm_fifo_chan_inst(&fifo->base, (u64)inst << 12, &flags); | 345 | chan = nvkm_fifo_chan_inst(&fifo->base, (u64)inst << 12, &flags); |
422 | 346 | ||
423 | nvkm_error(subdev, | 347 | nvkm_error(subdev, |
424 | "%s fault at %010llx engine %02x [%s] client %02x [%s%s] " | 348 | "%s fault at %010llx engine %02x [%s] client %02x [%s%s] " |
425 | "reason %02x [%s] on channel %d [%010llx %s]\n", | 349 | "reason %02x [%s] on channel %d [%010llx %s]\n", |
426 | write ? "write" : "read", (u64)vahi << 32 | valo, | 350 | write ? "write" : "read", (u64)vahi << 32 | valo, |
427 | unit, eu ? eu->name : "", client, gpcid, ec ? ec->name : "", | 351 | unit, en, client, gpcid, ec ? ec->name : "", |
428 | reason, er ? er->name : "", chan ? chan->chid : -1, | 352 | reason, er ? er->name : "", chan ? chan->chid : -1, |
429 | (u64)inst << 12, | 353 | (u64)inst << 12, |
430 | chan ? chan->object.client->name : "unknown"); | 354 | chan ? chan->object.client->name : "unknown"); |
@@ -557,7 +481,7 @@ gk104_fifo_intr_engine(struct gk104_fifo *fifo) | |||
557 | nvkm_fifo_uevent(&fifo->base); | 481 | nvkm_fifo_uevent(&fifo->base); |
558 | } | 482 | } |
559 | 483 | ||
560 | void | 484 | static void |
561 | gk104_fifo_intr(struct nvkm_fifo *base) | 485 | gk104_fifo_intr(struct nvkm_fifo *base) |
562 | { | 486 | { |
563 | struct gk104_fifo *fifo = gk104_fifo(base); | 487 | struct gk104_fifo *fifo = gk104_fifo(base); |
@@ -649,7 +573,7 @@ gk104_fifo_intr(struct nvkm_fifo *base) | |||
649 | } | 573 | } |
650 | } | 574 | } |
651 | 575 | ||
652 | void | 576 | static void |
653 | gk104_fifo_fini(struct nvkm_fifo *base) | 577 | gk104_fifo_fini(struct nvkm_fifo *base) |
654 | { | 578 | { |
655 | struct gk104_fifo *fifo = gk104_fifo(base); | 579 | struct gk104_fifo *fifo = gk104_fifo(base); |
@@ -659,13 +583,15 @@ gk104_fifo_fini(struct nvkm_fifo *base) | |||
659 | nvkm_mask(device, 0x002140, 0x10000000, 0x10000000); | 583 | nvkm_mask(device, 0x002140, 0x10000000, 0x10000000); |
660 | } | 584 | } |
661 | 585 | ||
662 | int | 586 | static int |
663 | gk104_fifo_oneinit(struct nvkm_fifo *base) | 587 | gk104_fifo_oneinit(struct nvkm_fifo *base) |
664 | { | 588 | { |
665 | struct gk104_fifo *fifo = gk104_fifo(base); | 589 | struct gk104_fifo *fifo = gk104_fifo(base); |
666 | struct nvkm_subdev *subdev = &fifo->base.engine.subdev; | 590 | struct nvkm_subdev *subdev = &fifo->base.engine.subdev; |
667 | struct nvkm_device *device = subdev->device; | 591 | struct nvkm_device *device = subdev->device; |
668 | int ret, i; | 592 | struct nvkm_top *top = device->top; |
593 | int engn, runl, pbid, ret, i, j; | ||
594 | enum nvkm_devidx engidx; | ||
669 | u32 *map; | 595 | u32 *map; |
670 | 596 | ||
671 | /* Determine number of PBDMAs by checking valid enable bits. */ | 597 | /* Determine number of PBDMAs by checking valid enable bits. */ |
@@ -680,86 +606,26 @@ gk104_fifo_oneinit(struct nvkm_fifo *base) | |||
680 | for (i = 0; i < fifo->pbdma_nr; i++) | 606 | for (i = 0; i < fifo->pbdma_nr; i++) |
681 | map[i] = nvkm_rd32(device, 0x002390 + (i * 0x04)); | 607 | map[i] = nvkm_rd32(device, 0x002390 + (i * 0x04)); |
682 | 608 | ||
683 | /* Read device topology from HW. */ | 609 | /* Determine runlist configuration from topology device info. */ |
684 | for (i = 0; i < 64; i++) { | 610 | i = 0; |
685 | int type = -1, pbid = -1, engidx = -1; | 611 | while ((int)(engidx = nvkm_top_engine(top, i++, &runl, &engn)) >= 0) { |
686 | int engn = -1, runl = -1, intr = -1, mcen = -1; | ||
687 | int fault = -1, j; | ||
688 | u32 data, addr = 0; | ||
689 | |||
690 | do { | ||
691 | data = nvkm_rd32(device, 0x022700 + (i * 0x04)); | ||
692 | nvkm_trace(subdev, "%02x: %08x\n", i, data); | ||
693 | switch (data & 0x00000003) { | ||
694 | case 0x00000000: /* NOT_VALID */ | ||
695 | continue; | ||
696 | case 0x00000001: /* DATA */ | ||
697 | addr = (data & 0x00fff000); | ||
698 | fault = (data & 0x000000f8) >> 3; | ||
699 | break; | ||
700 | case 0x00000002: /* ENUM */ | ||
701 | if (data & 0x00000020) | ||
702 | engn = (data & 0x3c000000) >> 26; | ||
703 | if (data & 0x00000010) | ||
704 | runl = (data & 0x01e00000) >> 21; | ||
705 | if (data & 0x00000008) | ||
706 | intr = (data & 0x000f8000) >> 15; | ||
707 | if (data & 0x00000004) | ||
708 | mcen = (data & 0x00003e00) >> 9; | ||
709 | break; | ||
710 | case 0x00000003: /* ENGINE_TYPE */ | ||
711 | type = (data & 0x7ffffffc) >> 2; | ||
712 | break; | ||
713 | } | ||
714 | } while ((data & 0x80000000) && ++i < 64); | ||
715 | |||
716 | if (!data) | ||
717 | continue; | ||
718 | |||
719 | /* Determine which PBDMA handles requests for this engine. */ | 612 | /* Determine which PBDMA handles requests for this engine. */ |
720 | for (j = 0; runl >= 0 && j < fifo->pbdma_nr; j++) { | 613 | for (j = 0, pbid = -1; j < fifo->pbdma_nr; j++) { |
721 | if (map[j] & (1 << runl)) { | 614 | if (map[j] & (1 << runl)) { |
722 | pbid = j; | 615 | pbid = j; |
723 | break; | 616 | break; |
724 | } | 617 | } |
725 | } | 618 | } |
726 | 619 | ||
727 | /* Translate engine type to NVKM engine identifier. */ | 620 | nvkm_debug(subdev, "engine %2d: runlist %2d pbdma %2d\n", |
728 | switch (type) { | 621 | engn, runl, pbid); |
729 | case 0x00000000: engidx = NVKM_ENGINE_GR; break; | ||
730 | case 0x00000001: engidx = NVKM_ENGINE_CE0; break; | ||
731 | case 0x00000002: engidx = NVKM_ENGINE_CE1; break; | ||
732 | case 0x00000003: engidx = NVKM_ENGINE_CE2; break; | ||
733 | case 0x00000008: engidx = NVKM_ENGINE_MSPDEC; break; | ||
734 | case 0x00000009: engidx = NVKM_ENGINE_MSPPP; break; | ||
735 | case 0x0000000a: engidx = NVKM_ENGINE_MSVLD; break; | ||
736 | case 0x0000000b: engidx = NVKM_ENGINE_MSENC; break; | ||
737 | case 0x0000000c: engidx = NVKM_ENGINE_VIC; break; | ||
738 | case 0x0000000d: engidx = NVKM_ENGINE_SEC; break; | ||
739 | case 0x0000000e: engidx = NVKM_ENGINE_NVENC0; break; | ||
740 | case 0x0000000f: engidx = NVKM_ENGINE_NVENC1; break; | ||
741 | case 0x00000010: engidx = NVKM_ENGINE_NVDEC; break; | ||
742 | break; | ||
743 | default: | ||
744 | break; | ||
745 | } | ||
746 | 622 | ||
747 | nvkm_debug(subdev, "%02x (%8s): engine %2d runlist %2d " | 623 | fifo->engine[engn].engine = nvkm_device_engine(device, engidx); |
748 | "pbdma %2d intr %2d reset %2d " | 624 | fifo->engine[engn].runl = runl; |
749 | "fault %2d addr %06x\n", type, | 625 | fifo->engine[engn].pbid = pbid; |
750 | engidx < 0 ? NULL : nvkm_subdev_name[engidx], | 626 | fifo->engine_nr = max(fifo->engine_nr, engn + 1); |
751 | engn, runl, pbid, intr, mcen, fault, addr); | 627 | fifo->runlist[runl].engm |= 1 << engn; |
752 | 628 | fifo->runlist_nr = max(fifo->runlist_nr, runl + 1); | |
753 | /* Mark the engine as supported if everything checks out. */ | ||
754 | if (engn >= 0 && runl >= 0) { | ||
755 | fifo->engine[engn].engine = engidx < 0 ? NULL : | ||
756 | nvkm_device_engine(device, engidx); | ||
757 | fifo->engine[engn].runl = runl; | ||
758 | fifo->engine[engn].pbid = pbid; | ||
759 | fifo->engine_nr = max(fifo->engine_nr, engn + 1); | ||
760 | fifo->runlist[runl].engm |= 1 << engn; | ||
761 | fifo->runlist_nr = max(fifo->runlist_nr, runl + 1); | ||
762 | } | ||
763 | } | 629 | } |
764 | 630 | ||
765 | kfree(map); | 631 | kfree(map); |
@@ -796,7 +662,7 @@ gk104_fifo_oneinit(struct nvkm_fifo *base) | |||
796 | return 0; | 662 | return 0; |
797 | } | 663 | } |
798 | 664 | ||
799 | void | 665 | static void |
800 | gk104_fifo_init(struct nvkm_fifo *base) | 666 | gk104_fifo_init(struct nvkm_fifo *base) |
801 | { | 667 | { |
802 | struct gk104_fifo *fifo = gk104_fifo(base); | 668 | struct gk104_fifo *fifo = gk104_fifo(base); |
@@ -825,7 +691,7 @@ gk104_fifo_init(struct nvkm_fifo *base) | |||
825 | nvkm_wr32(device, 0x002140, 0x7fffffff); | 691 | nvkm_wr32(device, 0x002140, 0x7fffffff); |
826 | } | 692 | } |
827 | 693 | ||
828 | void * | 694 | static void * |
829 | gk104_fifo_dtor(struct nvkm_fifo *base) | 695 | gk104_fifo_dtor(struct nvkm_fifo *base) |
830 | { | 696 | { |
831 | struct gk104_fifo *fifo = gk104_fifo(base); | 697 | struct gk104_fifo *fifo = gk104_fifo(base); |
@@ -842,29 +708,154 @@ gk104_fifo_dtor(struct nvkm_fifo *base) | |||
842 | return fifo; | 708 | return fifo; |
843 | } | 709 | } |
844 | 710 | ||
711 | static const struct nvkm_fifo_func | ||
712 | gk104_fifo_ = { | ||
713 | .dtor = gk104_fifo_dtor, | ||
714 | .oneinit = gk104_fifo_oneinit, | ||
715 | .init = gk104_fifo_init, | ||
716 | .fini = gk104_fifo_fini, | ||
717 | .intr = gk104_fifo_intr, | ||
718 | .uevent_init = gk104_fifo_uevent_init, | ||
719 | .uevent_fini = gk104_fifo_uevent_fini, | ||
720 | .class_get = gk104_fifo_class_get, | ||
721 | }; | ||
722 | |||
845 | int | 723 | int |
846 | gk104_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device, | 724 | gk104_fifo_new_(const struct gk104_fifo_func *func, struct nvkm_device *device, |
847 | int index, int nr, struct nvkm_fifo **pfifo) | 725 | int index, int nr, struct nvkm_fifo **pfifo) |
848 | { | 726 | { |
849 | struct gk104_fifo *fifo; | 727 | struct gk104_fifo *fifo; |
850 | 728 | ||
851 | if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL))) | 729 | if (!(fifo = kzalloc(sizeof(*fifo), GFP_KERNEL))) |
852 | return -ENOMEM; | 730 | return -ENOMEM; |
731 | fifo->func = func; | ||
853 | INIT_WORK(&fifo->recover.work, gk104_fifo_recover_work); | 732 | INIT_WORK(&fifo->recover.work, gk104_fifo_recover_work); |
854 | *pfifo = &fifo->base; | 733 | *pfifo = &fifo->base; |
855 | 734 | ||
856 | return nvkm_fifo_ctor(func, device, index, nr, &fifo->base); | 735 | return nvkm_fifo_ctor(&gk104_fifo_, device, index, nr, &fifo->base); |
857 | } | 736 | } |
858 | 737 | ||
859 | static const struct nvkm_fifo_func | 738 | const struct nvkm_enum |
739 | gk104_fifo_fault_engine[] = { | ||
740 | { 0x00, "GR", NULL, NVKM_ENGINE_GR }, | ||
741 | { 0x01, "DISPLAY" }, | ||
742 | { 0x02, "CAPTURE" }, | ||
743 | { 0x03, "IFB", NULL, NVKM_ENGINE_IFB }, | ||
744 | { 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR }, | ||
745 | { 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM }, | ||
746 | { 0x06, "SCHED" }, | ||
747 | { 0x07, "HOST0" }, | ||
748 | { 0x08, "HOST1" }, | ||
749 | { 0x09, "HOST2" }, | ||
750 | { 0x0a, "HOST3" }, | ||
751 | { 0x0b, "HOST4" }, | ||
752 | { 0x0c, "HOST5" }, | ||
753 | { 0x0d, "HOST6" }, | ||
754 | { 0x0e, "HOST7" }, | ||
755 | { 0x0f, "HOSTSR" }, | ||
756 | { 0x10, "MSVLD", NULL, NVKM_ENGINE_MSVLD }, | ||
757 | { 0x11, "MSPPP", NULL, NVKM_ENGINE_MSPPP }, | ||
758 | { 0x13, "PERF" }, | ||
759 | { 0x14, "MSPDEC", NULL, NVKM_ENGINE_MSPDEC }, | ||
760 | { 0x15, "CE0", NULL, NVKM_ENGINE_CE0 }, | ||
761 | { 0x16, "CE1", NULL, NVKM_ENGINE_CE1 }, | ||
762 | { 0x17, "PMU" }, | ||
763 | { 0x18, "PTP" }, | ||
764 | { 0x19, "MSENC", NULL, NVKM_ENGINE_MSENC }, | ||
765 | { 0x1b, "CE2", NULL, NVKM_ENGINE_CE2 }, | ||
766 | {} | ||
767 | }; | ||
768 | |||
769 | const struct nvkm_enum | ||
770 | gk104_fifo_fault_reason[] = { | ||
771 | { 0x00, "PDE" }, | ||
772 | { 0x01, "PDE_SIZE" }, | ||
773 | { 0x02, "PTE" }, | ||
774 | { 0x03, "VA_LIMIT_VIOLATION" }, | ||
775 | { 0x04, "UNBOUND_INST_BLOCK" }, | ||
776 | { 0x05, "PRIV_VIOLATION" }, | ||
777 | { 0x06, "RO_VIOLATION" }, | ||
778 | { 0x07, "WO_VIOLATION" }, | ||
779 | { 0x08, "PITCH_MASK_VIOLATION" }, | ||
780 | { 0x09, "WORK_CREATION" }, | ||
781 | { 0x0a, "UNSUPPORTED_APERTURE" }, | ||
782 | { 0x0b, "COMPRESSION_FAILURE" }, | ||
783 | { 0x0c, "UNSUPPORTED_KIND" }, | ||
784 | { 0x0d, "REGION_VIOLATION" }, | ||
785 | { 0x0e, "BOTH_PTES_VALID" }, | ||
786 | { 0x0f, "INFO_TYPE_POISONED" }, | ||
787 | {} | ||
788 | }; | ||
789 | |||
790 | const struct nvkm_enum | ||
791 | gk104_fifo_fault_hubclient[] = { | ||
792 | { 0x00, "VIP" }, | ||
793 | { 0x01, "CE0" }, | ||
794 | { 0x02, "CE1" }, | ||
795 | { 0x03, "DNISO" }, | ||
796 | { 0x04, "FE" }, | ||
797 | { 0x05, "FECS" }, | ||
798 | { 0x06, "HOST" }, | ||
799 | { 0x07, "HOST_CPU" }, | ||
800 | { 0x08, "HOST_CPU_NB" }, | ||
801 | { 0x09, "ISO" }, | ||
802 | { 0x0a, "MMU" }, | ||
803 | { 0x0b, "MSPDEC" }, | ||
804 | { 0x0c, "MSPPP" }, | ||
805 | { 0x0d, "MSVLD" }, | ||
806 | { 0x0e, "NISO" }, | ||
807 | { 0x0f, "P2P" }, | ||
808 | { 0x10, "PD" }, | ||
809 | { 0x11, "PERF" }, | ||
810 | { 0x12, "PMU" }, | ||
811 | { 0x13, "RASTERTWOD" }, | ||
812 | { 0x14, "SCC" }, | ||
813 | { 0x15, "SCC_NB" }, | ||
814 | { 0x16, "SEC" }, | ||
815 | { 0x17, "SSYNC" }, | ||
816 | { 0x18, "GR_CE" }, | ||
817 | { 0x19, "CE2" }, | ||
818 | { 0x1a, "XV" }, | ||
819 | { 0x1b, "MMU_NB" }, | ||
820 | { 0x1c, "MSENC" }, | ||
821 | { 0x1d, "DFALCON" }, | ||
822 | { 0x1e, "SKED" }, | ||
823 | { 0x1f, "AFALCON" }, | ||
824 | {} | ||
825 | }; | ||
826 | |||
827 | const struct nvkm_enum | ||
828 | gk104_fifo_fault_gpcclient[] = { | ||
829 | { 0x00, "L1_0" }, { 0x01, "T1_0" }, { 0x02, "PE_0" }, | ||
830 | { 0x03, "L1_1" }, { 0x04, "T1_1" }, { 0x05, "PE_1" }, | ||
831 | { 0x06, "L1_2" }, { 0x07, "T1_2" }, { 0x08, "PE_2" }, | ||
832 | { 0x09, "L1_3" }, { 0x0a, "T1_3" }, { 0x0b, "PE_3" }, | ||
833 | { 0x0c, "RAST" }, | ||
834 | { 0x0d, "GCC" }, | ||
835 | { 0x0e, "GPCCS" }, | ||
836 | { 0x0f, "PROP_0" }, | ||
837 | { 0x10, "PROP_1" }, | ||
838 | { 0x11, "PROP_2" }, | ||
839 | { 0x12, "PROP_3" }, | ||
840 | { 0x13, "L1_4" }, { 0x14, "T1_4" }, { 0x15, "PE_4" }, | ||
841 | { 0x16, "L1_5" }, { 0x17, "T1_5" }, { 0x18, "PE_5" }, | ||
842 | { 0x19, "L1_6" }, { 0x1a, "T1_6" }, { 0x1b, "PE_6" }, | ||
843 | { 0x1c, "L1_7" }, { 0x1d, "T1_7" }, { 0x1e, "PE_7" }, | ||
844 | { 0x1f, "GPM" }, | ||
845 | { 0x20, "LTP_UTLB_0" }, | ||
846 | { 0x21, "LTP_UTLB_1" }, | ||
847 | { 0x22, "LTP_UTLB_2" }, | ||
848 | { 0x23, "LTP_UTLB_3" }, | ||
849 | { 0x24, "GPC_RGG_UTLB" }, | ||
850 | {} | ||
851 | }; | ||
852 | |||
853 | static const struct gk104_fifo_func | ||
860 | gk104_fifo = { | 854 | gk104_fifo = { |
861 | .dtor = gk104_fifo_dtor, | 855 | .fault.engine = gk104_fifo_fault_engine, |
862 | .oneinit = gk104_fifo_oneinit, | 856 | .fault.reason = gk104_fifo_fault_reason, |
863 | .init = gk104_fifo_init, | 857 | .fault.hubclient = gk104_fifo_fault_hubclient, |
864 | .fini = gk104_fifo_fini, | 858 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
865 | .intr = gk104_fifo_intr, | ||
866 | .uevent_init = gk104_fifo_uevent_init, | ||
867 | .uevent_fini = gk104_fifo_uevent_fini, | ||
868 | .chan = { | 859 | .chan = { |
869 | &gk104_fifo_gpfifo_oclass, | 860 | &gk104_fifo_gpfifo_oclass, |
870 | NULL | 861 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h index 9e5d00ba34a2..679f3ec311e9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h | |||
@@ -3,10 +3,12 @@ | |||
3 | #define gk104_fifo(p) container_of((p), struct gk104_fifo, base) | 3 | #define gk104_fifo(p) container_of((p), struct gk104_fifo, base) |
4 | #include "priv.h" | 4 | #include "priv.h" |
5 | 5 | ||
6 | #include <core/enum.h> | ||
6 | #include <subdev/mmu.h> | 7 | #include <subdev/mmu.h> |
7 | 8 | ||
8 | struct gk104_fifo_chan; | 9 | struct gk104_fifo_chan; |
9 | struct gk104_fifo { | 10 | struct gk104_fifo { |
11 | const struct gk104_fifo_func *func; | ||
10 | struct nvkm_fifo base; | 12 | struct nvkm_fifo base; |
11 | 13 | ||
12 | struct { | 14 | struct { |
@@ -39,15 +41,19 @@ struct gk104_fifo { | |||
39 | } user; | 41 | } user; |
40 | }; | 42 | }; |
41 | 43 | ||
42 | int gk104_fifo_new_(const struct nvkm_fifo_func *, struct nvkm_device *, | 44 | struct gk104_fifo_func { |
45 | struct { | ||
46 | const struct nvkm_enum *engine; | ||
47 | const struct nvkm_enum *reason; | ||
48 | const struct nvkm_enum *hubclient; | ||
49 | const struct nvkm_enum *gpcclient; | ||
50 | } fault; | ||
51 | |||
52 | const struct nvkm_fifo_chan_oclass *chan[]; | ||
53 | }; | ||
54 | |||
55 | int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *, | ||
43 | int index, int nr, struct nvkm_fifo **); | 56 | int index, int nr, struct nvkm_fifo **); |
44 | void *gk104_fifo_dtor(struct nvkm_fifo *); | ||
45 | int gk104_fifo_oneinit(struct nvkm_fifo *); | ||
46 | void gk104_fifo_init(struct nvkm_fifo *); | ||
47 | void gk104_fifo_fini(struct nvkm_fifo *); | ||
48 | void gk104_fifo_intr(struct nvkm_fifo *); | ||
49 | void gk104_fifo_uevent_init(struct nvkm_fifo *); | ||
50 | void gk104_fifo_uevent_fini(struct nvkm_fifo *); | ||
51 | void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *); | 57 | void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *); |
52 | void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); | 58 | void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *); |
53 | void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl); | 59 | void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl); |
@@ -70,4 +76,11 @@ gk104_fifo_engine_subdev(int engine) | |||
70 | return 0; | 76 | return 0; |
71 | } | 77 | } |
72 | } | 78 | } |
79 | |||
80 | extern const struct nvkm_enum gk104_fifo_fault_engine[]; | ||
81 | extern const struct nvkm_enum gk104_fifo_fault_reason[]; | ||
82 | extern const struct nvkm_enum gk104_fifo_fault_hubclient[]; | ||
83 | extern const struct nvkm_enum gk104_fifo_fault_gpcclient[]; | ||
84 | |||
85 | extern const struct nvkm_enum gm107_fifo_fault_engine[]; | ||
73 | #endif | 86 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c index 41307fcd4bb3..b2f8ab7bf847 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk110.c | |||
@@ -24,15 +24,12 @@ | |||
24 | #include "gk104.h" | 24 | #include "gk104.h" |
25 | #include "changk104.h" | 25 | #include "changk104.h" |
26 | 26 | ||
27 | static const struct nvkm_fifo_func | 27 | static const struct gk104_fifo_func |
28 | gk110_fifo = { | 28 | gk110_fifo = { |
29 | .dtor = gk104_fifo_dtor, | 29 | .fault.engine = gk104_fifo_fault_engine, |
30 | .oneinit = gk104_fifo_oneinit, | 30 | .fault.reason = gk104_fifo_fault_reason, |
31 | .init = gk104_fifo_init, | 31 | .fault.hubclient = gk104_fifo_fault_hubclient, |
32 | .fini = gk104_fifo_fini, | 32 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
33 | .intr = gk104_fifo_intr, | ||
34 | .uevent_init = gk104_fifo_uevent_init, | ||
35 | .uevent_fini = gk104_fifo_uevent_fini, | ||
36 | .chan = { | 33 | .chan = { |
37 | &gk110_fifo_gpfifo_oclass, | 34 | &gk110_fifo_gpfifo_oclass, |
38 | NULL | 35 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c index ce01c1a7d41c..160617d376e4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c | |||
@@ -24,15 +24,12 @@ | |||
24 | #include "gk104.h" | 24 | #include "gk104.h" |
25 | #include "changk104.h" | 25 | #include "changk104.h" |
26 | 26 | ||
27 | static const struct nvkm_fifo_func | 27 | static const struct gk104_fifo_func |
28 | gk208_fifo = { | 28 | gk208_fifo = { |
29 | .dtor = gk104_fifo_dtor, | 29 | .fault.engine = gk104_fifo_fault_engine, |
30 | .oneinit = gk104_fifo_oneinit, | 30 | .fault.reason = gk104_fifo_fault_reason, |
31 | .init = gk104_fifo_init, | 31 | .fault.hubclient = gk104_fifo_fault_hubclient, |
32 | .fini = gk104_fifo_fini, | 32 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
33 | .intr = gk104_fifo_intr, | ||
34 | .uevent_init = gk104_fifo_uevent_init, | ||
35 | .uevent_fini = gk104_fifo_uevent_fini, | ||
36 | .chan = { | 33 | .chan = { |
37 | &gk104_fifo_gpfifo_oclass, | 34 | &gk104_fifo_gpfifo_oclass, |
38 | NULL | 35 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk20a.c index b47fe98f4181..be9f5c16ed7d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk20a.c | |||
@@ -22,15 +22,12 @@ | |||
22 | #include "gk104.h" | 22 | #include "gk104.h" |
23 | #include "changk104.h" | 23 | #include "changk104.h" |
24 | 24 | ||
25 | static const struct nvkm_fifo_func | 25 | static const struct gk104_fifo_func |
26 | gk20a_fifo = { | 26 | gk20a_fifo = { |
27 | .dtor = gk104_fifo_dtor, | 27 | .fault.engine = gk104_fifo_fault_engine, |
28 | .oneinit = gk104_fifo_oneinit, | 28 | .fault.reason = gk104_fifo_fault_reason, |
29 | .init = gk104_fifo_init, | 29 | .fault.hubclient = gk104_fifo_fault_hubclient, |
30 | .fini = gk104_fifo_fini, | 30 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
31 | .intr = gk104_fifo_intr, | ||
32 | .uevent_init = gk104_fifo_uevent_init, | ||
33 | .uevent_fini = gk104_fifo_uevent_fini, | ||
34 | .chan = { | 31 | .chan = { |
35 | &gk104_fifo_gpfifo_oclass, | 32 | &gk104_fifo_gpfifo_oclass, |
36 | NULL | 33 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c index 6d59d65794a1..bd1ff877aa06 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm107.c | |||
@@ -24,15 +24,35 @@ | |||
24 | #include "gk104.h" | 24 | #include "gk104.h" |
25 | #include "changk104.h" | 25 | #include "changk104.h" |
26 | 26 | ||
27 | static const struct nvkm_fifo_func | 27 | const struct nvkm_enum |
28 | gm107_fifo_fault_engine[] = { | ||
29 | { 0x01, "DISPLAY" }, | ||
30 | { 0x02, "CAPTURE" }, | ||
31 | { 0x03, "IFB", NULL, NVKM_ENGINE_IFB }, | ||
32 | { 0x04, "BAR1", NULL, NVKM_SUBDEV_BAR }, | ||
33 | { 0x05, "BAR2", NULL, NVKM_SUBDEV_INSTMEM }, | ||
34 | { 0x06, "SCHED" }, | ||
35 | { 0x07, "HOST0" }, | ||
36 | { 0x08, "HOST1" }, | ||
37 | { 0x09, "HOST2" }, | ||
38 | { 0x0a, "HOST3" }, | ||
39 | { 0x0b, "HOST4" }, | ||
40 | { 0x0c, "HOST5" }, | ||
41 | { 0x0d, "HOST6" }, | ||
42 | { 0x0e, "HOST7" }, | ||
43 | { 0x0f, "HOSTSR" }, | ||
44 | { 0x13, "PERF" }, | ||
45 | { 0x17, "PMU" }, | ||
46 | { 0x18, "PTP" }, | ||
47 | {} | ||
48 | }; | ||
49 | |||
50 | static const struct gk104_fifo_func | ||
28 | gm107_fifo = { | 51 | gm107_fifo = { |
29 | .dtor = gk104_fifo_dtor, | 52 | .fault.engine = gm107_fifo_fault_engine, |
30 | .oneinit = gk104_fifo_oneinit, | 53 | .fault.reason = gk104_fifo_fault_reason, |
31 | .init = gk104_fifo_init, | 54 | .fault.hubclient = gk104_fifo_fault_hubclient, |
32 | .fini = gk104_fifo_fini, | 55 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
33 | .intr = gk104_fifo_intr, | ||
34 | .uevent_init = gk104_fifo_uevent_init, | ||
35 | .uevent_fini = gk104_fifo_uevent_fini, | ||
36 | .chan = { | 56 | .chan = { |
37 | &gk110_fifo_gpfifo_oclass, | 57 | &gk110_fifo_gpfifo_oclass, |
38 | NULL | 58 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c index 4bdd43078df9..b069f785c5d8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm200.c | |||
@@ -24,15 +24,12 @@ | |||
24 | #include "gk104.h" | 24 | #include "gk104.h" |
25 | #include "changk104.h" | 25 | #include "changk104.h" |
26 | 26 | ||
27 | static const struct nvkm_fifo_func | 27 | static const struct gk104_fifo_func |
28 | gm200_fifo = { | 28 | gm200_fifo = { |
29 | .dtor = gk104_fifo_dtor, | 29 | .fault.engine = gm107_fifo_fault_engine, |
30 | .oneinit = gk104_fifo_oneinit, | 30 | .fault.reason = gk104_fifo_fault_reason, |
31 | .init = gk104_fifo_init, | 31 | .fault.hubclient = gk104_fifo_fault_hubclient, |
32 | .fini = gk104_fifo_fini, | 32 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
33 | .intr = gk104_fifo_intr, | ||
34 | .uevent_init = gk104_fifo_uevent_init, | ||
35 | .uevent_fini = gk104_fifo_uevent_fini, | ||
36 | .chan = { | 33 | .chan = { |
37 | &gm200_fifo_gpfifo_oclass, | 34 | &gm200_fifo_gpfifo_oclass, |
38 | NULL | 35 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c index 4c91d4aa1e9e..2ed87c2e8299 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm20b.c | |||
@@ -22,15 +22,12 @@ | |||
22 | #include "gk104.h" | 22 | #include "gk104.h" |
23 | #include "changk104.h" | 23 | #include "changk104.h" |
24 | 24 | ||
25 | static const struct nvkm_fifo_func | 25 | static const struct gk104_fifo_func |
26 | gm20b_fifo = { | 26 | gm20b_fifo = { |
27 | .dtor = gk104_fifo_dtor, | 27 | .fault.engine = gm107_fifo_fault_engine, |
28 | .oneinit = gk104_fifo_oneinit, | 28 | .fault.reason = gk104_fifo_fault_reason, |
29 | .init = gk104_fifo_init, | 29 | .fault.hubclient = gk104_fifo_fault_hubclient, |
30 | .fini = gk104_fifo_fini, | 30 | .fault.gpcclient = gk104_fifo_fault_gpcclient, |
31 | .intr = gk104_fifo_intr, | ||
32 | .uevent_init = gk104_fifo_uevent_init, | ||
33 | .uevent_fini = gk104_fifo_uevent_fini, | ||
34 | .chan = { | 31 | .chan = { |
35 | &gm200_fifo_gpfifo_oclass, | 32 | &gm200_fifo_gpfifo_oclass, |
36 | NULL | 33 | NULL |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h index cb1432e9be08..f6dfb37d9429 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h | |||
@@ -7,6 +7,7 @@ int nvkm_fifo_ctor(const struct nvkm_fifo_func *, struct nvkm_device *, | |||
7 | int index, int nr, struct nvkm_fifo *); | 7 | int index, int nr, struct nvkm_fifo *); |
8 | void nvkm_fifo_uevent(struct nvkm_fifo *); | 8 | void nvkm_fifo_uevent(struct nvkm_fifo *); |
9 | 9 | ||
10 | struct nvkm_fifo_chan_oclass; | ||
10 | struct nvkm_fifo_func { | 11 | struct nvkm_fifo_func { |
11 | void *(*dtor)(struct nvkm_fifo *); | 12 | void *(*dtor)(struct nvkm_fifo *); |
12 | int (*oneinit)(struct nvkm_fifo *); | 13 | int (*oneinit)(struct nvkm_fifo *); |
@@ -17,6 +18,8 @@ struct nvkm_fifo_func { | |||
17 | void (*start)(struct nvkm_fifo *, unsigned long *); | 18 | void (*start)(struct nvkm_fifo *, unsigned long *); |
18 | void (*uevent_init)(struct nvkm_fifo *); | 19 | void (*uevent_init)(struct nvkm_fifo *); |
19 | void (*uevent_fini)(struct nvkm_fifo *); | 20 | void (*uevent_fini)(struct nvkm_fifo *); |
21 | int (*class_get)(struct nvkm_fifo *, int index, | ||
22 | const struct nvkm_fifo_chan_oclass **); | ||
20 | const struct nvkm_fifo_chan_oclass *chan[]; | 23 | const struct nvkm_fifo_chan_oclass *chan[]; |
21 | }; | 24 | }; |
22 | 25 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c index 090765ff070d..467065d1b4e6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | |||
@@ -128,9 +128,8 @@ nvkm_gr = { | |||
128 | 128 | ||
129 | int | 129 | int |
130 | nvkm_gr_ctor(const struct nvkm_gr_func *func, struct nvkm_device *device, | 130 | nvkm_gr_ctor(const struct nvkm_gr_func *func, struct nvkm_device *device, |
131 | int index, u32 pmc_enable, bool enable, struct nvkm_gr *gr) | 131 | int index, bool enable, struct nvkm_gr *gr) |
132 | { | 132 | { |
133 | gr->func = func; | 133 | gr->func = func; |
134 | return nvkm_engine_ctor(&nvkm_gr, device, index, pmc_enable, | 134 | return nvkm_engine_ctor(&nvkm_gr, device, index, enable, &gr->engine); |
135 | enable, &gr->engine); | ||
136 | } | 135 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c index 56f392d3d4fd..b02d8f50ea6a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.c | |||
@@ -1181,20 +1181,20 @@ gf100_grctx_generate_r418bb8(struct gf100_gr *gr) | |||
1181 | 1181 | ||
1182 | /* GPC_BROADCAST */ | 1182 | /* GPC_BROADCAST */ |
1183 | nvkm_wr32(device, 0x418bb8, (gr->tpc_total << 8) | | 1183 | nvkm_wr32(device, 0x418bb8, (gr->tpc_total << 8) | |
1184 | gr->magic_not_rop_nr); | 1184 | gr->screen_tile_row_offset); |
1185 | for (i = 0; i < 6; i++) | 1185 | for (i = 0; i < 6; i++) |
1186 | nvkm_wr32(device, 0x418b08 + (i * 4), data[i]); | 1186 | nvkm_wr32(device, 0x418b08 + (i * 4), data[i]); |
1187 | 1187 | ||
1188 | /* GPC_BROADCAST.TP_BROADCAST */ | 1188 | /* GPC_BROADCAST.TP_BROADCAST */ |
1189 | nvkm_wr32(device, 0x419bd0, (gr->tpc_total << 8) | | 1189 | nvkm_wr32(device, 0x419bd0, (gr->tpc_total << 8) | |
1190 | gr->magic_not_rop_nr | data2[0]); | 1190 | gr->screen_tile_row_offset | data2[0]); |
1191 | nvkm_wr32(device, 0x419be4, data2[1]); | 1191 | nvkm_wr32(device, 0x419be4, data2[1]); |
1192 | for (i = 0; i < 6; i++) | 1192 | for (i = 0; i < 6; i++) |
1193 | nvkm_wr32(device, 0x419b00 + (i * 4), data[i]); | 1193 | nvkm_wr32(device, 0x419b00 + (i * 4), data[i]); |
1194 | 1194 | ||
1195 | /* UNK78xx */ | 1195 | /* UNK78xx */ |
1196 | nvkm_wr32(device, 0x4078bc, (gr->tpc_total << 8) | | 1196 | nvkm_wr32(device, 0x4078bc, (gr->tpc_total << 8) | |
1197 | gr->magic_not_rop_nr); | 1197 | gr->screen_tile_row_offset); |
1198 | for (i = 0; i < 6; i++) | 1198 | for (i = 0; i < 6; i++) |
1199 | nvkm_wr32(device, 0x40780c + (i * 4), data[i]); | 1199 | nvkm_wr32(device, 0x40780c + (i * 4), data[i]); |
1200 | } | 1200 | } |
@@ -1238,6 +1238,7 @@ gf100_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
1238 | { | 1238 | { |
1239 | struct nvkm_device *device = gr->base.engine.subdev.device; | 1239 | struct nvkm_device *device = gr->base.engine.subdev.device; |
1240 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 1240 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
1241 | u32 idle_timeout; | ||
1241 | 1242 | ||
1242 | nvkm_mc_unk260(device->mc, 0); | 1243 | nvkm_mc_unk260(device->mc, 0); |
1243 | 1244 | ||
@@ -1247,7 +1248,7 @@ gf100_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
1247 | gf100_gr_mmio(gr, grctx->tpc); | 1248 | gf100_gr_mmio(gr, grctx->tpc); |
1248 | gf100_gr_mmio(gr, grctx->ppc); | 1249 | gf100_gr_mmio(gr, grctx->ppc); |
1249 | 1250 | ||
1250 | nvkm_wr32(device, 0x404154, 0x00000000); | 1251 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
1251 | 1252 | ||
1252 | grctx->bundle(info); | 1253 | grctx->bundle(info); |
1253 | grctx->pagepool(info); | 1254 | grctx->pagepool(info); |
@@ -1261,7 +1262,7 @@ gf100_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
1261 | gf100_grctx_generate_r406800(gr); | 1262 | gf100_grctx_generate_r406800(gr); |
1262 | 1263 | ||
1263 | gf100_gr_icmd(gr, grctx->icmd); | 1264 | gf100_gr_icmd(gr, grctx->icmd); |
1264 | nvkm_wr32(device, 0x404154, 0x00000400); | 1265 | nvkm_wr32(device, 0x404154, idle_timeout); |
1265 | gf100_gr_mthd(gr, grctx->mthd); | 1266 | gf100_gr_mthd(gr, grctx->mthd); |
1266 | nvkm_mc_unk260(device->mc, 1); | 1267 | nvkm_mc_unk260(device->mc, 1); |
1267 | } | 1268 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h index 3c8673958f22..ac895edce164 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h | |||
@@ -81,8 +81,6 @@ void gk104_grctx_generate_bundle(struct gf100_grctx *); | |||
81 | void gk104_grctx_generate_pagepool(struct gf100_grctx *); | 81 | void gk104_grctx_generate_pagepool(struct gf100_grctx *); |
82 | void gk104_grctx_generate_unkn(struct gf100_gr *); | 82 | void gk104_grctx_generate_unkn(struct gf100_gr *); |
83 | void gk104_grctx_generate_r418bb8(struct gf100_gr *); | 83 | void gk104_grctx_generate_r418bb8(struct gf100_gr *); |
84 | void gk104_grctx_generate_rop_active_fbps(struct gf100_gr *); | ||
85 | |||
86 | 84 | ||
87 | void gm107_grctx_generate_bundle(struct gf100_grctx *); | 85 | void gm107_grctx_generate_bundle(struct gf100_grctx *); |
88 | void gm107_grctx_generate_pagepool(struct gf100_grctx *); | 86 | void gm107_grctx_generate_pagepool(struct gf100_grctx *); |
@@ -98,7 +96,6 @@ void gm107_grctx_generate_pagepool(struct gf100_grctx *); | |||
98 | void gm107_grctx_generate_attrib(struct gf100_grctx *); | 96 | void gm107_grctx_generate_attrib(struct gf100_grctx *); |
99 | 97 | ||
100 | extern const struct gf100_grctx_func gm200_grctx; | 98 | extern const struct gf100_grctx_func gm200_grctx; |
101 | void gm200_grctx_generate_main(struct gf100_gr *, struct gf100_grctx *); | ||
102 | void gm200_grctx_generate_tpcid(struct gf100_gr *); | 99 | void gm200_grctx_generate_tpcid(struct gf100_gr *); |
103 | void gm200_grctx_generate_405b60(struct gf100_gr *); | 100 | void gm200_grctx_generate_405b60(struct gf100_gr *); |
104 | 101 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c index 74de7a96c22a..f521de11a299 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf117.c | |||
@@ -223,6 +223,7 @@ gf117_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
223 | { | 223 | { |
224 | struct nvkm_device *device = gr->base.engine.subdev.device; | 224 | struct nvkm_device *device = gr->base.engine.subdev.device; |
225 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 225 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
226 | u32 idle_timeout; | ||
226 | int i; | 227 | int i; |
227 | 228 | ||
228 | nvkm_mc_unk260(device->mc, 0); | 229 | nvkm_mc_unk260(device->mc, 0); |
@@ -233,7 +234,7 @@ gf117_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
233 | gf100_gr_mmio(gr, grctx->tpc); | 234 | gf100_gr_mmio(gr, grctx->tpc); |
234 | gf100_gr_mmio(gr, grctx->ppc); | 235 | gf100_gr_mmio(gr, grctx->ppc); |
235 | 236 | ||
236 | nvkm_wr32(device, 0x404154, 0x00000000); | 237 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
237 | 238 | ||
238 | grctx->bundle(info); | 239 | grctx->bundle(info); |
239 | grctx->pagepool(info); | 240 | grctx->pagepool(info); |
@@ -250,7 +251,7 @@ gf117_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
250 | nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000); | 251 | nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000); |
251 | 252 | ||
252 | gf100_gr_icmd(gr, grctx->icmd); | 253 | gf100_gr_icmd(gr, grctx->icmd); |
253 | nvkm_wr32(device, 0x404154, 0x00000400); | 254 | nvkm_wr32(device, 0x404154, idle_timeout); |
254 | gf100_gr_mthd(gr, grctx->mthd); | 255 | gf100_gr_mthd(gr, grctx->mthd); |
255 | nvkm_mc_unk260(device->mc, 1); | 256 | nvkm_mc_unk260(device->mc, 1); |
256 | } | 257 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c index a843e3689c3c..9ba337778ef5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c | |||
@@ -924,38 +924,30 @@ gk104_grctx_generate_r418bb8(struct gf100_gr *gr) | |||
924 | 924 | ||
925 | /* GPC_BROADCAST */ | 925 | /* GPC_BROADCAST */ |
926 | nvkm_wr32(device, 0x418bb8, (gr->tpc_total << 8) | | 926 | nvkm_wr32(device, 0x418bb8, (gr->tpc_total << 8) | |
927 | gr->magic_not_rop_nr); | 927 | gr->screen_tile_row_offset); |
928 | for (i = 0; i < 6; i++) | 928 | for (i = 0; i < 6; i++) |
929 | nvkm_wr32(device, 0x418b08 + (i * 4), data[i]); | 929 | nvkm_wr32(device, 0x418b08 + (i * 4), data[i]); |
930 | 930 | ||
931 | /* GPC_BROADCAST.TP_BROADCAST */ | 931 | /* GPC_BROADCAST.TP_BROADCAST */ |
932 | nvkm_wr32(device, 0x41bfd0, (gr->tpc_total << 8) | | 932 | nvkm_wr32(device, 0x41bfd0, (gr->tpc_total << 8) | |
933 | gr->magic_not_rop_nr | data2[0]); | 933 | gr->screen_tile_row_offset | data2[0]); |
934 | nvkm_wr32(device, 0x41bfe4, data2[1]); | 934 | nvkm_wr32(device, 0x41bfe4, data2[1]); |
935 | for (i = 0; i < 6; i++) | 935 | for (i = 0; i < 6; i++) |
936 | nvkm_wr32(device, 0x41bf00 + (i * 4), data[i]); | 936 | nvkm_wr32(device, 0x41bf00 + (i * 4), data[i]); |
937 | 937 | ||
938 | /* UNK78xx */ | 938 | /* UNK78xx */ |
939 | nvkm_wr32(device, 0x4078bc, (gr->tpc_total << 8) | | 939 | nvkm_wr32(device, 0x4078bc, (gr->tpc_total << 8) | |
940 | gr->magic_not_rop_nr); | 940 | gr->screen_tile_row_offset); |
941 | for (i = 0; i < 6; i++) | 941 | for (i = 0; i < 6; i++) |
942 | nvkm_wr32(device, 0x40780c + (i * 4), data[i]); | 942 | nvkm_wr32(device, 0x40780c + (i * 4), data[i]); |
943 | } | 943 | } |
944 | 944 | ||
945 | void | 945 | void |
946 | gk104_grctx_generate_rop_active_fbps(struct gf100_gr *gr) | ||
947 | { | ||
948 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
949 | const u32 fbp_count = nvkm_rd32(device, 0x120074); | ||
950 | nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ | ||
951 | nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ | ||
952 | } | ||
953 | |||
954 | void | ||
955 | gk104_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | 946 | gk104_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) |
956 | { | 947 | { |
957 | struct nvkm_device *device = gr->base.engine.subdev.device; | 948 | struct nvkm_device *device = gr->base.engine.subdev.device; |
958 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 949 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
950 | u32 idle_timeout; | ||
959 | int i; | 951 | int i; |
960 | 952 | ||
961 | nvkm_mc_unk260(device->mc, 0); | 953 | nvkm_mc_unk260(device->mc, 0); |
@@ -966,7 +958,7 @@ gk104_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
966 | gf100_gr_mmio(gr, grctx->tpc); | 958 | gf100_gr_mmio(gr, grctx->tpc); |
967 | gf100_gr_mmio(gr, grctx->ppc); | 959 | gf100_gr_mmio(gr, grctx->ppc); |
968 | 960 | ||
969 | nvkm_wr32(device, 0x404154, 0x00000000); | 961 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
970 | 962 | ||
971 | grctx->bundle(info); | 963 | grctx->bundle(info); |
972 | grctx->pagepool(info); | 964 | grctx->pagepool(info); |
@@ -982,11 +974,10 @@ gk104_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
982 | nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000); | 974 | nvkm_wr32(device, 0x4064d0 + (i * 0x04), 0x00000000); |
983 | 975 | ||
984 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); | 976 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); |
985 | gk104_grctx_generate_rop_active_fbps(gr); | ||
986 | nvkm_mask(device, 0x419f78, 0x00000001, 0x00000000); | 977 | nvkm_mask(device, 0x419f78, 0x00000001, 0x00000000); |
987 | 978 | ||
988 | gf100_gr_icmd(gr, grctx->icmd); | 979 | gf100_gr_icmd(gr, grctx->icmd); |
989 | nvkm_wr32(device, 0x404154, 0x00000400); | 980 | nvkm_wr32(device, 0x404154, idle_timeout); |
990 | gf100_gr_mthd(gr, grctx->mthd); | 981 | gf100_gr_mthd(gr, grctx->mthd); |
991 | nvkm_mc_unk260(device->mc, 1); | 982 | nvkm_mc_unk260(device->mc, 1); |
992 | 983 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c index ad0a6cfe7580..da7c35a6a3d2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk20a.c | |||
@@ -29,15 +29,14 @@ gk20a_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
29 | { | 29 | { |
30 | struct nvkm_device *device = gr->base.engine.subdev.device; | 30 | struct nvkm_device *device = gr->base.engine.subdev.device; |
31 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 31 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
32 | int idle_timeout_save; | 32 | u32 idle_timeout; |
33 | int i; | 33 | int i; |
34 | 34 | ||
35 | gf100_gr_mmio(gr, gr->fuc_sw_ctx); | 35 | gf100_gr_mmio(gr, gr->fuc_sw_ctx); |
36 | 36 | ||
37 | gf100_gr_wait_idle(gr); | 37 | gf100_gr_wait_idle(gr); |
38 | 38 | ||
39 | idle_timeout_save = nvkm_rd32(device, 0x404154); | 39 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
40 | nvkm_wr32(device, 0x404154, 0x00000000); | ||
41 | 40 | ||
42 | grctx->attrib(info); | 41 | grctx->attrib(info); |
43 | 42 | ||
@@ -53,13 +52,11 @@ gk20a_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
53 | 52 | ||
54 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); | 53 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); |
55 | 54 | ||
56 | gk104_grctx_generate_rop_active_fbps(gr); | ||
57 | |||
58 | nvkm_mask(device, 0x5044b0, 0x08000000, 0x08000000); | 55 | nvkm_mask(device, 0x5044b0, 0x08000000, 0x08000000); |
59 | 56 | ||
60 | gf100_gr_wait_idle(gr); | 57 | gf100_gr_wait_idle(gr); |
61 | 58 | ||
62 | nvkm_wr32(device, 0x404154, idle_timeout_save); | 59 | nvkm_wr32(device, 0x404154, idle_timeout); |
63 | gf100_gr_wait_idle(gr); | 60 | gf100_gr_wait_idle(gr); |
64 | 61 | ||
65 | gf100_gr_mthd(gr, gr->fuc_method); | 62 | gf100_gr_mthd(gr, gr->fuc_method); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c index 95f59e3169f2..6d3c5011e18c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm107.c | |||
@@ -920,13 +920,15 @@ gm107_grctx_generate_attrib(struct gf100_grctx *info) | |||
920 | const u32 bs = attrib * gr->ppc_tpc_nr[gpc][ppc]; | 920 | const u32 bs = attrib * gr->ppc_tpc_nr[gpc][ppc]; |
921 | const u32 u = 0x418ea0 + (n * 0x04); | 921 | const u32 u = 0x418ea0 + (n * 0x04); |
922 | const u32 o = PPC_UNIT(gpc, ppc, 0); | 922 | const u32 o = PPC_UNIT(gpc, ppc, 0); |
923 | if (!(gr->ppc_mask[gpc] & (1 << ppc))) | ||
924 | continue; | ||
923 | mmio_wr32(info, o + 0xc0, bs); | 925 | mmio_wr32(info, o + 0xc0, bs); |
924 | mmio_wr32(info, o + 0xf4, bo); | 926 | mmio_wr32(info, o + 0xf4, bo); |
925 | bo += grctx->attrib_nr_max * gr->ppc_tpc_nr[gpc][ppc]; | 927 | bo += grctx->attrib_nr_max * gr->ppc_tpc_nr[gpc][ppc]; |
926 | mmio_wr32(info, o + 0xe4, as); | 928 | mmio_wr32(info, o + 0xe4, as); |
927 | mmio_wr32(info, o + 0xf8, ao); | 929 | mmio_wr32(info, o + 0xf8, ao); |
928 | ao += grctx->alpha_nr_max * gr->ppc_tpc_nr[gpc][ppc]; | 930 | ao += grctx->alpha_nr_max * gr->ppc_tpc_nr[gpc][ppc]; |
929 | mmio_wr32(info, u, ((bs / 3 /*XXX*/) << 16) | bs); | 931 | mmio_wr32(info, u, ((bs / 3) << 16) | bs); |
930 | } | 932 | } |
931 | } | 933 | } |
932 | } | 934 | } |
@@ -957,6 +959,7 @@ gm107_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
957 | { | 959 | { |
958 | struct nvkm_device *device = gr->base.engine.subdev.device; | 960 | struct nvkm_device *device = gr->base.engine.subdev.device; |
959 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 961 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
962 | u32 idle_timeout; | ||
960 | int i; | 963 | int i; |
961 | 964 | ||
962 | gf100_gr_mmio(gr, grctx->hub); | 965 | gf100_gr_mmio(gr, grctx->hub); |
@@ -965,7 +968,7 @@ gm107_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
965 | gf100_gr_mmio(gr, grctx->tpc); | 968 | gf100_gr_mmio(gr, grctx->tpc); |
966 | gf100_gr_mmio(gr, grctx->ppc); | 969 | gf100_gr_mmio(gr, grctx->ppc); |
967 | 970 | ||
968 | nvkm_wr32(device, 0x404154, 0x00000000); | 971 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
969 | 972 | ||
970 | grctx->bundle(info); | 973 | grctx->bundle(info); |
971 | grctx->pagepool(info); | 974 | grctx->pagepool(info); |
@@ -984,10 +987,8 @@ gm107_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
984 | 987 | ||
985 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); | 988 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); |
986 | 989 | ||
987 | gk104_grctx_generate_rop_active_fbps(gr); | ||
988 | |||
989 | gf100_gr_icmd(gr, grctx->icmd); | 990 | gf100_gr_icmd(gr, grctx->icmd); |
990 | nvkm_wr32(device, 0x404154, 0x00000400); | 991 | nvkm_wr32(device, 0x404154, idle_timeout); |
991 | gf100_gr_mthd(gr, grctx->mthd); | 992 | gf100_gr_mthd(gr, grctx->mthd); |
992 | 993 | ||
993 | nvkm_mask(device, 0x419e00, 0x00808080, 0x00808080); | 994 | nvkm_mask(device, 0x419e00, 0x00808080, 0x00808080); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c index e586699fc43f..db209d33f486 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm200.c | |||
@@ -33,7 +33,7 @@ gm200_grctx_generate_tpcid(struct gf100_gr *gr) | |||
33 | struct nvkm_device *device = gr->base.engine.subdev.device; | 33 | struct nvkm_device *device = gr->base.engine.subdev.device; |
34 | int gpc, tpc, id; | 34 | int gpc, tpc, id; |
35 | 35 | ||
36 | for (tpc = 0, id = 0; tpc < 4; tpc++) { | 36 | for (tpc = 0, id = 0; tpc < TPC_MAX_PER_GPC; tpc++) { |
37 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 37 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
38 | if (tpc < gr->tpc_nr[gpc]) { | 38 | if (tpc < gr->tpc_nr[gpc]) { |
39 | nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x698), id); | 39 | nvkm_wr32(device, TPC_UNIT(gpc, tpc, 0x698), id); |
@@ -45,15 +45,6 @@ gm200_grctx_generate_tpcid(struct gf100_gr *gr) | |||
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ||
48 | static void | ||
49 | gm200_grctx_generate_rop_active_fbps(struct gf100_gr *gr) | ||
50 | { | ||
51 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
52 | const u32 fbp_count = nvkm_rd32(device, 0x12006c); | ||
53 | nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ | ||
54 | nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ | ||
55 | } | ||
56 | |||
57 | void | 48 | void |
58 | gm200_grctx_generate_405b60(struct gf100_gr *gr) | 49 | gm200_grctx_generate_405b60(struct gf100_gr *gr) |
59 | { | 50 | { |
@@ -86,17 +77,17 @@ gm200_grctx_generate_405b60(struct gf100_gr *gr) | |||
86 | nvkm_wr32(device, 0x405ba0 + (i * 4), gpcs[i]); | 77 | nvkm_wr32(device, 0x405ba0 + (i * 4), gpcs[i]); |
87 | } | 78 | } |
88 | 79 | ||
89 | void | 80 | static void |
90 | gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | 81 | gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) |
91 | { | 82 | { |
92 | struct nvkm_device *device = gr->base.engine.subdev.device; | 83 | struct nvkm_device *device = gr->base.engine.subdev.device; |
93 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 84 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
94 | u32 tmp; | 85 | u32 idle_timeout, tmp; |
95 | int i; | 86 | int i; |
96 | 87 | ||
97 | gf100_gr_mmio(gr, gr->fuc_sw_ctx); | 88 | gf100_gr_mmio(gr, gr->fuc_sw_ctx); |
98 | 89 | ||
99 | nvkm_wr32(device, 0x404154, 0x00000000); | 90 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
100 | 91 | ||
101 | grctx->bundle(info); | 92 | grctx->bundle(info); |
102 | grctx->pagepool(info); | 93 | grctx->pagepool(info); |
@@ -113,8 +104,6 @@ gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
113 | 104 | ||
114 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); | 105 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); |
115 | 106 | ||
116 | gm200_grctx_generate_rop_active_fbps(gr); | ||
117 | |||
118 | for (tmp = 0, i = 0; i < gr->gpc_nr; i++) | 107 | for (tmp = 0, i = 0; i < gr->gpc_nr; i++) |
119 | tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4); | 108 | tmp |= ((1 << gr->tpc_nr[i]) - 1) << (i * 4); |
120 | nvkm_wr32(device, 0x4041c4, tmp); | 109 | nvkm_wr32(device, 0x4041c4, tmp); |
@@ -122,7 +111,7 @@ gm200_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
122 | gm200_grctx_generate_405b60(gr); | 111 | gm200_grctx_generate_405b60(gr); |
123 | 112 | ||
124 | gf100_gr_icmd(gr, gr->fuc_bundle); | 113 | gf100_gr_icmd(gr, gr->fuc_bundle); |
125 | nvkm_wr32(device, 0x404154, 0x00000800); | 114 | nvkm_wr32(device, 0x404154, idle_timeout); |
126 | gf100_gr_mthd(gr, gr->fuc_method); | 115 | gf100_gr_mthd(gr, gr->fuc_method); |
127 | 116 | ||
128 | nvkm_mask(device, 0x418e94, 0xffffffff, 0xc4230000); | 117 | nvkm_mask(device, 0x418e94, 0xffffffff, 0xc4230000); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c index a8827efa90ae..e5702e3e0a5a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgm20b.c | |||
@@ -40,15 +40,14 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
40 | { | 40 | { |
41 | struct nvkm_device *device = gr->base.engine.subdev.device; | 41 | struct nvkm_device *device = gr->base.engine.subdev.device; |
42 | const struct gf100_grctx_func *grctx = gr->func->grctx; | 42 | const struct gf100_grctx_func *grctx = gr->func->grctx; |
43 | int idle_timeout_save; | 43 | u32 idle_timeout; |
44 | int i, tmp; | 44 | int i, tmp; |
45 | 45 | ||
46 | gf100_gr_mmio(gr, gr->fuc_sw_ctx); | 46 | gf100_gr_mmio(gr, gr->fuc_sw_ctx); |
47 | 47 | ||
48 | gf100_gr_wait_idle(gr); | 48 | gf100_gr_wait_idle(gr); |
49 | 49 | ||
50 | idle_timeout_save = nvkm_rd32(device, 0x404154); | 50 | idle_timeout = nvkm_mask(device, 0x404154, 0xffffffff, 0x00000000); |
51 | nvkm_wr32(device, 0x404154, 0x00000000); | ||
52 | 51 | ||
53 | grctx->attrib(info); | 52 | grctx->attrib(info); |
54 | 53 | ||
@@ -63,7 +62,6 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
63 | 62 | ||
64 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); | 63 | nvkm_wr32(device, 0x405b00, (gr->tpc_total << 8) | gr->gpc_nr); |
65 | 64 | ||
66 | gk104_grctx_generate_rop_active_fbps(gr); | ||
67 | nvkm_wr32(device, 0x408908, nvkm_rd32(device, 0x410108) | 0x80000000); | 65 | nvkm_wr32(device, 0x408908, nvkm_rd32(device, 0x410108) | 0x80000000); |
68 | 66 | ||
69 | for (tmp = 0, i = 0; i < gr->gpc_nr; i++) | 67 | for (tmp = 0, i = 0; i < gr->gpc_nr; i++) |
@@ -74,7 +72,7 @@ gm20b_grctx_generate_main(struct gf100_gr *gr, struct gf100_grctx *info) | |||
74 | 72 | ||
75 | gf100_gr_wait_idle(gr); | 73 | gf100_gr_wait_idle(gr); |
76 | 74 | ||
77 | nvkm_wr32(device, 0x404154, idle_timeout_save); | 75 | nvkm_wr32(device, 0x404154, idle_timeout); |
78 | gf100_gr_wait_idle(gr); | 76 | gf100_gr_wait_idle(gr); |
79 | 77 | ||
80 | gf100_gr_mthd(gr, gr->fuc_method); | 78 | gf100_gr_mthd(gr, gr->fuc_method); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc index dc60509f76f7..4984b0069dfd 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc | |||
@@ -291,12 +291,13 @@ init: | |||
291 | // Main program loop, very simple, sleeps until woken up by the interrupt | 291 | // Main program loop, very simple, sleeps until woken up by the interrupt |
292 | // handler, pulls a command from the queue and executes its handler | 292 | // handler, pulls a command from the queue and executes its handler |
293 | // | 293 | // |
294 | main: | 294 | wait: |
295 | bset $flags $p0 | ||
296 | sleep $p0 | 295 | sleep $p0 |
296 | bset $flags $p0 | ||
297 | main: | ||
297 | mov $r13 #cmd_queue | 298 | mov $r13 #cmd_queue |
298 | call(queue_get) | 299 | call(queue_get) |
299 | bra $p1 #main | 300 | bra $p1 #wait |
300 | 301 | ||
301 | // 0x0000-0x0003 are all context transfers | 302 | // 0x0000-0x0003 are all context transfers |
302 | cmpu b32 $r14 0x04 | 303 | cmpu b32 $r14 0x04 |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h index 5f4ddfee48a2..8cb240b65ec2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h | |||
@@ -370,9 +370,10 @@ uint32_t gf100_grgpc_code[] = { | |||
370 | 0xf11f29f0, | 370 | 0xf11f29f0, |
371 | 0xf0080007, | 371 | 0xf0080007, |
372 | 0x02d00203, | 372 | 0x02d00203, |
373 | /* 0x04bb: main */ | 373 | /* 0x04bb: wait */ |
374 | 0xf404bd00, | 374 | 0xf404bd00, |
375 | 0x28f40031, | 375 | 0x31f40028, |
376 | /* 0x04c1: main */ | ||
376 | 0x1cd7f000, | 377 | 0x1cd7f000, |
377 | 0xf43921f4, | 378 | 0xf43921f4, |
378 | 0xe4b0f401, | 379 | 0xe4b0f401, |
@@ -384,10 +385,10 @@ uint32_t gf100_grgpc_code[] = { | |||
384 | 0x0018fe05, | 385 | 0x0018fe05, |
385 | 0x05b421f5, | 386 | 0x05b421f5, |
386 | /* 0x04eb: main_not_ctx_xfer */ | 387 | /* 0x04eb: main_not_ctx_xfer */ |
387 | 0x94d30ef4, | 388 | 0x94d90ef4, |
388 | 0xf5f010ef, | 389 | 0xf5f010ef, |
389 | 0x7e21f501, | 390 | 0x7e21f501, |
390 | 0xc60ef403, | 391 | 0xcc0ef403, |
391 | /* 0x04f8: ih */ | 392 | /* 0x04f8: ih */ |
392 | 0x80f900f9, | 393 | 0x80f900f9, |
393 | 0xf90188fe, | 394 | 0xf90188fe, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h index 03381b163cfc..550d6ba0933b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h | |||
@@ -397,9 +397,10 @@ uint32_t gf117_grgpc_code[] = { | |||
397 | 0x080007f1, | 397 | 0x080007f1, |
398 | 0xd00203f0, | 398 | 0xd00203f0, |
399 | 0x04bd0002, | 399 | 0x04bd0002, |
400 | /* 0x0508: main */ | 400 | /* 0x0508: wait */ |
401 | 0xf40031f4, | 401 | 0xf40028f4, |
402 | 0xd7f00028, | 402 | /* 0x050e: main */ |
403 | 0xd7f00031, | ||
403 | 0x3921f424, | 404 | 0x3921f424, |
404 | 0xb0f401f4, | 405 | 0xb0f401f4, |
405 | 0x18f404e4, | 406 | 0x18f404e4, |
@@ -409,13 +410,13 @@ uint32_t gf117_grgpc_code[] = { | |||
409 | 0xfd01e4b6, | 410 | 0xfd01e4b6, |
410 | 0x18fe051e, | 411 | 0x18fe051e, |
411 | 0x0121f500, | 412 | 0x0121f500, |
412 | 0xd30ef406, | 413 | 0xd90ef406, |
413 | /* 0x0538: main_not_ctx_xfer */ | 414 | /* 0x0538: main_not_ctx_xfer */ |
414 | 0xf010ef94, | 415 | 0xf010ef94, |
415 | 0x21f501f5, | 416 | 0x21f501f5, |
416 | 0x0ef4037e, | 417 | 0x0ef4037e, |
417 | /* 0x0545: ih */ | 418 | /* 0x0545: ih */ |
418 | 0xf900f9c6, | 419 | 0xf900f9cc, |
419 | 0x0188fe80, | 420 | 0x0188fe80, |
420 | 0x90f980f9, | 421 | 0x90f980f9, |
421 | 0xb0f9a0f9, | 422 | 0xb0f9a0f9, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h index 99d9b48a3b50..271b59d365e5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h | |||
@@ -397,9 +397,10 @@ uint32_t gk104_grgpc_code[] = { | |||
397 | 0x080007f1, | 397 | 0x080007f1, |
398 | 0xd00203f0, | 398 | 0xd00203f0, |
399 | 0x04bd0002, | 399 | 0x04bd0002, |
400 | /* 0x0508: main */ | 400 | /* 0x0508: wait */ |
401 | 0xf40031f4, | 401 | 0xf40028f4, |
402 | 0xd7f00028, | 402 | /* 0x050e: main */ |
403 | 0xd7f00031, | ||
403 | 0x3921f424, | 404 | 0x3921f424, |
404 | 0xb0f401f4, | 405 | 0xb0f401f4, |
405 | 0x18f404e4, | 406 | 0x18f404e4, |
@@ -409,13 +410,13 @@ uint32_t gk104_grgpc_code[] = { | |||
409 | 0xfd01e4b6, | 410 | 0xfd01e4b6, |
410 | 0x18fe051e, | 411 | 0x18fe051e, |
411 | 0x0121f500, | 412 | 0x0121f500, |
412 | 0xd30ef406, | 413 | 0xd90ef406, |
413 | /* 0x0538: main_not_ctx_xfer */ | 414 | /* 0x0538: main_not_ctx_xfer */ |
414 | 0xf010ef94, | 415 | 0xf010ef94, |
415 | 0x21f501f5, | 416 | 0x21f501f5, |
416 | 0x0ef4037e, | 417 | 0x0ef4037e, |
417 | /* 0x0545: ih */ | 418 | /* 0x0545: ih */ |
418 | 0xf900f9c6, | 419 | 0xf900f9cc, |
419 | 0x0188fe80, | 420 | 0x0188fe80, |
420 | 0x90f980f9, | 421 | 0x90f980f9, |
421 | 0xb0f9a0f9, | 422 | 0xb0f9a0f9, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h index f7267696cbfd..73b4a32c5d29 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h | |||
@@ -397,9 +397,10 @@ uint32_t gk110_grgpc_code[] = { | |||
397 | 0x300007f1, | 397 | 0x300007f1, |
398 | 0xd00203f0, | 398 | 0xd00203f0, |
399 | 0x04bd0002, | 399 | 0x04bd0002, |
400 | /* 0x0508: main */ | 400 | /* 0x0508: wait */ |
401 | 0xf40031f4, | 401 | 0xf40028f4, |
402 | 0xd7f00028, | 402 | /* 0x050e: main */ |
403 | 0xd7f00031, | ||
403 | 0x3921f424, | 404 | 0x3921f424, |
404 | 0xb0f401f4, | 405 | 0xb0f401f4, |
405 | 0x18f404e4, | 406 | 0x18f404e4, |
@@ -409,13 +410,13 @@ uint32_t gk110_grgpc_code[] = { | |||
409 | 0xfd01e4b6, | 410 | 0xfd01e4b6, |
410 | 0x18fe051e, | 411 | 0x18fe051e, |
411 | 0x0121f500, | 412 | 0x0121f500, |
412 | 0xd30ef406, | 413 | 0xd90ef406, |
413 | /* 0x0538: main_not_ctx_xfer */ | 414 | /* 0x0538: main_not_ctx_xfer */ |
414 | 0xf010ef94, | 415 | 0xf010ef94, |
415 | 0x21f501f5, | 416 | 0x21f501f5, |
416 | 0x0ef4037e, | 417 | 0x0ef4037e, |
417 | /* 0x0545: ih */ | 418 | /* 0x0545: ih */ |
418 | 0xf900f9c6, | 419 | 0xf900f9cc, |
419 | 0x0188fe80, | 420 | 0x0188fe80, |
420 | 0x90f980f9, | 421 | 0x90f980f9, |
421 | 0xb0f9a0f9, | 422 | 0xb0f9a0f9, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h index 387d1fa3e231..018169818317 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h | |||
@@ -349,9 +349,10 @@ uint32_t gk208_grgpc_code[] = { | |||
349 | 0x801f29f0, | 349 | 0x801f29f0, |
350 | 0xf6023000, | 350 | 0xf6023000, |
351 | 0x04bd0002, | 351 | 0x04bd0002, |
352 | /* 0x0448: main */ | 352 | /* 0x0448: wait */ |
353 | 0xf40031f4, | 353 | 0xf40028f4, |
354 | 0x240d0028, | 354 | /* 0x044e: main */ |
355 | 0x240d0031, | ||
355 | 0x0000377e, | 356 | 0x0000377e, |
356 | 0xb0f401f4, | 357 | 0xb0f401f4, |
357 | 0x18f404e4, | 358 | 0x18f404e4, |
@@ -362,10 +363,10 @@ uint32_t gk208_grgpc_code[] = { | |||
362 | 0x0018fe05, | 363 | 0x0018fe05, |
363 | 0x00051f7e, | 364 | 0x00051f7e, |
364 | /* 0x0477: main_not_ctx_xfer */ | 365 | /* 0x0477: main_not_ctx_xfer */ |
365 | 0x94d40ef4, | 366 | 0x94da0ef4, |
366 | 0xf5f010ef, | 367 | 0xf5f010ef, |
367 | 0x02f87e01, | 368 | 0x02f87e01, |
368 | 0xc70ef400, | 369 | 0xcd0ef400, |
369 | /* 0x0484: ih */ | 370 | /* 0x0484: ih */ |
370 | 0x80f900f9, | 371 | 0x80f900f9, |
371 | 0xf90188fe, | 372 | 0xf90188fe, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h index fa9f3c0c5994..eca007f03fa9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h | |||
@@ -427,9 +427,10 @@ uint32_t gm107_grgpc_code[] = { | |||
427 | 0x1f29f024, | 427 | 0x1f29f024, |
428 | 0x02300080, | 428 | 0x02300080, |
429 | 0xbd0002f6, | 429 | 0xbd0002f6, |
430 | /* 0x0571: main */ | 430 | /* 0x0571: wait */ |
431 | 0x0031f404, | 431 | 0x0028f404, |
432 | 0x0d0028f4, | 432 | /* 0x0577: main */ |
433 | 0x0d0031f4, | ||
433 | 0x00377e24, | 434 | 0x00377e24, |
434 | 0xf401f400, | 435 | 0xf401f400, |
435 | 0xf404e4b0, | 436 | 0xf404e4b0, |
@@ -439,13 +440,13 @@ uint32_t gm107_grgpc_code[] = { | |||
439 | 0xfd01e4b6, | 440 | 0xfd01e4b6, |
440 | 0x18fe051e, | 441 | 0x18fe051e, |
441 | 0x06487e00, | 442 | 0x06487e00, |
442 | 0xd40ef400, | 443 | 0xda0ef400, |
443 | /* 0x05a0: main_not_ctx_xfer */ | 444 | /* 0x05a0: main_not_ctx_xfer */ |
444 | 0xf010ef94, | 445 | 0xf010ef94, |
445 | 0xf87e01f5, | 446 | 0xf87e01f5, |
446 | 0x0ef40002, | 447 | 0x0ef40002, |
447 | /* 0x05ad: ih */ | 448 | /* 0x05ad: ih */ |
448 | 0xf900f9c7, | 449 | 0xf900f9cd, |
449 | 0x0188fe80, | 450 | 0x0188fe80, |
450 | 0x90f980f9, | 451 | 0x90f980f9, |
451 | 0xb0f9a0f9, | 452 | 0xb0f9a0f9, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc index e3a2fb308271..4d416d4f82d7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc | |||
@@ -218,13 +218,14 @@ init: | |||
218 | // Main program loop, very simple, sleeps until woken up by the interrupt | 218 | // Main program loop, very simple, sleeps until woken up by the interrupt |
219 | // handler, pulls a command from the queue and executes its handler | 219 | // handler, pulls a command from the queue and executes its handler |
220 | // | 220 | // |
221 | main: | 221 | wait: |
222 | // sleep until we have something to do | 222 | // sleep until we have something to do |
223 | bset $flags $p0 | ||
224 | sleep $p0 | 223 | sleep $p0 |
224 | bset $flags $p0 | ||
225 | main: | ||
225 | mov $r13 #cmd_queue | 226 | mov $r13 #cmd_queue |
226 | call(queue_get) | 227 | call(queue_get) |
227 | bra $p1 #main | 228 | bra $p1 #wait |
228 | 229 | ||
229 | // context switch, requested by GPU? | 230 | // context switch, requested by GPU? |
230 | cmpu b32 $r14 0x4001 | 231 | cmpu b32 $r14 0x4001 |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h index 397921a9a46c..8015b40a61d6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h | |||
@@ -584,9 +584,10 @@ uint32_t gf100_grhub_code[] = { | |||
584 | 0x080007f1, | 584 | 0x080007f1, |
585 | 0xd00203f0, | 585 | 0xd00203f0, |
586 | 0x04bd0001, | 586 | 0x04bd0001, |
587 | /* 0x0564: main */ | 587 | /* 0x0564: wait */ |
588 | 0xf40031f4, | 588 | 0xf40028f4, |
589 | 0xd7f00028, | 589 | /* 0x056a: main */ |
590 | 0xd7f00031, | ||
590 | 0x3921f410, | 591 | 0x3921f410, |
591 | 0xb1f401f4, | 592 | 0xb1f401f4, |
592 | 0xf54001e4, | 593 | 0xf54001e4, |
@@ -650,7 +651,7 @@ uint32_t gf100_grhub_code[] = { | |||
650 | 0x170007f1, | 651 | 0x170007f1, |
651 | 0xd00203f0, | 652 | 0xd00203f0, |
652 | 0x04bd0009, | 653 | 0x04bd0009, |
653 | 0xff080ef5, | 654 | 0xff0e0ef5, |
654 | /* 0x0660: main_not_ctx_switch */ | 655 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 656 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 657 | 0xf2b90d1b, |
@@ -675,12 +676,12 @@ uint32_t gf100_grhub_code[] = { | |||
675 | 0xf501f5f0, | 676 | 0xf501f5f0, |
676 | 0xf5037e21, | 677 | 0xf5037e21, |
677 | /* 0x06b3: main_done */ | 678 | /* 0x06b3: main_done */ |
678 | 0xbdfeb50e, | 679 | 0xbdfebb0e, |
679 | 0x1f29f024, | 680 | 0x1f29f024, |
680 | 0x080007f1, | 681 | 0x080007f1, |
681 | 0xd00203f0, | 682 | 0xd00203f0, |
682 | 0x04bd0002, | 683 | 0x04bd0002, |
683 | 0xfea00ef5, | 684 | 0xfea60ef5, |
684 | /* 0x06c8: ih */ | 685 | /* 0x06c8: ih */ |
685 | 0x80f900f9, | 686 | 0x80f900f9, |
686 | 0xf90188fe, | 687 | 0xf90188fe, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h index 50c97163dcdb..2af90ec6852a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h | |||
@@ -584,9 +584,10 @@ uint32_t gf117_grhub_code[] = { | |||
584 | 0x080007f1, | 584 | 0x080007f1, |
585 | 0xd00203f0, | 585 | 0xd00203f0, |
586 | 0x04bd0001, | 586 | 0x04bd0001, |
587 | /* 0x0564: main */ | 587 | /* 0x0564: wait */ |
588 | 0xf40031f4, | 588 | 0xf40028f4, |
589 | 0xd7f00028, | 589 | /* 0x056a: main */ |
590 | 0xd7f00031, | ||
590 | 0x3921f410, | 591 | 0x3921f410, |
591 | 0xb1f401f4, | 592 | 0xb1f401f4, |
592 | 0xf54001e4, | 593 | 0xf54001e4, |
@@ -650,7 +651,7 @@ uint32_t gf117_grhub_code[] = { | |||
650 | 0x170007f1, | 651 | 0x170007f1, |
651 | 0xd00203f0, | 652 | 0xd00203f0, |
652 | 0x04bd0009, | 653 | 0x04bd0009, |
653 | 0xff080ef5, | 654 | 0xff0e0ef5, |
654 | /* 0x0660: main_not_ctx_switch */ | 655 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 656 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 657 | 0xf2b90d1b, |
@@ -675,12 +676,12 @@ uint32_t gf117_grhub_code[] = { | |||
675 | 0xf501f5f0, | 676 | 0xf501f5f0, |
676 | 0xf5037e21, | 677 | 0xf5037e21, |
677 | /* 0x06b3: main_done */ | 678 | /* 0x06b3: main_done */ |
678 | 0xbdfeb50e, | 679 | 0xbdfebb0e, |
679 | 0x1f29f024, | 680 | 0x1f29f024, |
680 | 0x080007f1, | 681 | 0x080007f1, |
681 | 0xd00203f0, | 682 | 0xd00203f0, |
682 | 0x04bd0002, | 683 | 0x04bd0002, |
683 | 0xfea00ef5, | 684 | 0xfea60ef5, |
684 | /* 0x06c8: ih */ | 685 | /* 0x06c8: ih */ |
685 | 0x80f900f9, | 686 | 0x80f900f9, |
686 | 0xf90188fe, | 687 | 0xf90188fe, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h index 125824b394bb..e8b8c1c94700 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h | |||
@@ -584,9 +584,10 @@ uint32_t gk104_grhub_code[] = { | |||
584 | 0x080007f1, | 584 | 0x080007f1, |
585 | 0xd00203f0, | 585 | 0xd00203f0, |
586 | 0x04bd0001, | 586 | 0x04bd0001, |
587 | /* 0x0564: main */ | 587 | /* 0x0564: wait */ |
588 | 0xf40031f4, | 588 | 0xf40028f4, |
589 | 0xd7f00028, | 589 | /* 0x056a: main */ |
590 | 0xd7f00031, | ||
590 | 0x3921f410, | 591 | 0x3921f410, |
591 | 0xb1f401f4, | 592 | 0xb1f401f4, |
592 | 0xf54001e4, | 593 | 0xf54001e4, |
@@ -650,7 +651,7 @@ uint32_t gk104_grhub_code[] = { | |||
650 | 0x170007f1, | 651 | 0x170007f1, |
651 | 0xd00203f0, | 652 | 0xd00203f0, |
652 | 0x04bd0009, | 653 | 0x04bd0009, |
653 | 0xff080ef5, | 654 | 0xff0e0ef5, |
654 | /* 0x0660: main_not_ctx_switch */ | 655 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 656 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 657 | 0xf2b90d1b, |
@@ -675,12 +676,12 @@ uint32_t gk104_grhub_code[] = { | |||
675 | 0xf501f5f0, | 676 | 0xf501f5f0, |
676 | 0xf5037e21, | 677 | 0xf5037e21, |
677 | /* 0x06b3: main_done */ | 678 | /* 0x06b3: main_done */ |
678 | 0xbdfeb50e, | 679 | 0xbdfebb0e, |
679 | 0x1f29f024, | 680 | 0x1f29f024, |
680 | 0x080007f1, | 681 | 0x080007f1, |
681 | 0xd00203f0, | 682 | 0xd00203f0, |
682 | 0x04bd0002, | 683 | 0x04bd0002, |
683 | 0xfea00ef5, | 684 | 0xfea60ef5, |
684 | /* 0x06c8: ih */ | 685 | /* 0x06c8: ih */ |
685 | 0x80f900f9, | 686 | 0x80f900f9, |
686 | 0xf90188fe, | 687 | 0xf90188fe, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h index 0a1b8c0b8b82..f4ed2fb6f714 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h | |||
@@ -584,9 +584,10 @@ uint32_t gk110_grhub_code[] = { | |||
584 | 0x300007f1, | 584 | 0x300007f1, |
585 | 0xd00203f0, | 585 | 0xd00203f0, |
586 | 0x04bd0001, | 586 | 0x04bd0001, |
587 | /* 0x0564: main */ | 587 | /* 0x0564: wait */ |
588 | 0xf40031f4, | 588 | 0xf40028f4, |
589 | 0xd7f00028, | 589 | /* 0x056a: main */ |
590 | 0xd7f00031, | ||
590 | 0x3921f410, | 591 | 0x3921f410, |
591 | 0xb1f401f4, | 592 | 0xb1f401f4, |
592 | 0xf54001e4, | 593 | 0xf54001e4, |
@@ -650,7 +651,7 @@ uint32_t gk110_grhub_code[] = { | |||
650 | 0x170007f1, | 651 | 0x170007f1, |
651 | 0xd00203f0, | 652 | 0xd00203f0, |
652 | 0x04bd0009, | 653 | 0x04bd0009, |
653 | 0xff080ef5, | 654 | 0xff0e0ef5, |
654 | /* 0x0660: main_not_ctx_switch */ | 655 | /* 0x0660: main_not_ctx_switch */ |
655 | 0xf401e4b0, | 656 | 0xf401e4b0, |
656 | 0xf2b90d1b, | 657 | 0xf2b90d1b, |
@@ -675,12 +676,12 @@ uint32_t gk110_grhub_code[] = { | |||
675 | 0xf501f5f0, | 676 | 0xf501f5f0, |
676 | 0xf5037e21, | 677 | 0xf5037e21, |
677 | /* 0x06b3: main_done */ | 678 | /* 0x06b3: main_done */ |
678 | 0xbdfeb50e, | 679 | 0xbdfebb0e, |
679 | 0x1f29f024, | 680 | 0x1f29f024, |
680 | 0x300007f1, | 681 | 0x300007f1, |
681 | 0xd00203f0, | 682 | 0xd00203f0, |
682 | 0x04bd0002, | 683 | 0x04bd0002, |
683 | 0xfea00ef5, | 684 | 0xfea60ef5, |
684 | /* 0x06c8: ih */ | 685 | /* 0x06c8: ih */ |
685 | 0x80f900f9, | 686 | 0x80f900f9, |
686 | 0xf90188fe, | 687 | 0xf90188fe, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h index 16869d0b109b..ed488973c117 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h | |||
@@ -531,9 +531,10 @@ uint32_t gk208_grhub_code[] = { | |||
531 | 0x1f19f014, | 531 | 0x1f19f014, |
532 | 0x02300080, | 532 | 0x02300080, |
533 | 0xbd0001f6, | 533 | 0xbd0001f6, |
534 | /* 0x0491: main */ | 534 | /* 0x0491: wait */ |
535 | 0x0031f404, | 535 | 0x0028f404, |
536 | 0x0d0028f4, | 536 | /* 0x0497: main */ |
537 | 0x0d0031f4, | ||
537 | 0x00377e10, | 538 | 0x00377e10, |
538 | 0xf401f400, | 539 | 0xf401f400, |
539 | 0x4001e4b1, | 540 | 0x4001e4b1, |
@@ -590,7 +591,7 @@ uint32_t gk208_grhub_code[] = { | |||
590 | 0x09f60217, | 591 | 0x09f60217, |
591 | 0xf504bd00, | 592 | 0xf504bd00, |
592 | /* 0x056b: main_not_ctx_switch */ | 593 | /* 0x056b: main_not_ctx_switch */ |
593 | 0xb0ff2a0e, | 594 | 0xb0ff300e, |
594 | 0x1bf401e4, | 595 | 0x1bf401e4, |
595 | 0x7ef2b20c, | 596 | 0x7ef2b20c, |
596 | 0xf4000820, | 597 | 0xf4000820, |
@@ -612,11 +613,11 @@ uint32_t gk208_grhub_code[] = { | |||
612 | 0x7e01f5f0, | 613 | 0x7e01f5f0, |
613 | 0xf50002f8, | 614 | 0xf50002f8, |
614 | /* 0x05b7: main_done */ | 615 | /* 0x05b7: main_done */ |
615 | 0xbdfede0e, | 616 | 0xbdfee40e, |
616 | 0x1f29f024, | 617 | 0x1f29f024, |
617 | 0x02300080, | 618 | 0x02300080, |
618 | 0xbd0002f6, | 619 | 0xbd0002f6, |
619 | 0xcc0ef504, | 620 | 0xd20ef504, |
620 | /* 0x05c9: ih */ | 621 | /* 0x05c9: ih */ |
621 | 0xf900f9fe, | 622 | 0xf900f9fe, |
622 | 0x0188fe80, | 623 | 0x0188fe80, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h index d6343d2a614c..5c9051839557 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h | |||
@@ -531,9 +531,10 @@ uint32_t gm107_grhub_code[] = { | |||
531 | 0x1f19f014, | 531 | 0x1f19f014, |
532 | 0x02300080, | 532 | 0x02300080, |
533 | 0xbd0001f6, | 533 | 0xbd0001f6, |
534 | /* 0x0491: main */ | 534 | /* 0x0491: wait */ |
535 | 0x0031f404, | 535 | 0x0028f404, |
536 | 0x0d0028f4, | 536 | /* 0x0497: main */ |
537 | 0x0d0031f4, | ||
537 | 0x00377e10, | 538 | 0x00377e10, |
538 | 0xf401f400, | 539 | 0xf401f400, |
539 | 0x4001e4b1, | 540 | 0x4001e4b1, |
@@ -590,7 +591,7 @@ uint32_t gm107_grhub_code[] = { | |||
590 | 0x09f60217, | 591 | 0x09f60217, |
591 | 0xf504bd00, | 592 | 0xf504bd00, |
592 | /* 0x056b: main_not_ctx_switch */ | 593 | /* 0x056b: main_not_ctx_switch */ |
593 | 0xb0ff2a0e, | 594 | 0xb0ff300e, |
594 | 0x1bf401e4, | 595 | 0x1bf401e4, |
595 | 0x7ef2b20c, | 596 | 0x7ef2b20c, |
596 | 0xf4000820, | 597 | 0xf4000820, |
@@ -612,11 +613,11 @@ uint32_t gm107_grhub_code[] = { | |||
612 | 0x7e01f5f0, | 613 | 0x7e01f5f0, |
613 | 0xf50002f8, | 614 | 0xf50002f8, |
614 | /* 0x05b7: main_done */ | 615 | /* 0x05b7: main_done */ |
615 | 0xbdfede0e, | 616 | 0xbdfee40e, |
616 | 0x1f29f024, | 617 | 0x1f29f024, |
617 | 0x02300080, | 618 | 0x02300080, |
618 | 0xbd0002f6, | 619 | 0xbd0002f6, |
619 | 0xcc0ef504, | 620 | 0xd20ef504, |
620 | /* 0x05c9: ih */ | 621 | /* 0x05c9: ih */ |
621 | 0xf900f9fe, | 622 | 0xf900f9fe, |
622 | 0x0188fe80, | 623 | 0x0188fe80, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c index b2de290da16f..9513badb8220 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | |||
@@ -702,6 +702,13 @@ gf100_gr_pack_mmio[] = { | |||
702 | * PGRAPH engine/subdev functions | 702 | * PGRAPH engine/subdev functions |
703 | ******************************************************************************/ | 703 | ******************************************************************************/ |
704 | 704 | ||
705 | int | ||
706 | gf100_gr_rops(struct gf100_gr *gr) | ||
707 | { | ||
708 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
709 | return (nvkm_rd32(device, 0x409604) & 0x001f0000) >> 16; | ||
710 | } | ||
711 | |||
705 | void | 712 | void |
706 | gf100_gr_zbc_init(struct gf100_gr *gr) | 713 | gf100_gr_zbc_init(struct gf100_gr *gr) |
707 | { | 714 | { |
@@ -1609,32 +1616,12 @@ gf100_gr_oneinit(struct nvkm_gr *base) | |||
1609 | { | 1616 | { |
1610 | struct gf100_gr *gr = gf100_gr(base); | 1617 | struct gf100_gr *gr = gf100_gr(base); |
1611 | struct nvkm_device *device = gr->base.engine.subdev.device; | 1618 | struct nvkm_device *device = gr->base.engine.subdev.device; |
1612 | int ret, i, j; | 1619 | int i, j; |
1613 | 1620 | ||
1614 | nvkm_pmu_pgob(device->pmu, false); | 1621 | nvkm_pmu_pgob(device->pmu, false); |
1615 | 1622 | ||
1616 | ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 256, false, | 1623 | gr->rop_nr = gr->func->rops(gr); |
1617 | &gr->unk4188b4); | 1624 | gr->gpc_nr = nvkm_rd32(device, 0x409604) & 0x0000001f; |
1618 | if (ret) | ||
1619 | return ret; | ||
1620 | |||
1621 | ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, 0x1000, 256, false, | ||
1622 | &gr->unk4188b8); | ||
1623 | if (ret) | ||
1624 | return ret; | ||
1625 | |||
1626 | nvkm_kmap(gr->unk4188b4); | ||
1627 | for (i = 0; i < 0x1000; i += 4) | ||
1628 | nvkm_wo32(gr->unk4188b4, i, 0x00000010); | ||
1629 | nvkm_done(gr->unk4188b4); | ||
1630 | |||
1631 | nvkm_kmap(gr->unk4188b8); | ||
1632 | for (i = 0; i < 0x1000; i += 4) | ||
1633 | nvkm_wo32(gr->unk4188b8, i, 0x00000010); | ||
1634 | nvkm_done(gr->unk4188b8); | ||
1635 | |||
1636 | gr->rop_nr = (nvkm_rd32(device, 0x409604) & 0x001f0000) >> 16; | ||
1637 | gr->gpc_nr = nvkm_rd32(device, 0x409604) & 0x0000001f; | ||
1638 | for (i = 0; i < gr->gpc_nr; i++) { | 1625 | for (i = 0; i < gr->gpc_nr; i++) { |
1639 | gr->tpc_nr[i] = nvkm_rd32(device, GPC_UNIT(i, 0x2608)); | 1626 | gr->tpc_nr[i] = nvkm_rd32(device, GPC_UNIT(i, 0x2608)); |
1640 | gr->tpc_total += gr->tpc_nr[i]; | 1627 | gr->tpc_total += gr->tpc_nr[i]; |
@@ -1651,38 +1638,38 @@ gf100_gr_oneinit(struct nvkm_gr *base) | |||
1651 | switch (device->chipset) { | 1638 | switch (device->chipset) { |
1652 | case 0xc0: | 1639 | case 0xc0: |
1653 | if (gr->tpc_total == 11) { /* 465, 3/4/4/0, 4 */ | 1640 | if (gr->tpc_total == 11) { /* 465, 3/4/4/0, 4 */ |
1654 | gr->magic_not_rop_nr = 0x07; | 1641 | gr->screen_tile_row_offset = 0x07; |
1655 | } else | 1642 | } else |
1656 | if (gr->tpc_total == 14) { /* 470, 3/3/4/4, 5 */ | 1643 | if (gr->tpc_total == 14) { /* 470, 3/3/4/4, 5 */ |
1657 | gr->magic_not_rop_nr = 0x05; | 1644 | gr->screen_tile_row_offset = 0x05; |
1658 | } else | 1645 | } else |
1659 | if (gr->tpc_total == 15) { /* 480, 3/4/4/4, 6 */ | 1646 | if (gr->tpc_total == 15) { /* 480, 3/4/4/4, 6 */ |
1660 | gr->magic_not_rop_nr = 0x06; | 1647 | gr->screen_tile_row_offset = 0x06; |
1661 | } | 1648 | } |
1662 | break; | 1649 | break; |
1663 | case 0xc3: /* 450, 4/0/0/0, 2 */ | 1650 | case 0xc3: /* 450, 4/0/0/0, 2 */ |
1664 | gr->magic_not_rop_nr = 0x03; | 1651 | gr->screen_tile_row_offset = 0x03; |
1665 | break; | 1652 | break; |
1666 | case 0xc4: /* 460, 3/4/0/0, 4 */ | 1653 | case 0xc4: /* 460, 3/4/0/0, 4 */ |
1667 | gr->magic_not_rop_nr = 0x01; | 1654 | gr->screen_tile_row_offset = 0x01; |
1668 | break; | 1655 | break; |
1669 | case 0xc1: /* 2/0/0/0, 1 */ | 1656 | case 0xc1: /* 2/0/0/0, 1 */ |
1670 | gr->magic_not_rop_nr = 0x01; | 1657 | gr->screen_tile_row_offset = 0x01; |
1671 | break; | 1658 | break; |
1672 | case 0xc8: /* 4/4/3/4, 5 */ | 1659 | case 0xc8: /* 4/4/3/4, 5 */ |
1673 | gr->magic_not_rop_nr = 0x06; | 1660 | gr->screen_tile_row_offset = 0x06; |
1674 | break; | 1661 | break; |
1675 | case 0xce: /* 4/4/0/0, 4 */ | 1662 | case 0xce: /* 4/4/0/0, 4 */ |
1676 | gr->magic_not_rop_nr = 0x03; | 1663 | gr->screen_tile_row_offset = 0x03; |
1677 | break; | 1664 | break; |
1678 | case 0xcf: /* 4/0/0/0, 3 */ | 1665 | case 0xcf: /* 4/0/0/0, 3 */ |
1679 | gr->magic_not_rop_nr = 0x03; | 1666 | gr->screen_tile_row_offset = 0x03; |
1680 | break; | 1667 | break; |
1681 | case 0xd7: | 1668 | case 0xd7: |
1682 | case 0xd9: /* 1/0/0/0, 1 */ | 1669 | case 0xd9: /* 1/0/0/0, 1 */ |
1683 | case 0xea: /* gk20a */ | 1670 | case 0xea: /* gk20a */ |
1684 | case 0x12b: /* gm20b */ | 1671 | case 0x12b: /* gm20b */ |
1685 | gr->magic_not_rop_nr = 0x01; | 1672 | gr->screen_tile_row_offset = 0x01; |
1686 | break; | 1673 | break; |
1687 | } | 1674 | } |
1688 | 1675 | ||
@@ -1729,8 +1716,6 @@ gf100_gr_dtor(struct nvkm_gr *base) | |||
1729 | gf100_gr_dtor_init(gr->fuc_sw_ctx); | 1716 | gf100_gr_dtor_init(gr->fuc_sw_ctx); |
1730 | gf100_gr_dtor_init(gr->fuc_sw_nonctx); | 1717 | gf100_gr_dtor_init(gr->fuc_sw_nonctx); |
1731 | 1718 | ||
1732 | nvkm_memory_del(&gr->unk4188b8); | ||
1733 | nvkm_memory_del(&gr->unk4188b4); | ||
1734 | return gr; | 1719 | return gr; |
1735 | } | 1720 | } |
1736 | 1721 | ||
@@ -1776,7 +1761,7 @@ gf100_gr_ctor(const struct gf100_gr_func *func, struct nvkm_device *device, | |||
1776 | gr->firmware = nvkm_boolopt(device->cfgopt, "NvGrUseFW", | 1761 | gr->firmware = nvkm_boolopt(device->cfgopt, "NvGrUseFW", |
1777 | func->fecs.ucode == NULL); | 1762 | func->fecs.ucode == NULL); |
1778 | 1763 | ||
1779 | ret = nvkm_gr_ctor(&gf100_gr_, device, index, 0x08001000, | 1764 | ret = nvkm_gr_ctor(&gf100_gr_, device, index, |
1780 | gr->firmware || func->fecs.ucode != NULL, | 1765 | gr->firmware || func->fecs.ucode != NULL, |
1781 | &gr->base); | 1766 | &gr->base); |
1782 | if (ret) | 1767 | if (ret) |
@@ -1815,6 +1800,7 @@ int | |||
1815 | gf100_gr_init(struct gf100_gr *gr) | 1800 | gf100_gr_init(struct gf100_gr *gr) |
1816 | { | 1801 | { |
1817 | struct nvkm_device *device = gr->base.engine.subdev.device; | 1802 | struct nvkm_device *device = gr->base.engine.subdev.device; |
1803 | struct nvkm_fb *fb = device->fb; | ||
1818 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); | 1804 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); |
1819 | u32 data[TPC_MAX / 8] = {}; | 1805 | u32 data[TPC_MAX / 8] = {}; |
1820 | u8 tpcnr[GPC_MAX]; | 1806 | u8 tpcnr[GPC_MAX]; |
@@ -1827,8 +1813,8 @@ gf100_gr_init(struct gf100_gr *gr) | |||
1827 | nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000); | 1813 | nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000); |
1828 | nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); | 1814 | nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); |
1829 | nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); | 1815 | nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); |
1830 | nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(gr->unk4188b4) >> 8); | 1816 | nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8); |
1831 | nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(gr->unk4188b8) >> 8); | 1817 | nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8); |
1832 | 1818 | ||
1833 | gf100_gr_mmio(gr, gr->func->mmio); | 1819 | gf100_gr_mmio(gr, gr->func->mmio); |
1834 | 1820 | ||
@@ -1851,9 +1837,9 @@ gf100_gr_init(struct gf100_gr *gr) | |||
1851 | 1837 | ||
1852 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 1838 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
1853 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), | 1839 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), |
1854 | gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); | 1840 | gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); |
1855 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | | 1841 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | |
1856 | gr->tpc_total); | 1842 | gr->tpc_total); |
1857 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); | 1843 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); |
1858 | } | 1844 | } |
1859 | 1845 | ||
@@ -1946,6 +1932,7 @@ gf100_gr = { | |||
1946 | .mmio = gf100_gr_pack_mmio, | 1932 | .mmio = gf100_gr_pack_mmio, |
1947 | .fecs.ucode = &gf100_gr_fecs_ucode, | 1933 | .fecs.ucode = &gf100_gr_fecs_ucode, |
1948 | .gpccs.ucode = &gf100_gr_gpccs_ucode, | 1934 | .gpccs.ucode = &gf100_gr_gpccs_ucode, |
1935 | .rops = gf100_gr_rops, | ||
1949 | .grctx = &gf100_grctx, | 1936 | .grctx = &gf100_grctx, |
1950 | .sclass = { | 1937 | .sclass = { |
1951 | { -1, -1, FERMI_TWOD_A }, | 1938 | { -1, -1, FERMI_TWOD_A }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h index f0c6acb0f8fd..2b98abdb9270 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h | |||
@@ -31,7 +31,8 @@ | |||
31 | #include <subdev/mmu.h> | 31 | #include <subdev/mmu.h> |
32 | 32 | ||
33 | #define GPC_MAX 32 | 33 | #define GPC_MAX 32 |
34 | #define TPC_MAX (GPC_MAX * 8) | 34 | #define TPC_MAX_PER_GPC 8 |
35 | #define TPC_MAX (GPC_MAX * TPC_MAX_PER_GPC) | ||
35 | 36 | ||
36 | #define ROP_BCAST(r) (0x408800 + (r)) | 37 | #define ROP_BCAST(r) (0x408800 + (r)) |
37 | #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r)) | 38 | #define ROP_UNIT(u, r) (0x410000 + (u) * 0x400 + (r)) |
@@ -100,15 +101,12 @@ struct gf100_gr { | |||
100 | u8 ppc_mask[GPC_MAX]; | 101 | u8 ppc_mask[GPC_MAX]; |
101 | u8 ppc_tpc_nr[GPC_MAX][4]; | 102 | u8 ppc_tpc_nr[GPC_MAX][4]; |
102 | 103 | ||
103 | struct nvkm_memory *unk4188b4; | ||
104 | struct nvkm_memory *unk4188b8; | ||
105 | |||
106 | struct gf100_gr_data mmio_data[4]; | 104 | struct gf100_gr_data mmio_data[4]; |
107 | struct gf100_gr_mmio mmio_list[4096/8]; | 105 | struct gf100_gr_mmio mmio_list[4096/8]; |
108 | u32 size; | 106 | u32 size; |
109 | u32 *data; | 107 | u32 *data; |
110 | 108 | ||
111 | u8 magic_not_rop_nr; | 109 | u8 screen_tile_row_offset; |
112 | }; | 110 | }; |
113 | 111 | ||
114 | int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *, | 112 | int gf100_gr_ctor(const struct gf100_gr_func *, struct nvkm_device *, |
@@ -121,6 +119,8 @@ struct gf100_gr_func { | |||
121 | void (*dtor)(struct gf100_gr *); | 119 | void (*dtor)(struct gf100_gr *); |
122 | int (*init)(struct gf100_gr *); | 120 | int (*init)(struct gf100_gr *); |
123 | void (*init_gpc_mmu)(struct gf100_gr *); | 121 | void (*init_gpc_mmu)(struct gf100_gr *); |
122 | void (*init_rop_active_fbps)(struct gf100_gr *); | ||
123 | void (*init_ppc_exceptions)(struct gf100_gr *); | ||
124 | void (*set_hww_esr_report_mask)(struct gf100_gr *); | 124 | void (*set_hww_esr_report_mask)(struct gf100_gr *); |
125 | const struct gf100_gr_pack *mmio; | 125 | const struct gf100_gr_pack *mmio; |
126 | struct { | 126 | struct { |
@@ -129,18 +129,23 @@ struct gf100_gr_func { | |||
129 | struct { | 129 | struct { |
130 | struct gf100_gr_ucode *ucode; | 130 | struct gf100_gr_ucode *ucode; |
131 | } gpccs; | 131 | } gpccs; |
132 | int (*rops)(struct gf100_gr *); | ||
132 | int ppc_nr; | 133 | int ppc_nr; |
133 | const struct gf100_grctx_func *grctx; | 134 | const struct gf100_grctx_func *grctx; |
134 | struct nvkm_sclass sclass[]; | 135 | struct nvkm_sclass sclass[]; |
135 | }; | 136 | }; |
136 | 137 | ||
137 | int gf100_gr_init(struct gf100_gr *); | 138 | int gf100_gr_init(struct gf100_gr *); |
139 | int gf100_gr_rops(struct gf100_gr *); | ||
138 | 140 | ||
139 | int gk104_gr_init(struct gf100_gr *); | 141 | int gk104_gr_init(struct gf100_gr *); |
142 | void gk104_gr_init_rop_active_fbps(struct gf100_gr *); | ||
143 | void gk104_gr_init_ppc_exceptions(struct gf100_gr *); | ||
140 | 144 | ||
141 | int gk20a_gr_init(struct gf100_gr *); | 145 | int gk20a_gr_init(struct gf100_gr *); |
142 | 146 | ||
143 | int gm200_gr_init(struct gf100_gr *); | 147 | int gm200_gr_init(struct gf100_gr *); |
148 | int gm200_gr_rops(struct gf100_gr *); | ||
144 | 149 | ||
145 | #define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object) | 150 | #define gf100_gr_chan(p) container_of((p), struct gf100_gr_chan, object) |
146 | 151 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf104.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf104.c index 8f253e0a22f4..d736dcd55ea2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf104.c | |||
@@ -118,6 +118,7 @@ gf104_gr = { | |||
118 | .mmio = gf104_gr_pack_mmio, | 118 | .mmio = gf104_gr_pack_mmio, |
119 | .fecs.ucode = &gf100_gr_fecs_ucode, | 119 | .fecs.ucode = &gf100_gr_fecs_ucode, |
120 | .gpccs.ucode = &gf100_gr_gpccs_ucode, | 120 | .gpccs.ucode = &gf100_gr_gpccs_ucode, |
121 | .rops = gf100_gr_rops, | ||
121 | .grctx = &gf104_grctx, | 122 | .grctx = &gf104_grctx, |
122 | .sclass = { | 123 | .sclass = { |
123 | { -1, -1, FERMI_TWOD_A }, | 124 | { -1, -1, FERMI_TWOD_A }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c index 815a5aafa245..2f0d24498427 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf108.c | |||
@@ -109,6 +109,7 @@ gf108_gr = { | |||
109 | .mmio = gf108_gr_pack_mmio, | 109 | .mmio = gf108_gr_pack_mmio, |
110 | .fecs.ucode = &gf100_gr_fecs_ucode, | 110 | .fecs.ucode = &gf100_gr_fecs_ucode, |
111 | .gpccs.ucode = &gf100_gr_gpccs_ucode, | 111 | .gpccs.ucode = &gf100_gr_gpccs_ucode, |
112 | .rops = gf100_gr_rops, | ||
112 | .grctx = &gf108_grctx, | 113 | .grctx = &gf108_grctx, |
113 | .sclass = { | 114 | .sclass = { |
114 | { -1, -1, FERMI_TWOD_A }, | 115 | { -1, -1, FERMI_TWOD_A }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf110.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf110.c index d081ee41fc14..d1d942eb86af 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf110.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf110.c | |||
@@ -90,6 +90,7 @@ gf110_gr = { | |||
90 | .mmio = gf110_gr_pack_mmio, | 90 | .mmio = gf110_gr_pack_mmio, |
91 | .fecs.ucode = &gf100_gr_fecs_ucode, | 91 | .fecs.ucode = &gf100_gr_fecs_ucode, |
92 | .gpccs.ucode = &gf100_gr_gpccs_ucode, | 92 | .gpccs.ucode = &gf100_gr_gpccs_ucode, |
93 | .rops = gf100_gr_rops, | ||
93 | .grctx = &gf110_grctx, | 94 | .grctx = &gf110_grctx, |
94 | .sclass = { | 95 | .sclass = { |
95 | { -1, -1, FERMI_TWOD_A }, | 96 | { -1, -1, FERMI_TWOD_A }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c index d8e8af4d3b30..70335f65c51e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf117.c | |||
@@ -126,6 +126,7 @@ gf117_gr = { | |||
126 | .mmio = gf117_gr_pack_mmio, | 126 | .mmio = gf117_gr_pack_mmio, |
127 | .fecs.ucode = &gf117_gr_fecs_ucode, | 127 | .fecs.ucode = &gf117_gr_fecs_ucode, |
128 | .gpccs.ucode = &gf117_gr_gpccs_ucode, | 128 | .gpccs.ucode = &gf117_gr_gpccs_ucode, |
129 | .rops = gf100_gr_rops, | ||
129 | .ppc_nr = 1, | 130 | .ppc_nr = 1, |
130 | .grctx = &gf117_grctx, | 131 | .grctx = &gf117_grctx, |
131 | .sclass = { | 132 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf119.c index 01faf9a73774..8d8e4cafe28f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf119.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gf119.c | |||
@@ -181,6 +181,7 @@ gf119_gr = { | |||
181 | .mmio = gf119_gr_pack_mmio, | 181 | .mmio = gf119_gr_pack_mmio, |
182 | .fecs.ucode = &gf100_gr_fecs_ucode, | 182 | .fecs.ucode = &gf100_gr_fecs_ucode, |
183 | .gpccs.ucode = &gf100_gr_gpccs_ucode, | 183 | .gpccs.ucode = &gf100_gr_gpccs_ucode, |
184 | .rops = gf100_gr_rops, | ||
184 | .grctx = &gf119_grctx, | 185 | .grctx = &gf119_grctx, |
185 | .sclass = { | 186 | .sclass = { |
186 | { -1, -1, FERMI_TWOD_A }, | 187 | { -1, -1, FERMI_TWOD_A }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk104.c index abf54928a1a4..ec22da6c99fc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk104.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include "gf100.h" | 24 | #include "gf100.h" |
25 | #include "ctxgf100.h" | 25 | #include "ctxgf100.h" |
26 | 26 | ||
27 | #include <subdev/fb.h> | ||
28 | |||
27 | #include <nvif/class.h> | 29 | #include <nvif/class.h> |
28 | 30 | ||
29 | /******************************************************************************* | 31 | /******************************************************************************* |
@@ -177,10 +179,35 @@ gk104_gr_pack_mmio[] = { | |||
177 | * PGRAPH engine/subdev functions | 179 | * PGRAPH engine/subdev functions |
178 | ******************************************************************************/ | 180 | ******************************************************************************/ |
179 | 181 | ||
182 | void | ||
183 | gk104_gr_init_rop_active_fbps(struct gf100_gr *gr) | ||
184 | { | ||
185 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
186 | const u32 fbp_count = nvkm_rd32(device, 0x120074); | ||
187 | nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ | ||
188 | nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ | ||
189 | } | ||
190 | |||
191 | void | ||
192 | gk104_gr_init_ppc_exceptions(struct gf100_gr *gr) | ||
193 | { | ||
194 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
195 | int gpc, ppc; | ||
196 | |||
197 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | ||
198 | for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++) { | ||
199 | if (!(gr->ppc_mask[gpc] & (1 << ppc))) | ||
200 | continue; | ||
201 | nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); | ||
202 | } | ||
203 | } | ||
204 | } | ||
205 | |||
180 | int | 206 | int |
181 | gk104_gr_init(struct gf100_gr *gr) | 207 | gk104_gr_init(struct gf100_gr *gr) |
182 | { | 208 | { |
183 | struct nvkm_device *device = gr->base.engine.subdev.device; | 209 | struct nvkm_device *device = gr->base.engine.subdev.device; |
210 | struct nvkm_fb *fb = device->fb; | ||
184 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); | 211 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); |
185 | u32 data[TPC_MAX / 8] = {}; | 212 | u32 data[TPC_MAX / 8] = {}; |
186 | u8 tpcnr[GPC_MAX]; | 213 | u8 tpcnr[GPC_MAX]; |
@@ -193,8 +220,8 @@ gk104_gr_init(struct gf100_gr *gr) | |||
193 | nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000); | 220 | nvkm_wr32(device, GPC_BCAST(0x088c), 0x00000000); |
194 | nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); | 221 | nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); |
195 | nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); | 222 | nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); |
196 | nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(gr->unk4188b4) >> 8); | 223 | nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8); |
197 | nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(gr->unk4188b8) >> 8); | 224 | nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8); |
198 | 225 | ||
199 | gf100_gr_mmio(gr, gr->func->mmio); | 226 | gf100_gr_mmio(gr, gr->func->mmio); |
200 | 227 | ||
@@ -218,15 +245,17 @@ gk104_gr_init(struct gf100_gr *gr) | |||
218 | 245 | ||
219 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 246 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
220 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), | 247 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), |
221 | gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); | 248 | gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); |
222 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | | 249 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | |
223 | gr->tpc_total); | 250 | gr->tpc_total); |
224 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); | 251 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); |
225 | } | 252 | } |
226 | 253 | ||
227 | nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); | 254 | nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); |
228 | nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); | 255 | nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); |
229 | 256 | ||
257 | gr->func->init_rop_active_fbps(gr); | ||
258 | |||
230 | nvkm_wr32(device, 0x400500, 0x00010001); | 259 | nvkm_wr32(device, 0x400500, 0x00010001); |
231 | 260 | ||
232 | nvkm_wr32(device, 0x400100, 0xffffffff); | 261 | nvkm_wr32(device, 0x400100, 0xffffffff); |
@@ -246,8 +275,9 @@ gk104_gr_init(struct gf100_gr *gr) | |||
246 | nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); | 275 | nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); |
247 | nvkm_mask(device, 0x419eb4, 0x00001000, 0x00001000); | 276 | nvkm_mask(device, 0x419eb4, 0x00001000, 0x00001000); |
248 | 277 | ||
278 | gr->func->init_ppc_exceptions(gr); | ||
279 | |||
249 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 280 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
250 | nvkm_wr32(device, GPC_UNIT(gpc, 0x3038), 0xc0000000); | ||
251 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); | 281 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); |
252 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); | 282 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); |
253 | nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); | 283 | nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); |
@@ -309,9 +339,12 @@ gk104_gr_gpccs_ucode = { | |||
309 | static const struct gf100_gr_func | 339 | static const struct gf100_gr_func |
310 | gk104_gr = { | 340 | gk104_gr = { |
311 | .init = gk104_gr_init, | 341 | .init = gk104_gr_init, |
342 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
343 | .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, | ||
312 | .mmio = gk104_gr_pack_mmio, | 344 | .mmio = gk104_gr_pack_mmio, |
313 | .fecs.ucode = &gk104_gr_fecs_ucode, | 345 | .fecs.ucode = &gk104_gr_fecs_ucode, |
314 | .gpccs.ucode = &gk104_gr_gpccs_ucode, | 346 | .gpccs.ucode = &gk104_gr_gpccs_ucode, |
347 | .rops = gf100_gr_rops, | ||
315 | .ppc_nr = 1, | 348 | .ppc_nr = 1, |
316 | .grctx = &gk104_grctx, | 349 | .grctx = &gk104_grctx, |
317 | .sclass = { | 350 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110.c index 32aa2946e7b7..f31b171a4102 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110.c | |||
@@ -183,9 +183,12 @@ gk110_gr_gpccs_ucode = { | |||
183 | static const struct gf100_gr_func | 183 | static const struct gf100_gr_func |
184 | gk110_gr = { | 184 | gk110_gr = { |
185 | .init = gk104_gr_init, | 185 | .init = gk104_gr_init, |
186 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
187 | .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, | ||
186 | .mmio = gk110_gr_pack_mmio, | 188 | .mmio = gk110_gr_pack_mmio, |
187 | .fecs.ucode = &gk110_gr_fecs_ucode, | 189 | .fecs.ucode = &gk110_gr_fecs_ucode, |
188 | .gpccs.ucode = &gk110_gr_gpccs_ucode, | 190 | .gpccs.ucode = &gk110_gr_gpccs_ucode, |
191 | .rops = gf100_gr_rops, | ||
189 | .ppc_nr = 2, | 192 | .ppc_nr = 2, |
190 | .grctx = &gk110_grctx, | 193 | .grctx = &gk110_grctx, |
191 | .sclass = { | 194 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110b.c index 22f88afbf35f..d76dd178007f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110b.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk110b.c | |||
@@ -103,9 +103,12 @@ gk110b_gr_pack_mmio[] = { | |||
103 | static const struct gf100_gr_func | 103 | static const struct gf100_gr_func |
104 | gk110b_gr = { | 104 | gk110b_gr = { |
105 | .init = gk104_gr_init, | 105 | .init = gk104_gr_init, |
106 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
107 | .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, | ||
106 | .mmio = gk110b_gr_pack_mmio, | 108 | .mmio = gk110b_gr_pack_mmio, |
107 | .fecs.ucode = &gk110_gr_fecs_ucode, | 109 | .fecs.ucode = &gk110_gr_fecs_ucode, |
108 | .gpccs.ucode = &gk110_gr_gpccs_ucode, | 110 | .gpccs.ucode = &gk110_gr_gpccs_ucode, |
111 | .rops = gf100_gr_rops, | ||
109 | .ppc_nr = 2, | 112 | .ppc_nr = 2, |
110 | .grctx = &gk110b_grctx, | 113 | .grctx = &gk110b_grctx, |
111 | .sclass = { | 114 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk208.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk208.c index ee7554fc87dc..14bbe6ed02a9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk208.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk208.c | |||
@@ -162,9 +162,12 @@ gk208_gr_gpccs_ucode = { | |||
162 | static const struct gf100_gr_func | 162 | static const struct gf100_gr_func |
163 | gk208_gr = { | 163 | gk208_gr = { |
164 | .init = gk104_gr_init, | 164 | .init = gk104_gr_init, |
165 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
166 | .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, | ||
165 | .mmio = gk208_gr_pack_mmio, | 167 | .mmio = gk208_gr_pack_mmio, |
166 | .fecs.ucode = &gk208_gr_fecs_ucode, | 168 | .fecs.ucode = &gk208_gr_fecs_ucode, |
167 | .gpccs.ucode = &gk208_gr_gpccs_ucode, | 169 | .gpccs.ucode = &gk208_gr_gpccs_ucode, |
170 | .rops = gf100_gr_rops, | ||
168 | .ppc_nr = 1, | 171 | .ppc_nr = 1, |
169 | .grctx = &gk208_grctx, | 172 | .grctx = &gk208_grctx, |
170 | .sclass = { | 173 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c index 7ffb8a626196..4ca8ed15191c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gk20a.c | |||
@@ -239,9 +239,6 @@ gk20a_gr_init(struct gf100_gr *gr) | |||
239 | return ret; | 239 | return ret; |
240 | 240 | ||
241 | /* MMU debug buffer */ | 241 | /* MMU debug buffer */ |
242 | nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(gr->unk4188b4) >> 8); | ||
243 | nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(gr->unk4188b8) >> 8); | ||
244 | |||
245 | if (gr->func->init_gpc_mmu) | 242 | if (gr->func->init_gpc_mmu) |
246 | gr->func->init_gpc_mmu(gr); | 243 | gr->func->init_gpc_mmu(gr); |
247 | 244 | ||
@@ -267,7 +264,7 @@ gk20a_gr_init(struct gf100_gr *gr) | |||
267 | 264 | ||
268 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 265 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
269 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), | 266 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), |
270 | gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); | 267 | gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); |
271 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | | 268 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | |
272 | gr->tpc_total); | 269 | gr->tpc_total); |
273 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); | 270 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); |
@@ -275,6 +272,8 @@ gk20a_gr_init(struct gf100_gr *gr) | |||
275 | 272 | ||
276 | nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); | 273 | nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); |
277 | 274 | ||
275 | gr->func->init_rop_active_fbps(gr); | ||
276 | |||
278 | /* Enable FIFO access */ | 277 | /* Enable FIFO access */ |
279 | nvkm_wr32(device, 0x400500, 0x00010001); | 278 | nvkm_wr32(device, 0x400500, 0x00010001); |
280 | 279 | ||
@@ -312,7 +311,9 @@ gk20a_gr_init(struct gf100_gr *gr) | |||
312 | static const struct gf100_gr_func | 311 | static const struct gf100_gr_func |
313 | gk20a_gr = { | 312 | gk20a_gr = { |
314 | .init = gk20a_gr_init, | 313 | .init = gk20a_gr_init, |
314 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
315 | .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask, | 315 | .set_hww_esr_report_mask = gk20a_gr_set_hww_esr_report_mask, |
316 | .rops = gf100_gr_rops, | ||
316 | .ppc_nr = 1, | 317 | .ppc_nr = 1, |
317 | .grctx = &gk20a_grctx, | 318 | .grctx = &gk20a_grctx, |
318 | .sclass = { | 319 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c index 56e960212e5d..45f965f608a7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm107.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include <subdev/bios.h> | 27 | #include <subdev/bios.h> |
28 | #include <subdev/bios/P0260.h> | 28 | #include <subdev/bios/P0260.h> |
29 | #include <subdev/fb.h> | ||
29 | 30 | ||
30 | #include <nvif/class.h> | 31 | #include <nvif/class.h> |
31 | 32 | ||
@@ -311,17 +312,18 @@ int | |||
311 | gm107_gr_init(struct gf100_gr *gr) | 312 | gm107_gr_init(struct gf100_gr *gr) |
312 | { | 313 | { |
313 | struct nvkm_device *device = gr->base.engine.subdev.device; | 314 | struct nvkm_device *device = gr->base.engine.subdev.device; |
315 | struct nvkm_fb *fb = device->fb; | ||
314 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); | 316 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); |
315 | u32 data[TPC_MAX / 8] = {}; | 317 | u32 data[TPC_MAX / 8] = {}; |
316 | u8 tpcnr[GPC_MAX]; | 318 | u8 tpcnr[GPC_MAX]; |
317 | int gpc, tpc, ppc, rop; | 319 | int gpc, tpc, rop; |
318 | int i; | 320 | int i; |
319 | 321 | ||
320 | nvkm_wr32(device, GPC_BCAST(0x0880), 0x00000000); | 322 | nvkm_wr32(device, GPC_BCAST(0x0880), 0x00000000); |
321 | nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); | 323 | nvkm_wr32(device, GPC_BCAST(0x0890), 0x00000000); |
322 | nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); | 324 | nvkm_wr32(device, GPC_BCAST(0x0894), 0x00000000); |
323 | nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(gr->unk4188b4) >> 8); | 325 | nvkm_wr32(device, GPC_BCAST(0x08b4), nvkm_memory_addr(fb->mmu_wr) >> 8); |
324 | nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(gr->unk4188b8) >> 8); | 326 | nvkm_wr32(device, GPC_BCAST(0x08b8), nvkm_memory_addr(fb->mmu_rd) >> 8); |
325 | 327 | ||
326 | gf100_gr_mmio(gr, gr->func->mmio); | 328 | gf100_gr_mmio(gr, gr->func->mmio); |
327 | 329 | ||
@@ -347,15 +349,17 @@ gm107_gr_init(struct gf100_gr *gr) | |||
347 | 349 | ||
348 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 350 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
349 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), | 351 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), |
350 | gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); | 352 | gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); |
351 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | | 353 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | |
352 | gr->tpc_total); | 354 | gr->tpc_total); |
353 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); | 355 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); |
354 | } | 356 | } |
355 | 357 | ||
356 | nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); | 358 | nvkm_wr32(device, GPC_BCAST(0x3fd4), magicgpc918); |
357 | nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); | 359 | nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); |
358 | 360 | ||
361 | gr->func->init_rop_active_fbps(gr); | ||
362 | |||
359 | nvkm_wr32(device, 0x400500, 0x00010001); | 363 | nvkm_wr32(device, 0x400500, 0x00010001); |
360 | 364 | ||
361 | nvkm_wr32(device, 0x400100, 0xffffffff); | 365 | nvkm_wr32(device, 0x400100, 0xffffffff); |
@@ -373,9 +377,9 @@ gm107_gr_init(struct gf100_gr *gr) | |||
373 | nvkm_wr32(device, 0x405844, 0x00ffffff); | 377 | nvkm_wr32(device, 0x405844, 0x00ffffff); |
374 | nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); | 378 | nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); |
375 | 379 | ||
380 | gr->func->init_ppc_exceptions(gr); | ||
381 | |||
376 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 382 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
377 | for (ppc = 0; ppc < 2 /* gr->ppc_nr[gpc] */; ppc++) | ||
378 | nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); | ||
379 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); | 383 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); |
380 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); | 384 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); |
381 | nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); | 385 | nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); |
@@ -438,9 +442,12 @@ gm107_gr_gpccs_ucode = { | |||
438 | static const struct gf100_gr_func | 442 | static const struct gf100_gr_func |
439 | gm107_gr = { | 443 | gm107_gr = { |
440 | .init = gm107_gr_init, | 444 | .init = gm107_gr_init, |
445 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
446 | .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, | ||
441 | .mmio = gm107_gr_pack_mmio, | 447 | .mmio = gm107_gr_pack_mmio, |
442 | .fecs.ucode = &gm107_gr_fecs_ucode, | 448 | .fecs.ucode = &gm107_gr_fecs_ucode, |
443 | .gpccs.ucode = &gm107_gr_gpccs_ucode, | 449 | .gpccs.ucode = &gm107_gr_gpccs_ucode, |
450 | .rops = gf100_gr_rops, | ||
444 | .ppc_nr = 2, | 451 | .ppc_nr = 2, |
445 | .grctx = &gm107_grctx, | 452 | .grctx = &gm107_grctx, |
446 | .sclass = { | 453 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c index 058fc1d22c09..4dfa4513bb6c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm200.c | |||
@@ -33,27 +33,45 @@ | |||
33 | ******************************************************************************/ | 33 | ******************************************************************************/ |
34 | 34 | ||
35 | int | 35 | int |
36 | gm200_gr_rops(struct gf100_gr *gr) | ||
37 | { | ||
38 | return nvkm_rd32(gr->base.engine.subdev.device, 0x12006c); | ||
39 | } | ||
40 | |||
41 | static void | ||
42 | gm200_gr_init_gpc_mmu(struct gf100_gr *gr) | ||
43 | { | ||
44 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
45 | |||
46 | nvkm_wr32(device, 0x418880, nvkm_rd32(device, 0x100c80) & 0xf0001fff); | ||
47 | nvkm_wr32(device, 0x418890, 0x00000000); | ||
48 | nvkm_wr32(device, 0x418894, 0x00000000); | ||
49 | |||
50 | nvkm_wr32(device, 0x4188b4, nvkm_rd32(device, 0x100cc8)); | ||
51 | nvkm_wr32(device, 0x4188b8, nvkm_rd32(device, 0x100ccc)); | ||
52 | nvkm_wr32(device, 0x4188b0, nvkm_rd32(device, 0x100cc4)); | ||
53 | } | ||
54 | |||
55 | static void | ||
56 | gm200_gr_init_rop_active_fbps(struct gf100_gr *gr) | ||
57 | { | ||
58 | struct nvkm_device *device = gr->base.engine.subdev.device; | ||
59 | const u32 fbp_count = nvkm_rd32(device, 0x12006c); | ||
60 | nvkm_mask(device, 0x408850, 0x0000000f, fbp_count); /* zrop */ | ||
61 | nvkm_mask(device, 0x408958, 0x0000000f, fbp_count); /* crop */ | ||
62 | } | ||
63 | |||
64 | int | ||
36 | gm200_gr_init(struct gf100_gr *gr) | 65 | gm200_gr_init(struct gf100_gr *gr) |
37 | { | 66 | { |
38 | struct nvkm_device *device = gr->base.engine.subdev.device; | 67 | struct nvkm_device *device = gr->base.engine.subdev.device; |
39 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); | 68 | const u32 magicgpc918 = DIV_ROUND_UP(0x00800000, gr->tpc_total); |
40 | u32 data[TPC_MAX / 8] = {}, tmp; | 69 | u32 data[TPC_MAX / 8] = {}; |
41 | u8 tpcnr[GPC_MAX]; | 70 | u8 tpcnr[GPC_MAX]; |
42 | int gpc, tpc, ppc, rop; | 71 | int gpc, tpc, rop; |
43 | int i; | 72 | int i; |
44 | 73 | ||
45 | tmp = nvkm_rd32(device, 0x100c80); /*XXX: mask? */ | 74 | gr->func->init_gpc_mmu(gr); |
46 | nvkm_wr32(device, 0x418880, 0x00001000 | (tmp & 0x00000fff)); | ||
47 | nvkm_wr32(device, 0x418890, 0x00000000); | ||
48 | nvkm_wr32(device, 0x418894, 0x00000000); | ||
49 | nvkm_wr32(device, 0x4188b4, nvkm_memory_addr(gr->unk4188b4) >> 8); | ||
50 | nvkm_wr32(device, 0x4188b8, nvkm_memory_addr(gr->unk4188b8) >> 8); | ||
51 | nvkm_mask(device, 0x4188b0, 0x00040000, 0x00040000); | ||
52 | |||
53 | /*XXX: belongs in fb */ | ||
54 | nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(gr->unk4188b4) >> 8); | ||
55 | nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(gr->unk4188b8) >> 8); | ||
56 | nvkm_mask(device, 0x100cc4, 0x00040000, 0x00040000); | ||
57 | 75 | ||
58 | gf100_gr_mmio(gr, gr->fuc_sw_nonctx); | 76 | gf100_gr_mmio(gr, gr->fuc_sw_nonctx); |
59 | 77 | ||
@@ -79,9 +97,9 @@ gm200_gr_init(struct gf100_gr *gr) | |||
79 | 97 | ||
80 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 98 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
81 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), | 99 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0914), |
82 | gr->magic_not_rop_nr << 8 | gr->tpc_nr[gpc]); | 100 | gr->screen_tile_row_offset << 8 | gr->tpc_nr[gpc]); |
83 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | | 101 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0910), 0x00040000 | |
84 | gr->tpc_total); | 102 | gr->tpc_total); |
85 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); | 103 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0918), magicgpc918); |
86 | } | 104 | } |
87 | 105 | ||
@@ -89,6 +107,8 @@ gm200_gr_init(struct gf100_gr *gr) | |||
89 | nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); | 107 | nvkm_wr32(device, GPC_BCAST(0x08ac), nvkm_rd32(device, 0x100800)); |
90 | nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804)); | 108 | nvkm_wr32(device, GPC_BCAST(0x033c), nvkm_rd32(device, 0x100804)); |
91 | 109 | ||
110 | gr->func->init_rop_active_fbps(gr); | ||
111 | |||
92 | nvkm_wr32(device, 0x400500, 0x00010001); | 112 | nvkm_wr32(device, 0x400500, 0x00010001); |
93 | nvkm_wr32(device, 0x400100, 0xffffffff); | 113 | nvkm_wr32(device, 0x400100, 0xffffffff); |
94 | nvkm_wr32(device, 0x40013c, 0xffffffff); | 114 | nvkm_wr32(device, 0x40013c, 0xffffffff); |
@@ -106,9 +126,9 @@ gm200_gr_init(struct gf100_gr *gr) | |||
106 | nvkm_wr32(device, 0x405844, 0x00ffffff); | 126 | nvkm_wr32(device, 0x405844, 0x00ffffff); |
107 | nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); | 127 | nvkm_mask(device, 0x419cc0, 0x00000008, 0x00000008); |
108 | 128 | ||
129 | gr->func->init_ppc_exceptions(gr); | ||
130 | |||
109 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { | 131 | for (gpc = 0; gpc < gr->gpc_nr; gpc++) { |
110 | for (ppc = 0; ppc < gr->ppc_nr[gpc]; ppc++) | ||
111 | nvkm_wr32(device, PPC_UNIT(gpc, ppc, 0x038), 0xc0000000); | ||
112 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); | 132 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0420), 0xc0000000); |
113 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); | 133 | nvkm_wr32(device, GPC_UNIT(gpc, 0x0900), 0xc0000000); |
114 | nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); | 134 | nvkm_wr32(device, GPC_UNIT(gpc, 0x1028), 0xc0000000); |
@@ -189,6 +209,10 @@ gm200_gr_new_(const struct gf100_gr_func *func, struct nvkm_device *device, | |||
189 | static const struct gf100_gr_func | 209 | static const struct gf100_gr_func |
190 | gm200_gr = { | 210 | gm200_gr = { |
191 | .init = gm200_gr_init, | 211 | .init = gm200_gr_init, |
212 | .init_gpc_mmu = gm200_gr_init_gpc_mmu, | ||
213 | .init_rop_active_fbps = gm200_gr_init_rop_active_fbps, | ||
214 | .init_ppc_exceptions = gk104_gr_init_ppc_exceptions, | ||
215 | .rops = gm200_gr_rops, | ||
192 | .ppc_nr = 2, | 216 | .ppc_nr = 2, |
193 | .grctx = &gm200_grctx, | 217 | .grctx = &gm200_grctx, |
194 | .sclass = { | 218 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c index 29732bc14415..69479af1d829 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/gm20b.c | |||
@@ -42,7 +42,7 @@ gm20b_gr_init_gpc_mmu(struct gf100_gr *gr) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | val = nvkm_rd32(device, 0x100c80); | 44 | val = nvkm_rd32(device, 0x100c80); |
45 | val &= 0xf000087f; | 45 | val &= 0xf000187f; |
46 | nvkm_wr32(device, 0x418880, val); | 46 | nvkm_wr32(device, 0x418880, val); |
47 | nvkm_wr32(device, 0x418890, 0); | 47 | nvkm_wr32(device, 0x418890, 0); |
48 | nvkm_wr32(device, 0x418894, 0); | 48 | nvkm_wr32(device, 0x418894, 0); |
@@ -66,7 +66,9 @@ static const struct gf100_gr_func | |||
66 | gm20b_gr = { | 66 | gm20b_gr = { |
67 | .init = gk20a_gr_init, | 67 | .init = gk20a_gr_init, |
68 | .init_gpc_mmu = gm20b_gr_init_gpc_mmu, | 68 | .init_gpc_mmu = gm20b_gr_init_gpc_mmu, |
69 | .init_rop_active_fbps = gk104_gr_init_rop_active_fbps, | ||
69 | .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask, | 70 | .set_hww_esr_report_mask = gm20b_gr_set_hww_esr_report_mask, |
71 | .rops = gm200_gr_rops, | ||
70 | .ppc_nr = 1, | 72 | .ppc_nr = 1, |
71 | .grctx = &gm20b_grctx, | 73 | .grctx = &gm20b_grctx, |
72 | .sclass = { | 74 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c index 85c5b7fea5f5..9c2e985dc079 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c | |||
@@ -1422,6 +1422,5 @@ nv04_gr_new(struct nvkm_device *device, int index, struct nvkm_gr **pgr) | |||
1422 | spin_lock_init(&gr->lock); | 1422 | spin_lock_init(&gr->lock); |
1423 | *pgr = &gr->base; | 1423 | *pgr = &gr->base; |
1424 | 1424 | ||
1425 | return nvkm_gr_ctor(&nv04_gr, device, index, 0x00001000, | 1425 | return nvkm_gr_ctor(&nv04_gr, device, index, true, &gr->base); |
1426 | true, &gr->base); | ||
1427 | } | 1426 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c index 4542867fa9e6..4ebbfbdd8240 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c | |||
@@ -1182,7 +1182,7 @@ nv10_gr_new_(const struct nvkm_gr_func *func, struct nvkm_device *device, | |||
1182 | spin_lock_init(&gr->lock); | 1182 | spin_lock_init(&gr->lock); |
1183 | *pgr = &gr->base; | 1183 | *pgr = &gr->base; |
1184 | 1184 | ||
1185 | return nvkm_gr_ctor(func, device, index, 0x00001000, true, &gr->base); | 1185 | return nvkm_gr_ctor(func, device, index, true, &gr->base); |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | static const struct nvkm_gr_func | 1188 | static const struct nvkm_gr_func |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c index 5caef65d3c6e..d1dc92999dc0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c | |||
@@ -337,7 +337,7 @@ nv20_gr_new_(const struct nvkm_gr_func *func, struct nvkm_device *device, | |||
337 | return -ENOMEM; | 337 | return -ENOMEM; |
338 | *pgr = &gr->base; | 338 | *pgr = &gr->base; |
339 | 339 | ||
340 | return nvkm_gr_ctor(func, device, index, 0x00001000, true, &gr->base); | 340 | return nvkm_gr_ctor(func, device, index, true, &gr->base); |
341 | } | 341 | } |
342 | 342 | ||
343 | static const struct nvkm_gr_func | 343 | static const struct nvkm_gr_func |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c index 05a895496fc6..5f1ad8344ea9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c | |||
@@ -438,7 +438,7 @@ nv40_gr_new_(const struct nvkm_gr_func *func, struct nvkm_device *device, | |||
438 | *pgr = &gr->base; | 438 | *pgr = &gr->base; |
439 | INIT_LIST_HEAD(&gr->chan); | 439 | INIT_LIST_HEAD(&gr->chan); |
440 | 440 | ||
441 | return nvkm_gr_ctor(func, device, index, 0x00001000, true, &gr->base); | 441 | return nvkm_gr_ctor(func, device, index, true, &gr->base); |
442 | } | 442 | } |
443 | 443 | ||
444 | static const struct nvkm_gr_func | 444 | static const struct nvkm_gr_func |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c index b19b912d5787..fca67de43f2b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c | |||
@@ -768,7 +768,7 @@ nv50_gr_new_(const struct nvkm_gr_func *func, struct nvkm_device *device, | |||
768 | spin_lock_init(&gr->lock); | 768 | spin_lock_init(&gr->lock); |
769 | *pgr = &gr->base; | 769 | *pgr = &gr->base; |
770 | 770 | ||
771 | return nvkm_gr_ctor(func, device, index, 0x00201000, true, &gr->base); | 771 | return nvkm_gr_ctor(func, device, index, true, &gr->base); |
772 | } | 772 | } |
773 | 773 | ||
774 | static const struct nvkm_gr_func | 774 | static const struct nvkm_gr_func |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h b/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h index a234590be88e..d8adcdf6985a 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h | |||
@@ -7,8 +7,7 @@ struct nvkm_fb_tile; | |||
7 | struct nvkm_fifo_chan; | 7 | struct nvkm_fifo_chan; |
8 | 8 | ||
9 | int nvkm_gr_ctor(const struct nvkm_gr_func *, struct nvkm_device *, | 9 | int nvkm_gr_ctor(const struct nvkm_gr_func *, struct nvkm_device *, |
10 | int index, u32 pmc_enable, bool enable, | 10 | int index, bool enable, struct nvkm_gr *); |
11 | struct nvkm_gr *); | ||
12 | 11 | ||
13 | bool nv04_gr_idle(struct nvkm_gr *); | 12 | bool nv04_gr_idle(struct nvkm_gr *); |
14 | 13 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/g84.c b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/g84.c index 34ff0014a6c1..c0e11a071843 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/g84.c | |||
@@ -39,6 +39,5 @@ g84_mpeg = { | |||
39 | int | 39 | int |
40 | g84_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) | 40 | g84_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) |
41 | { | 41 | { |
42 | return nvkm_engine_new_(&g84_mpeg, device, index, 0x00000002, | 42 | return nvkm_engine_new_(&g84_mpeg, device, index, true, pmpeg); |
43 | true, pmpeg); | ||
44 | } | 43 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c index d4d8942b1347..003ac915eaad 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c | |||
@@ -278,7 +278,7 @@ nv31_mpeg_new_(const struct nv31_mpeg_func *func, struct nvkm_device *device, | |||
278 | mpeg->func = func; | 278 | mpeg->func = func; |
279 | *pmpeg = &mpeg->engine; | 279 | *pmpeg = &mpeg->engine; |
280 | 280 | ||
281 | return nvkm_engine_ctor(&nv31_mpeg_, device, index, 0x00000002, | 281 | return nvkm_engine_ctor(&nv31_mpeg_, device, index, |
282 | true, &mpeg->engine); | 282 | true, &mpeg->engine); |
283 | } | 283 | } |
284 | 284 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c index d433cfa4a8ab..e536f37e24b0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c | |||
@@ -212,6 +212,5 @@ nv44_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) | |||
212 | INIT_LIST_HEAD(&mpeg->chan); | 212 | INIT_LIST_HEAD(&mpeg->chan); |
213 | *pmpeg = &mpeg->engine; | 213 | *pmpeg = &mpeg->engine; |
214 | 214 | ||
215 | return nvkm_engine_ctor(&nv44_mpeg, device, index, 0x00000002, | 215 | return nvkm_engine_ctor(&nv44_mpeg, device, index, true, &mpeg->engine); |
216 | true, &mpeg->engine); | ||
217 | } | 216 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv50.c index c3a85dffc782..4e528851e9c0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv50.c | |||
@@ -130,6 +130,5 @@ nv50_mpeg = { | |||
130 | int | 130 | int |
131 | nv50_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) | 131 | nv50_mpeg_new(struct nvkm_device *device, int index, struct nvkm_engine **pmpeg) |
132 | { | 132 | { |
133 | return nvkm_engine_new_(&nv50_mpeg, device, index, 0x00400002, | 133 | return nvkm_engine_new_(&nv50_mpeg, device, index, true, pmpeg); |
134 | true, pmpeg); | ||
135 | } | 134 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c index 1f1a99e927b2..f30cf1dcfb30 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/g98.c | |||
@@ -35,7 +35,6 @@ g98_mspdec_init(struct nvkm_falcon *mspdec) | |||
35 | 35 | ||
36 | static const struct nvkm_falcon_func | 36 | static const struct nvkm_falcon_func |
37 | g98_mspdec = { | 37 | g98_mspdec = { |
38 | .pmc_enable = 0x01020000, | ||
39 | .init = g98_mspdec_init, | 38 | .init = g98_mspdec_init, |
40 | .sclass = { | 39 | .sclass = { |
41 | { -1, -1, G98_MSPDEC }, | 40 | { -1, -1, G98_MSPDEC }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c index 371fd6c3c663..cfe1aa81bd14 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gf100.c | |||
@@ -35,7 +35,6 @@ gf100_mspdec_init(struct nvkm_falcon *mspdec) | |||
35 | 35 | ||
36 | static const struct nvkm_falcon_func | 36 | static const struct nvkm_falcon_func |
37 | gf100_mspdec = { | 37 | gf100_mspdec = { |
38 | .pmc_enable = 0x00020000, | ||
39 | .init = gf100_mspdec_init, | 38 | .init = gf100_mspdec_init, |
40 | .sclass = { | 39 | .sclass = { |
41 | { -1, -1, GF100_MSPDEC }, | 40 | { -1, -1, GF100_MSPDEC }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c index de804a15bfd4..24272b4927bc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gk104.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_falcon_func | 28 | static const struct nvkm_falcon_func |
29 | gk104_mspdec = { | 29 | gk104_mspdec = { |
30 | .pmc_enable = 0x00020000, | ||
31 | .init = gf100_mspdec_init, | 30 | .init = gf100_mspdec_init, |
32 | .sclass = { | 31 | .sclass = { |
33 | { -1, -1, GK104_MSPDEC }, | 32 | { -1, -1, GK104_MSPDEC }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gt215.c index 835631713c95..cf6e59ad6ee2 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/mspdec/gt215.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_falcon_func | 28 | static const struct nvkm_falcon_func |
29 | gt215_mspdec = { | 29 | gt215_mspdec = { |
30 | .pmc_enable = 0x01020000, | ||
31 | .init = g98_mspdec_init, | 30 | .init = g98_mspdec_init, |
32 | .sclass = { | 31 | .sclass = { |
33 | { -1, -1, GT212_MSPDEC }, | 32 | { -1, -1, GT212_MSPDEC }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c index 73f633ae2ee7..c45dbf79d1f9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/g98.c | |||
@@ -35,7 +35,6 @@ g98_msppp_init(struct nvkm_falcon *msppp) | |||
35 | 35 | ||
36 | static const struct nvkm_falcon_func | 36 | static const struct nvkm_falcon_func |
37 | g98_msppp = { | 37 | g98_msppp = { |
38 | .pmc_enable = 0x00400002, | ||
39 | .init = g98_msppp_init, | 38 | .init = g98_msppp_init, |
40 | .sclass = { | 39 | .sclass = { |
41 | { -1, -1, G98_MSPPP }, | 40 | { -1, -1, G98_MSPPP }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c index c42c0c07e2db..803c62ab516e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gf100.c | |||
@@ -35,7 +35,6 @@ gf100_msppp_init(struct nvkm_falcon *msppp) | |||
35 | 35 | ||
36 | static const struct nvkm_falcon_func | 36 | static const struct nvkm_falcon_func |
37 | gf100_msppp = { | 37 | gf100_msppp = { |
38 | .pmc_enable = 0x00000002, | ||
39 | .init = gf100_msppp_init, | 38 | .init = gf100_msppp_init, |
40 | .sclass = { | 39 | .sclass = { |
41 | { -1, -1, GF100_MSPPP }, | 40 | { -1, -1, GF100_MSPPP }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gt215.c index 00e7795f1d51..49cbf72cee4b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msppp/gt215.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_falcon_func | 28 | static const struct nvkm_falcon_func |
29 | gt215_msppp = { | 29 | gt215_msppp = { |
30 | .pmc_enable = 0x00400002, | ||
31 | .init = g98_msppp_init, | 30 | .init = g98_msppp_init, |
32 | .sclass = { | 31 | .sclass = { |
33 | { -1, -1, GT212_MSPPP }, | 32 | { -1, -1, GT212_MSPPP }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c index 47e2929bfaf0..4a2a9f0494af 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/g98.c | |||
@@ -35,7 +35,6 @@ g98_msvld_init(struct nvkm_falcon *msvld) | |||
35 | 35 | ||
36 | static const struct nvkm_falcon_func | 36 | static const struct nvkm_falcon_func |
37 | g98_msvld = { | 37 | g98_msvld = { |
38 | .pmc_enable = 0x04008000, | ||
39 | .init = g98_msvld_init, | 38 | .init = g98_msvld_init, |
40 | .sclass = { | 39 | .sclass = { |
41 | { -1, -1, G98_MSVLD }, | 40 | { -1, -1, G98_MSVLD }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c index 1ac581ba9f96..1695e532c081 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gf100.c | |||
@@ -35,7 +35,6 @@ gf100_msvld_init(struct nvkm_falcon *msvld) | |||
35 | 35 | ||
36 | static const struct nvkm_falcon_func | 36 | static const struct nvkm_falcon_func |
37 | gf100_msvld = { | 37 | gf100_msvld = { |
38 | .pmc_enable = 0x00008000, | ||
39 | .init = gf100_msvld_init, | 38 | .init = gf100_msvld_init, |
40 | .sclass = { | 39 | .sclass = { |
41 | { -1, -1, GF100_MSVLD }, | 40 | { -1, -1, GF100_MSVLD }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c index 4bba16e0f560..b640cd63ebe8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gk104.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_falcon_func | 28 | static const struct nvkm_falcon_func |
29 | gk104_msvld = { | 29 | gk104_msvld = { |
30 | .pmc_enable = 0x00008000, | ||
31 | .init = gf100_msvld_init, | 30 | .init = gf100_msvld_init, |
32 | .sclass = { | 31 | .sclass = { |
33 | { -1, -1, GK104_MSVLD }, | 32 | { -1, -1, GK104_MSVLD }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gt215.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gt215.c index e17cb5605b2d..201e8ef3519e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gt215.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/gt215.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_falcon_func | 28 | static const struct nvkm_falcon_func |
29 | gt215_msvld = { | 29 | gt215_msvld = { |
30 | .pmc_enable = 0x04008000, | ||
31 | .init = g98_msvld_init, | 30 | .init = g98_msvld_init, |
32 | .sclass = { | 31 | .sclass = { |
33 | { -1, -1, GT212_MSVLD }, | 32 | { -1, -1, GT212_MSVLD }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/mcp89.c b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/mcp89.c index 511800f6a43b..a0f540ef257b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/msvld/mcp89.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/msvld/mcp89.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_falcon_func | 28 | static const struct nvkm_falcon_func |
29 | mcp89_msvld = { | 29 | mcp89_msvld = { |
30 | .pmc_enable = 0x04008000, | ||
31 | .init = g98_msvld_init, | 30 | .init = g98_msvld_init, |
32 | .sclass = { | 31 | .sclass = { |
33 | { -1, -1, IGT21A_MSVLD }, | 32 | { -1, -1, IGT21A_MSVLD }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c index f19fabef8d73..8616636ad7b4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/pm/base.c | |||
@@ -863,5 +863,5 @@ nvkm_pm_ctor(const struct nvkm_pm_func *func, struct nvkm_device *device, | |||
863 | pm->func = func; | 863 | pm->func = func; |
864 | INIT_LIST_HEAD(&pm->domains); | 864 | INIT_LIST_HEAD(&pm->domains); |
865 | INIT_LIST_HEAD(&pm->sources); | 865 | INIT_LIST_HEAD(&pm->sources); |
866 | return nvkm_engine_ctor(&nvkm_pm, device, index, 0, true, &pm->engine); | 866 | return nvkm_engine_ctor(&nvkm_pm, device, index, true, &pm->engine); |
867 | } | 867 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c b/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c index 995c2c5ec150..6d2a7f0afbb5 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sec/g98.c | |||
@@ -66,7 +66,6 @@ g98_sec = { | |||
66 | .code.size = sizeof(g98_sec_code), | 66 | .code.size = sizeof(g98_sec_code), |
67 | .data.data = g98_sec_data, | 67 | .data.data = g98_sec_data, |
68 | .data.size = sizeof(g98_sec_data), | 68 | .data.size = sizeof(g98_sec_data), |
69 | .pmc_enable = 0x00004000, | ||
70 | .intr = g98_sec_intr, | 69 | .intr = g98_sec_intr, |
71 | .sclass = { | 70 | .sclass = { |
72 | { -1, -1, G98_SEC }, | 71 | { -1, -1, G98_SEC }, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c b/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c index 53c1f7e75b54..7be3198e11de 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c | |||
@@ -106,5 +106,5 @@ nvkm_sw_new_(const struct nvkm_sw_func *func, struct nvkm_device *device, | |||
106 | INIT_LIST_HEAD(&sw->chan); | 106 | INIT_LIST_HEAD(&sw->chan); |
107 | sw->func = func; | 107 | sw->func = func; |
108 | 108 | ||
109 | return nvkm_engine_ctor(&nvkm_sw, device, index, 0, true, &sw->engine); | 109 | return nvkm_engine_ctor(&nvkm_sw, device, index, true, &sw->engine); |
110 | } | 110 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/vp/g84.c b/drivers/gpu/drm/nouveau/nvkm/engine/vp/g84.c index 4188c77ac927..7a96178786c4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/vp/g84.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/vp/g84.c | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | static const struct nvkm_xtensa_func | 28 | static const struct nvkm_xtensa_func |
29 | g84_vp = { | 29 | g84_vp = { |
30 | .pmc_enable = 0x01020000, | ||
31 | .fifo_val = 0x111, | 30 | .fifo_val = 0x111, |
32 | .unkd28 = 0x9c544, | 31 | .unkd28 = 0x9c544, |
33 | .sclass = { | 32 | .sclass = { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c b/drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c index a3d4f5bcec7a..06bdb67a0205 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/xtensa.c | |||
@@ -187,6 +187,6 @@ nvkm_xtensa_new_(const struct nvkm_xtensa_func *func, | |||
187 | xtensa->addr = addr; | 187 | xtensa->addr = addr; |
188 | *pengine = &xtensa->engine; | 188 | *pengine = &xtensa->engine; |
189 | 189 | ||
190 | return nvkm_engine_ctor(&nvkm_xtensa, device, index, func->pmc_enable, | 190 | return nvkm_engine_ctor(&nvkm_xtensa, device, index, |
191 | enable, &xtensa->engine); | 191 | enable, &xtensa->engine); |
192 | } | 192 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild index 642d27dc99a3..3f5d38d74fba 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/Kbuild | |||
@@ -19,4 +19,5 @@ include $(src)/nvkm/subdev/pmu/Kbuild | |||
19 | include $(src)/nvkm/subdev/secboot/Kbuild | 19 | include $(src)/nvkm/subdev/secboot/Kbuild |
20 | include $(src)/nvkm/subdev/therm/Kbuild | 20 | include $(src)/nvkm/subdev/therm/Kbuild |
21 | include $(src)/nvkm/subdev/timer/Kbuild | 21 | include $(src)/nvkm/subdev/timer/Kbuild |
22 | include $(src)/nvkm/subdev/top/Kbuild | ||
22 | include $(src)/nvkm/subdev/volt/Kbuild | 23 | include $(src)/nvkm/subdev/volt/Kbuild |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c index a9433ad45b1e..c561d148cebc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bar/base.c | |||
@@ -77,7 +77,7 @@ void | |||
77 | nvkm_bar_ctor(const struct nvkm_bar_func *func, struct nvkm_device *device, | 77 | nvkm_bar_ctor(const struct nvkm_bar_func *func, struct nvkm_device *device, |
78 | int index, struct nvkm_bar *bar) | 78 | int index, struct nvkm_bar *bar) |
79 | { | 79 | { |
80 | nvkm_subdev_ctor(&nvkm_bar, device, index, 0, &bar->subdev); | 80 | nvkm_subdev_ctor(&nvkm_bar, device, index, &bar->subdev); |
81 | bar->func = func; | 81 | bar->func = func; |
82 | spin_lock_init(&bar->lock); | 82 | spin_lock_init(&bar->lock); |
83 | } | 83 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c index 79536897efaa..e15b9627b07e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | |||
@@ -105,7 +105,7 @@ nvkm_bios_new(struct nvkm_device *device, int index, struct nvkm_bios **pbios) | |||
105 | 105 | ||
106 | if (!(bios = *pbios = kzalloc(sizeof(*bios), GFP_KERNEL))) | 106 | if (!(bios = *pbios = kzalloc(sizeof(*bios), GFP_KERNEL))) |
107 | return -ENOMEM; | 107 | return -ENOMEM; |
108 | nvkm_subdev_ctor(&nvkm_bios, device, index, 0, &bios->subdev); | 108 | nvkm_subdev_ctor(&nvkm_bios, device, index, &bios->subdev); |
109 | 109 | ||
110 | ret = nvbios_shadow(bios); | 110 | ret = nvbios_shadow(bios); |
111 | if (ret) | 111 | if (ret) |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c index 125ec2ed6c2e..91a7dc56e406 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/pll.c | |||
@@ -81,9 +81,11 @@ static u16 | |||
81 | pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | 81 | pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) |
82 | { | 82 | { |
83 | struct bit_entry bit_C; | 83 | struct bit_entry bit_C; |
84 | u16 data = 0x0000; | ||
84 | 85 | ||
85 | if (!bit_entry(bios, 'C', &bit_C) && bit_C.length >= 10) { | 86 | if (!bit_entry(bios, 'C', &bit_C)) { |
86 | u16 data = nvbios_rd16(bios, bit_C.offset + 8); | 87 | if (bit_C.version == 1 && bit_C.length >= 10) |
88 | data = nvbios_rd16(bios, bit_C.offset + 8); | ||
87 | if (data) { | 89 | if (data) { |
88 | *ver = nvbios_rd08(bios, data + 0); | 90 | *ver = nvbios_rd08(bios, data + 0); |
89 | *hdr = nvbios_rd08(bios, data + 1); | 91 | *hdr = nvbios_rd08(bios, data + 1); |
@@ -94,7 +96,7 @@ pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | |||
94 | } | 96 | } |
95 | 97 | ||
96 | if (bmp_version(bios) >= 0x0524) { | 98 | if (bmp_version(bios) >= 0x0524) { |
97 | u16 data = nvbios_rd16(bios, bios->bmp_offset + 142); | 99 | data = nvbios_rd16(bios, bios->bmp_offset + 142); |
98 | if (data) { | 100 | if (data) { |
99 | *ver = nvbios_rd08(bios, data + 0); | 101 | *ver = nvbios_rd08(bios, data + 0); |
100 | *hdr = 1; | 102 | *hdr = 1; |
@@ -105,7 +107,7 @@ pll_limits_table(struct nvkm_bios *bios, u8 *ver, u8 *hdr, u8 *cnt, u8 *len) | |||
105 | } | 107 | } |
106 | 108 | ||
107 | *ver = 0x00; | 109 | *ver = 0x00; |
108 | return 0x0000; | 110 | return data; |
109 | } | 111 | } |
110 | 112 | ||
111 | static struct pll_mapping * | 113 | static struct pll_mapping * |
@@ -156,7 +158,7 @@ pll_map_reg(struct nvkm_bios *bios, u32 reg, u32 *type, u8 *ver, u8 *len) | |||
156 | } | 158 | } |
157 | 159 | ||
158 | map = pll_map(bios); | 160 | map = pll_map(bios); |
159 | while (map->reg) { | 161 | while (map && map->reg) { |
160 | if (map->reg == reg && *ver >= 0x20) { | 162 | if (map->reg == reg && *ver >= 0x20) { |
161 | u16 addr = (data += hdr); | 163 | u16 addr = (data += hdr); |
162 | *type = map->type; | 164 | *type = map->type; |
@@ -198,7 +200,7 @@ pll_map_type(struct nvkm_bios *bios, u8 type, u32 *reg, u8 *ver, u8 *len) | |||
198 | } | 200 | } |
199 | 201 | ||
200 | map = pll_map(bios); | 202 | map = pll_map(bios); |
201 | while (map->reg) { | 203 | while (map && map->reg) { |
202 | if (map->type == type && *ver >= 0x20) { | 204 | if (map->type == type && *ver >= 0x20) { |
203 | u16 addr = (data += hdr); | 205 | u16 addr = (data += hdr); |
204 | *reg = map->reg; | 206 | *reg = map->reg; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c index dc5a10f18bdb..52ad73bce5fe 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bus/base.c | |||
@@ -58,7 +58,7 @@ nvkm_bus_new_(const struct nvkm_bus_func *func, struct nvkm_device *device, | |||
58 | struct nvkm_bus *bus; | 58 | struct nvkm_bus *bus; |
59 | if (!(bus = *pbus = kzalloc(sizeof(*bus), GFP_KERNEL))) | 59 | if (!(bus = *pbus = kzalloc(sizeof(*bus), GFP_KERNEL))) |
60 | return -ENOMEM; | 60 | return -ENOMEM; |
61 | nvkm_subdev_ctor(&nvkm_bus, device, index, 0, &bus->subdev); | 61 | nvkm_subdev_ctor(&nvkm_bus, device, index, &bus->subdev); |
62 | bus->func = func; | 62 | bus->func = func; |
63 | return 0; | 63 | return 0; |
64 | } | 64 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c index 889cce2eb727..7102c25320fc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c | |||
@@ -564,7 +564,7 @@ nvkm_clk_ctor(const struct nvkm_clk_func *func, struct nvkm_device *device, | |||
564 | int ret, idx, arglen; | 564 | int ret, idx, arglen; |
565 | const char *mode; | 565 | const char *mode; |
566 | 566 | ||
567 | nvkm_subdev_ctor(&nvkm_clk, device, index, 0, &clk->subdev); | 567 | nvkm_subdev_ctor(&nvkm_clk, device, index, &clk->subdev); |
568 | clk->func = func; | 568 | clk->func = func; |
569 | INIT_LIST_HEAD(&clk->states); | 569 | INIT_LIST_HEAD(&clk->states); |
570 | clk->domains = func->domains; | 570 | clk->domains = func->domains; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c index 5f25402f6b09..4756019ddf3f 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/base.c | |||
@@ -83,6 +83,12 @@ nvkm_devinit_preinit(struct nvkm_subdev *subdev) | |||
83 | if (init->func->preinit) | 83 | if (init->func->preinit) |
84 | init->func->preinit(init); | 84 | init->func->preinit(init); |
85 | 85 | ||
86 | /* Override the post flag during the first call if NvForcePost is set */ | ||
87 | if (init->force_post) { | ||
88 | init->post = init->force_post; | ||
89 | init->force_post = false; | ||
90 | } | ||
91 | |||
86 | /* unlock the extended vga crtc regs */ | 92 | /* unlock the extended vga crtc regs */ |
87 | nvkm_lockvgac(subdev->device, false); | 93 | nvkm_lockvgac(subdev->device, false); |
88 | return 0; | 94 | return 0; |
@@ -124,7 +130,7 @@ nvkm_devinit_ctor(const struct nvkm_devinit_func *func, | |||
124 | struct nvkm_device *device, int index, | 130 | struct nvkm_device *device, int index, |
125 | struct nvkm_devinit *init) | 131 | struct nvkm_devinit *init) |
126 | { | 132 | { |
127 | nvkm_subdev_ctor(&nvkm_devinit, device, index, 0, &init->subdev); | 133 | nvkm_subdev_ctor(&nvkm_devinit, device, index, &init->subdev); |
128 | init->func = func; | 134 | init->func = func; |
129 | init->post = nvkm_boolopt(device->cfgopt, "NvForcePost", false); | 135 | init->force_post = nvkm_boolopt(device->cfgopt, "NvForcePost", false); |
130 | } | 136 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c index 2923598b5fe9..8b1b34c3ad26 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/devinit/gf100.c | |||
@@ -97,9 +97,11 @@ gf100_devinit_preinit(struct nvkm_devinit *base) | |||
97 | struct nvkm_subdev *subdev = &init->base.subdev; | 97 | struct nvkm_subdev *subdev = &init->base.subdev; |
98 | struct nvkm_device *device = subdev->device; | 98 | struct nvkm_device *device = subdev->device; |
99 | 99 | ||
100 | /* This bit is set by devinit, and flips back to 0 on suspend */ | 100 | /* |
101 | if (!base->post) | 101 | * This bit is set by devinit, and flips back to 0 on suspend. We |
102 | base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0); | 102 | * can use it as a reliable way to know whether we should run devinit. |
103 | */ | ||
104 | base->post = ((nvkm_rd32(device, 0x2240c) & BIT(1)) == 0); | ||
103 | } | 105 | } |
104 | 106 | ||
105 | static const struct nvkm_devinit_func | 107 | static const struct nvkm_devinit_func |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild index 08105701af7e..842d5de96d73 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild | |||
@@ -23,6 +23,7 @@ nvkm-y += nvkm/subdev/fb/gf100.o | |||
23 | nvkm-y += nvkm/subdev/fb/gk104.o | 23 | nvkm-y += nvkm/subdev/fb/gk104.o |
24 | nvkm-y += nvkm/subdev/fb/gk20a.o | 24 | nvkm-y += nvkm/subdev/fb/gk20a.o |
25 | nvkm-y += nvkm/subdev/fb/gm107.o | 25 | nvkm-y += nvkm/subdev/fb/gm107.o |
26 | nvkm-y += nvkm/subdev/fb/gm200.o | ||
26 | 27 | ||
27 | nvkm-y += nvkm/subdev/fb/ram.o | 28 | nvkm-y += nvkm/subdev/fb/ram.o |
28 | nvkm-y += nvkm/subdev/fb/ramnv04.o | 29 | nvkm-y += nvkm/subdev/fb/ramnv04.o |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c index a719b9becb73..ce90242b8cce 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "priv.h" | 24 | #include "priv.h" |
25 | #include "ram.h" | 25 | #include "ram.h" |
26 | 26 | ||
27 | #include <core/memory.h> | ||
27 | #include <subdev/bios.h> | 28 | #include <subdev/bios.h> |
28 | #include <subdev/bios/M0203.h> | 29 | #include <subdev/bios/M0203.h> |
29 | #include <engine/gr.h> | 30 | #include <engine/gr.h> |
@@ -98,6 +99,7 @@ static int | |||
98 | nvkm_fb_oneinit(struct nvkm_subdev *subdev) | 99 | nvkm_fb_oneinit(struct nvkm_subdev *subdev) |
99 | { | 100 | { |
100 | struct nvkm_fb *fb = nvkm_fb(subdev); | 101 | struct nvkm_fb *fb = nvkm_fb(subdev); |
102 | |||
101 | if (fb->func->ram_new) { | 103 | if (fb->func->ram_new) { |
102 | int ret = fb->func->ram_new(fb, &fb->ram); | 104 | int ret = fb->func->ram_new(fb, &fb->ram); |
103 | if (ret) { | 105 | if (ret) { |
@@ -105,6 +107,13 @@ nvkm_fb_oneinit(struct nvkm_subdev *subdev) | |||
105 | return ret; | 107 | return ret; |
106 | } | 108 | } |
107 | } | 109 | } |
110 | |||
111 | if (fb->func->oneinit) { | ||
112 | int ret = fb->func->oneinit(fb); | ||
113 | if (ret) | ||
114 | return ret; | ||
115 | } | ||
116 | |||
108 | return 0; | 117 | return 0; |
109 | } | 118 | } |
110 | 119 | ||
@@ -134,6 +143,9 @@ nvkm_fb_dtor(struct nvkm_subdev *subdev) | |||
134 | struct nvkm_fb *fb = nvkm_fb(subdev); | 143 | struct nvkm_fb *fb = nvkm_fb(subdev); |
135 | int i; | 144 | int i; |
136 | 145 | ||
146 | nvkm_memory_del(&fb->mmu_wr); | ||
147 | nvkm_memory_del(&fb->mmu_rd); | ||
148 | |||
137 | for (i = 0; i < fb->tile.regions; i++) | 149 | for (i = 0; i < fb->tile.regions; i++) |
138 | fb->func->tile.fini(fb, i, &fb->tile.region[i]); | 150 | fb->func->tile.fini(fb, i, &fb->tile.region[i]); |
139 | 151 | ||
@@ -156,7 +168,7 @@ void | |||
156 | nvkm_fb_ctor(const struct nvkm_fb_func *func, struct nvkm_device *device, | 168 | nvkm_fb_ctor(const struct nvkm_fb_func *func, struct nvkm_device *device, |
157 | int index, struct nvkm_fb *fb) | 169 | int index, struct nvkm_fb *fb) |
158 | { | 170 | { |
159 | nvkm_subdev_ctor(&nvkm_fb, device, index, 0, &fb->subdev); | 171 | nvkm_subdev_ctor(&nvkm_fb, device, index, &fb->subdev); |
160 | fb->func = func; | 172 | fb->func = func; |
161 | fb->tile.regions = fb->func->tile.regions; | 173 | fb->tile.regions = fb->func->tile.regions; |
162 | } | 174 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c index 008bb9849f3b..e649ead5ccfc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gf100.c | |||
@@ -24,6 +24,9 @@ | |||
24 | #include "gf100.h" | 24 | #include "gf100.h" |
25 | #include "ram.h" | 25 | #include "ram.h" |
26 | 26 | ||
27 | #include <core/memory.h> | ||
28 | #include <core/option.h> | ||
29 | |||
27 | extern const u8 gf100_pte_storage_type_map[256]; | 30 | extern const u8 gf100_pte_storage_type_map[256]; |
28 | 31 | ||
29 | bool | 32 | bool |
@@ -46,6 +49,28 @@ gf100_fb_intr(struct nvkm_fb *base) | |||
46 | nvkm_debug(subdev, "PBFB intr\n"); | 49 | nvkm_debug(subdev, "PBFB intr\n"); |
47 | } | 50 | } |
48 | 51 | ||
52 | int | ||
53 | gf100_fb_oneinit(struct nvkm_fb *fb) | ||
54 | { | ||
55 | struct nvkm_device *device = fb->subdev.device; | ||
56 | int ret, size = 0x1000; | ||
57 | |||
58 | size = nvkm_longopt(device->cfgopt, "MmuDebugBufferSize", size); | ||
59 | size = min(size, 0x1000); | ||
60 | |||
61 | ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, size, 0x1000, | ||
62 | false, &fb->mmu_rd); | ||
63 | if (ret) | ||
64 | return ret; | ||
65 | |||
66 | ret = nvkm_memory_new(device, NVKM_MEM_TARGET_INST, size, 0x1000, | ||
67 | false, &fb->mmu_wr); | ||
68 | if (ret) | ||
69 | return ret; | ||
70 | |||
71 | return 0; | ||
72 | } | ||
73 | |||
49 | void | 74 | void |
50 | gf100_fb_init(struct nvkm_fb *base) | 75 | gf100_fb_init(struct nvkm_fb *base) |
51 | { | 76 | { |
@@ -98,6 +123,7 @@ gf100_fb_new_(const struct nvkm_fb_func *func, struct nvkm_device *device, | |||
98 | static const struct nvkm_fb_func | 123 | static const struct nvkm_fb_func |
99 | gf100_fb = { | 124 | gf100_fb = { |
100 | .dtor = gf100_fb_dtor, | 125 | .dtor = gf100_fb_dtor, |
126 | .oneinit = gf100_fb_oneinit, | ||
101 | .init = gf100_fb_init, | 127 | .init = gf100_fb_init, |
102 | .intr = gf100_fb_intr, | 128 | .intr = gf100_fb_intr, |
103 | .ram_new = gf100_ram_new, | 129 | .ram_new = gf100_ram_new, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c index 0edb3c316f5c..b41f0f70038c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk104.c | |||
@@ -27,6 +27,7 @@ | |||
27 | static const struct nvkm_fb_func | 27 | static const struct nvkm_fb_func |
28 | gk104_fb = { | 28 | gk104_fb = { |
29 | .dtor = gf100_fb_dtor, | 29 | .dtor = gf100_fb_dtor, |
30 | .oneinit = gf100_fb_oneinit, | ||
30 | .init = gf100_fb_init, | 31 | .init = gf100_fb_init, |
31 | .intr = gf100_fb_intr, | 32 | .intr = gf100_fb_intr, |
32 | .ram_new = gk104_ram_new, | 33 | .ram_new = gk104_ram_new, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk20a.c index 81447eb4c948..7306f7dfc3b9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gk20a.c | |||
@@ -21,15 +21,20 @@ | |||
21 | */ | 21 | */ |
22 | #include "priv.h" | 22 | #include "priv.h" |
23 | 23 | ||
24 | #include <core/memory.h> | ||
25 | |||
24 | static void | 26 | static void |
25 | gk20a_fb_init(struct nvkm_fb *fb) | 27 | gk20a_fb_init(struct nvkm_fb *fb) |
26 | { | 28 | { |
27 | struct nvkm_device *device = fb->subdev.device; | 29 | struct nvkm_device *device = fb->subdev.device; |
28 | nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | 30 | nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ |
31 | nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->mmu_wr) >> 8); | ||
32 | nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->mmu_rd) >> 8); | ||
29 | } | 33 | } |
30 | 34 | ||
31 | static const struct nvkm_fb_func | 35 | static const struct nvkm_fb_func |
32 | gk20a_fb = { | 36 | gk20a_fb = { |
37 | .oneinit = gf100_fb_oneinit, | ||
33 | .init = gk20a_fb_init, | 38 | .init = gk20a_fb_init, |
34 | .memtype_valid = gf100_fb_memtype_valid, | 39 | .memtype_valid = gf100_fb_memtype_valid, |
35 | }; | 40 | }; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c index 2a91df8655dd..4869fdb753c9 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm107.c | |||
@@ -27,6 +27,7 @@ | |||
27 | static const struct nvkm_fb_func | 27 | static const struct nvkm_fb_func |
28 | gm107_fb = { | 28 | gm107_fb = { |
29 | .dtor = gf100_fb_dtor, | 29 | .dtor = gf100_fb_dtor, |
30 | .oneinit = gf100_fb_oneinit, | ||
30 | .init = gf100_fb_init, | 31 | .init = gf100_fb_init, |
31 | .intr = gf100_fb_intr, | 32 | .intr = gf100_fb_intr, |
32 | .ram_new = gm107_ram_new, | 33 | .ram_new = gm107_ram_new, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c new file mode 100644 index 000000000000..44f5716f64d8 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/gm200.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | #include "gf100.h" | ||
25 | #include "ram.h" | ||
26 | |||
27 | #include <core/memory.h> | ||
28 | |||
29 | static void | ||
30 | gm200_fb_init(struct nvkm_fb *base) | ||
31 | { | ||
32 | struct gf100_fb *fb = gf100_fb(base); | ||
33 | struct nvkm_device *device = fb->base.subdev.device; | ||
34 | |||
35 | if (fb->r100c10_page) | ||
36 | nvkm_wr32(device, 0x100c10, fb->r100c10 >> 8); | ||
37 | |||
38 | nvkm_mask(device, 0x100c80, 0x00000001, 0x00000000); /* 128KiB lpg */ | ||
39 | |||
40 | nvkm_wr32(device, 0x100cc8, nvkm_memory_addr(fb->base.mmu_wr) >> 8); | ||
41 | nvkm_wr32(device, 0x100ccc, nvkm_memory_addr(fb->base.mmu_rd) >> 8); | ||
42 | nvkm_mask(device, 0x100cc4, 0x00060000, | ||
43 | min(nvkm_memory_size(fb->base.mmu_rd) >> 16, (u64)2) << 17); | ||
44 | } | ||
45 | |||
46 | static const struct nvkm_fb_func | ||
47 | gm200_fb = { | ||
48 | .dtor = gf100_fb_dtor, | ||
49 | .oneinit = gf100_fb_oneinit, | ||
50 | .init = gm200_fb_init, | ||
51 | .intr = gf100_fb_intr, | ||
52 | .ram_new = gm107_ram_new, | ||
53 | .memtype_valid = gf100_fb_memtype_valid, | ||
54 | }; | ||
55 | |||
56 | int | ||
57 | gm200_fb_new(struct nvkm_device *device, int index, struct nvkm_fb **pfb) | ||
58 | { | ||
59 | return gf100_fb_new_(&gm200_fb, device, index, pfb); | ||
60 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h index 62b9feb531dc..d97d640e60a0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h | |||
@@ -6,6 +6,7 @@ struct nvkm_bios; | |||
6 | 6 | ||
7 | struct nvkm_fb_func { | 7 | struct nvkm_fb_func { |
8 | void *(*dtor)(struct nvkm_fb *); | 8 | void *(*dtor)(struct nvkm_fb *); |
9 | int (*oneinit)(struct nvkm_fb *); | ||
9 | void (*init)(struct nvkm_fb *); | 10 | void (*init)(struct nvkm_fb *); |
10 | void (*intr)(struct nvkm_fb *); | 11 | void (*intr)(struct nvkm_fb *); |
11 | 12 | ||
@@ -58,5 +59,6 @@ void nv44_fb_tile_prog(struct nvkm_fb *, int, struct nvkm_fb_tile *); | |||
58 | void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size, | 59 | void nv46_fb_tile_init(struct nvkm_fb *, int i, u32 addr, u32 size, |
59 | u32 pitch, u32 flags, struct nvkm_fb_tile *); | 60 | u32 pitch, u32 flags, struct nvkm_fb_tile *); |
60 | 61 | ||
62 | int gf100_fb_oneinit(struct nvkm_fb *); | ||
61 | bool gf100_fb_memtype_valid(struct nvkm_fb *, u32); | 63 | bool gf100_fb_memtype_valid(struct nvkm_fb *, u32); |
62 | #endif | 64 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c index f4144979a79c..1c3c18ea8ced 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/fuse/base.c | |||
@@ -47,7 +47,7 @@ nvkm_fuse_new_(const struct nvkm_fuse_func *func, struct nvkm_device *device, | |||
47 | struct nvkm_fuse *fuse; | 47 | struct nvkm_fuse *fuse; |
48 | if (!(fuse = *pfuse = kzalloc(sizeof(*fuse), GFP_KERNEL))) | 48 | if (!(fuse = *pfuse = kzalloc(sizeof(*fuse), GFP_KERNEL))) |
49 | return -ENOMEM; | 49 | return -ENOMEM; |
50 | nvkm_subdev_ctor(&nvkm_fuse, device, index, 0, &fuse->subdev); | 50 | nvkm_subdev_ctor(&nvkm_fuse, device, index, &fuse->subdev); |
51 | fuse->func = func; | 51 | fuse->func = func; |
52 | spin_lock_init(&fuse->lock); | 52 | spin_lock_init(&fuse->lock); |
53 | return 0; | 53 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c index d45ec99f0e38..77c649723ad7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gpio/base.c | |||
@@ -216,7 +216,7 @@ nvkm_gpio_new_(const struct nvkm_gpio_func *func, struct nvkm_device *device, | |||
216 | if (!(gpio = *pgpio = kzalloc(sizeof(*gpio), GFP_KERNEL))) | 216 | if (!(gpio = *pgpio = kzalloc(sizeof(*gpio), GFP_KERNEL))) |
217 | return -ENOMEM; | 217 | return -ENOMEM; |
218 | 218 | ||
219 | nvkm_subdev_ctor(&nvkm_gpio, device, index, 0, &gpio->subdev); | 219 | nvkm_subdev_ctor(&nvkm_gpio, device, index, &gpio->subdev); |
220 | gpio->func = func; | 220 | gpio->func = func; |
221 | 221 | ||
222 | return nvkm_event_init(&nvkm_gpio_intr_func, 2, func->lines, | 222 | return nvkm_event_init(&nvkm_gpio_intr_func, 2, func->lines, |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c index 243a71ff0a0d..4f197b15acf6 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/base.c | |||
@@ -254,7 +254,7 @@ nvkm_i2c_new_(const struct nvkm_i2c_func *func, struct nvkm_device *device, | |||
254 | if (!(i2c = *pi2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) | 254 | if (!(i2c = *pi2c = kzalloc(sizeof(*i2c), GFP_KERNEL))) |
255 | return -ENOMEM; | 255 | return -ENOMEM; |
256 | 256 | ||
257 | nvkm_subdev_ctor(&nvkm_i2c, device, index, 0, &i2c->subdev); | 257 | nvkm_subdev_ctor(&nvkm_i2c, device, index, &i2c->subdev); |
258 | i2c->func = func; | 258 | i2c->func = func; |
259 | INIT_LIST_HEAD(&i2c->pad); | 259 | INIT_LIST_HEAD(&i2c->pad); |
260 | INIT_LIST_HEAD(&i2c->bus); | 260 | INIT_LIST_HEAD(&i2c->bus); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c index 72d6330d243d..2c6b374f1420 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf100.c | |||
@@ -117,6 +117,6 @@ gf100_ibus_new(struct nvkm_device *device, int index, | |||
117 | struct nvkm_subdev *ibus; | 117 | struct nvkm_subdev *ibus; |
118 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) | 118 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) |
119 | return -ENOMEM; | 119 | return -ENOMEM; |
120 | nvkm_subdev_ctor(&gf100_ibus, device, index, 0, ibus); | 120 | nvkm_subdev_ctor(&gf100_ibus, device, index, ibus); |
121 | return 0; | 121 | return 0; |
122 | } | 122 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf117.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf117.c index f69f263c5906..3905a80da811 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf117.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gf117.c | |||
@@ -46,6 +46,6 @@ gf117_ibus_new(struct nvkm_device *device, int index, | |||
46 | struct nvkm_subdev *ibus; | 46 | struct nvkm_subdev *ibus; |
47 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) | 47 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) |
48 | return -ENOMEM; | 48 | return -ENOMEM; |
49 | nvkm_subdev_ctor(&gf117_ibus, device, index, 0, ibus); | 49 | nvkm_subdev_ctor(&gf117_ibus, device, index, ibus); |
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c index b5cee3f89aaa..c673853f3213 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk104.c | |||
@@ -120,6 +120,6 @@ gk104_ibus_new(struct nvkm_device *device, int index, | |||
120 | struct nvkm_subdev *ibus; | 120 | struct nvkm_subdev *ibus; |
121 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) | 121 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) |
122 | return -ENOMEM; | 122 | return -ENOMEM; |
123 | nvkm_subdev_ctor(&gk104_ibus, device, index, 0, ibus); | 123 | nvkm_subdev_ctor(&gk104_ibus, device, index, ibus); |
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk20a.c index 3484079e885a..b7159b338fac 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gk20a.c | |||
@@ -84,6 +84,6 @@ gk20a_ibus_new(struct nvkm_device *device, int index, | |||
84 | struct nvkm_subdev *ibus; | 84 | struct nvkm_subdev *ibus; |
85 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) | 85 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) |
86 | return -ENOMEM; | 86 | return -ENOMEM; |
87 | nvkm_subdev_ctor(&gk20a_ibus, device, index, 0, ibus); | 87 | nvkm_subdev_ctor(&gk20a_ibus, device, index, ibus); |
88 | return 0; | 88 | return 0; |
89 | } | 89 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c index ef0b7f3b1128..c63328152bfa 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ibus/gm200.c | |||
@@ -35,6 +35,6 @@ gm200_ibus_new(struct nvkm_device *device, int index, | |||
35 | struct nvkm_subdev *ibus; | 35 | struct nvkm_subdev *ibus; |
36 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) | 36 | if (!(ibus = *pibus = kzalloc(sizeof(*ibus), GFP_KERNEL))) |
37 | return -ENOMEM; | 37 | return -ENOMEM; |
38 | nvkm_subdev_ctor(&gm200_ibus, device, index, 0, ibus); | 38 | nvkm_subdev_ctor(&gm200_ibus, device, index, ibus); |
39 | return 0; | 39 | return 0; |
40 | } | 40 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c index c44a85228074..323c79abe468 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/base.c | |||
@@ -30,15 +30,14 @@ | |||
30 | 30 | ||
31 | static bool | 31 | static bool |
32 | nvkm_iccsense_validate_device(struct i2c_adapter *i2c, u8 addr, | 32 | nvkm_iccsense_validate_device(struct i2c_adapter *i2c, u8 addr, |
33 | enum nvbios_extdev_type type, u8 rail) | 33 | enum nvbios_extdev_type type) |
34 | { | 34 | { |
35 | switch (type) { | 35 | switch (type) { |
36 | case NVBIOS_EXTDEV_INA209: | 36 | case NVBIOS_EXTDEV_INA209: |
37 | case NVBIOS_EXTDEV_INA219: | 37 | case NVBIOS_EXTDEV_INA219: |
38 | return rail == 0 && nv_rd16i2cr(i2c, addr, 0x0) >= 0; | 38 | return nv_rd16i2cr(i2c, addr, 0x0) >= 0; |
39 | case NVBIOS_EXTDEV_INA3221: | 39 | case NVBIOS_EXTDEV_INA3221: |
40 | return rail <= 3 && | 40 | return nv_rd16i2cr(i2c, addr, 0xff) == 0x3220 && |
41 | nv_rd16i2cr(i2c, addr, 0xff) == 0x3220 && | ||
42 | nv_rd16i2cr(i2c, addr, 0xfe) == 0x5449; | 41 | nv_rd16i2cr(i2c, addr, 0xfe) == 0x5449; |
43 | default: | 42 | default: |
44 | return false; | 43 | return false; |
@@ -67,8 +66,9 @@ nvkm_iccsense_ina2x9_read(struct nvkm_iccsense *iccsense, | |||
67 | struct nvkm_iccsense_rail *rail, | 66 | struct nvkm_iccsense_rail *rail, |
68 | u8 shunt_reg, u8 bus_reg) | 67 | u8 shunt_reg, u8 bus_reg) |
69 | { | 68 | { |
70 | return nvkm_iccsense_poll_lane(rail->i2c, rail->addr, shunt_reg, 0, | 69 | return nvkm_iccsense_poll_lane(rail->sensor->i2c, rail->sensor->addr, |
71 | bus_reg, 3, rail->mohm, 10 * 4); | 70 | shunt_reg, 0, bus_reg, 3, rail->mohm, |
71 | 10 * 4); | ||
72 | } | 72 | } |
73 | 73 | ||
74 | static int | 74 | static int |
@@ -89,37 +89,87 @@ static int | |||
89 | nvkm_iccsense_ina3221_read(struct nvkm_iccsense *iccsense, | 89 | nvkm_iccsense_ina3221_read(struct nvkm_iccsense *iccsense, |
90 | struct nvkm_iccsense_rail *rail) | 90 | struct nvkm_iccsense_rail *rail) |
91 | { | 91 | { |
92 | return nvkm_iccsense_poll_lane(rail->i2c, rail->addr, | 92 | return nvkm_iccsense_poll_lane(rail->sensor->i2c, rail->sensor->addr, |
93 | 1 + (rail->rail * 2), 3, | 93 | 1 + (rail->idx * 2), 3, |
94 | 2 + (rail->rail * 2), 3, rail->mohm, | 94 | 2 + (rail->idx * 2), 3, rail->mohm, |
95 | 40 * 8); | 95 | 40 * 8); |
96 | } | 96 | } |
97 | 97 | ||
98 | int | 98 | static void |
99 | nvkm_iccsense_read(struct nvkm_iccsense *iccsense, u8 idx) | 99 | nvkm_iccsense_ina209_config(struct nvkm_iccsense *iccsense, |
100 | struct nvkm_iccsense_sensor *sensor) | ||
100 | { | 101 | { |
101 | struct nvkm_iccsense_rail *rail; | 102 | struct nvkm_subdev *subdev = &iccsense->subdev; |
102 | 103 | /* configuration: | |
103 | if (!iccsense || idx >= iccsense->rail_count) | 104 | * 0x0007: 0x0007 shunt and bus continous |
104 | return -EINVAL; | 105 | * 0x0078: 0x0078 128 samples shunt |
106 | * 0x0780: 0x0780 128 samples bus | ||
107 | * 0x1800: 0x0000 +-40 mV shunt range | ||
108 | * 0x2000: 0x0000 16V FSR | ||
109 | */ | ||
110 | u16 value = 0x07ff; | ||
111 | nvkm_debug(subdev, "config for sensor id %i: 0x%x\n", sensor->id, value); | ||
112 | nv_wr16i2cr(sensor->i2c, sensor->addr, 0x00, value); | ||
113 | } | ||
105 | 114 | ||
106 | rail = &iccsense->rails[idx]; | 115 | static void |
107 | if (!rail->read) | 116 | nvkm_iccsense_ina3221_config(struct nvkm_iccsense *iccsense, |
108 | return -ENODEV; | 117 | struct nvkm_iccsense_sensor *sensor) |
118 | { | ||
119 | struct nvkm_subdev *subdev = &iccsense->subdev; | ||
120 | /* configuration: | ||
121 | * 0x0007: 0x0007 shunt and bus continous | ||
122 | * 0x0031: 0x0000 140 us conversion time shunt | ||
123 | * 0x01c0: 0x0000 140 us conversion time bus | ||
124 | * 0x0f00: 0x0f00 1024 samples | ||
125 | * 0x7000: 0x?000 channels | ||
126 | */ | ||
127 | u16 value = 0x0e07; | ||
128 | if (sensor->rail_mask & 0x1) | ||
129 | value |= 0x1 << 14; | ||
130 | if (sensor->rail_mask & 0x2) | ||
131 | value |= 0x1 << 13; | ||
132 | if (sensor->rail_mask & 0x4) | ||
133 | value |= 0x1 << 12; | ||
134 | nvkm_debug(subdev, "config for sensor id %i: 0x%x\n", sensor->id, value); | ||
135 | nv_wr16i2cr(sensor->i2c, sensor->addr, 0x00, value); | ||
136 | } | ||
109 | 137 | ||
110 | return rail->read(iccsense, rail); | 138 | static void |
139 | nvkm_iccsense_sensor_config(struct nvkm_iccsense *iccsense, | ||
140 | struct nvkm_iccsense_sensor *sensor) | ||
141 | { | ||
142 | switch (sensor->type) { | ||
143 | case NVBIOS_EXTDEV_INA209: | ||
144 | case NVBIOS_EXTDEV_INA219: | ||
145 | nvkm_iccsense_ina209_config(iccsense, sensor); | ||
146 | break; | ||
147 | case NVBIOS_EXTDEV_INA3221: | ||
148 | nvkm_iccsense_ina3221_config(iccsense, sensor); | ||
149 | break; | ||
150 | default: | ||
151 | break; | ||
152 | } | ||
111 | } | 153 | } |
112 | 154 | ||
113 | int | 155 | int |
114 | nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense) | 156 | nvkm_iccsense_read_all(struct nvkm_iccsense *iccsense) |
115 | { | 157 | { |
116 | int result = 0, i; | 158 | int result = 0; |
117 | for (i = 0; i < iccsense->rail_count; ++i) { | 159 | struct nvkm_iccsense_rail *rail; |
118 | int res = nvkm_iccsense_read(iccsense, i); | 160 | |
119 | if (res >= 0) | 161 | if (!iccsense) |
120 | result += res; | 162 | return -EINVAL; |
121 | else | 163 | |
164 | list_for_each_entry(rail, &iccsense->rails, head) { | ||
165 | int res; | ||
166 | if (!rail->read) | ||
167 | return -ENODEV; | ||
168 | |||
169 | res = rail->read(iccsense, rail); | ||
170 | if (res < 0) | ||
122 | return res; | 171 | return res; |
172 | result += res; | ||
123 | } | 173 | } |
124 | return result; | 174 | return result; |
125 | } | 175 | } |
@@ -128,89 +178,158 @@ static void * | |||
128 | nvkm_iccsense_dtor(struct nvkm_subdev *subdev) | 178 | nvkm_iccsense_dtor(struct nvkm_subdev *subdev) |
129 | { | 179 | { |
130 | struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); | 180 | struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); |
181 | struct nvkm_iccsense_sensor *sensor, *tmps; | ||
182 | struct nvkm_iccsense_rail *rail, *tmpr; | ||
131 | 183 | ||
132 | if (iccsense->rails) | 184 | list_for_each_entry_safe(sensor, tmps, &iccsense->sensors, head) { |
133 | kfree(iccsense->rails); | 185 | list_del(&sensor->head); |
186 | kfree(sensor); | ||
187 | } | ||
188 | list_for_each_entry_safe(rail, tmpr, &iccsense->rails, head) { | ||
189 | list_del(&rail->head); | ||
190 | kfree(rail); | ||
191 | } | ||
134 | 192 | ||
135 | return iccsense; | 193 | return iccsense; |
136 | } | 194 | } |
137 | 195 | ||
196 | static struct nvkm_iccsense_sensor* | ||
197 | nvkm_iccsense_create_sensor(struct nvkm_iccsense *iccsense, u8 id) | ||
198 | { | ||
199 | |||
200 | struct nvkm_subdev *subdev = &iccsense->subdev; | ||
201 | struct nvkm_bios *bios = subdev->device->bios; | ||
202 | struct nvkm_i2c *i2c = subdev->device->i2c; | ||
203 | struct nvbios_extdev_func extdev; | ||
204 | struct nvkm_i2c_bus *i2c_bus; | ||
205 | struct nvkm_iccsense_sensor *sensor; | ||
206 | u8 addr; | ||
207 | |||
208 | if (!i2c || !bios || nvbios_extdev_parse(bios, id, &extdev)) | ||
209 | return NULL; | ||
210 | |||
211 | if (extdev.type == 0xff) | ||
212 | return NULL; | ||
213 | |||
214 | if (extdev.type != NVBIOS_EXTDEV_INA209 && | ||
215 | extdev.type != NVBIOS_EXTDEV_INA219 && | ||
216 | extdev.type != NVBIOS_EXTDEV_INA3221) { | ||
217 | iccsense->data_valid = false; | ||
218 | nvkm_error(subdev, "Unknown sensor type %x, power reading " | ||
219 | "disabled\n", extdev.type); | ||
220 | return NULL; | ||
221 | } | ||
222 | |||
223 | if (extdev.bus) | ||
224 | i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_SEC); | ||
225 | else | ||
226 | i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI); | ||
227 | if (!i2c_bus) | ||
228 | return NULL; | ||
229 | |||
230 | addr = extdev.addr >> 1; | ||
231 | if (!nvkm_iccsense_validate_device(&i2c_bus->i2c, addr, | ||
232 | extdev.type)) { | ||
233 | iccsense->data_valid = false; | ||
234 | nvkm_warn(subdev, "found invalid sensor id: %i, power reading" | ||
235 | "might be invalid\n", id); | ||
236 | return NULL; | ||
237 | } | ||
238 | |||
239 | sensor = kmalloc(sizeof(*sensor), GFP_KERNEL); | ||
240 | if (!sensor) | ||
241 | return NULL; | ||
242 | |||
243 | list_add_tail(&sensor->head, &iccsense->sensors); | ||
244 | sensor->id = id; | ||
245 | sensor->type = extdev.type; | ||
246 | sensor->i2c = &i2c_bus->i2c; | ||
247 | sensor->addr = addr; | ||
248 | sensor->rail_mask = 0x0; | ||
249 | return sensor; | ||
250 | } | ||
251 | |||
252 | static struct nvkm_iccsense_sensor* | ||
253 | nvkm_iccsense_get_sensor(struct nvkm_iccsense *iccsense, u8 id) | ||
254 | { | ||
255 | struct nvkm_iccsense_sensor *sensor; | ||
256 | list_for_each_entry(sensor, &iccsense->sensors, head) { | ||
257 | if (sensor->id == id) | ||
258 | return sensor; | ||
259 | } | ||
260 | return nvkm_iccsense_create_sensor(iccsense, id); | ||
261 | } | ||
262 | |||
138 | static int | 263 | static int |
139 | nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) | 264 | nvkm_iccsense_oneinit(struct nvkm_subdev *subdev) |
140 | { | 265 | { |
141 | struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); | 266 | struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); |
142 | struct nvkm_bios *bios = subdev->device->bios; | 267 | struct nvkm_bios *bios = subdev->device->bios; |
143 | struct nvkm_i2c *i2c = subdev->device->i2c; | ||
144 | struct nvbios_iccsense stbl; | 268 | struct nvbios_iccsense stbl; |
145 | int i; | 269 | int i; |
146 | 270 | ||
147 | if (!i2c || !bios || nvbios_iccsense_parse(bios, &stbl) | 271 | if (!bios || nvbios_iccsense_parse(bios, &stbl) || !stbl.nr_entry) |
148 | || !stbl.nr_entry) | ||
149 | return 0; | 272 | return 0; |
150 | 273 | ||
151 | iccsense->rails = kmalloc(sizeof(*iccsense->rails) * stbl.nr_entry, | ||
152 | GFP_KERNEL); | ||
153 | if (!iccsense->rails) | ||
154 | return -ENOMEM; | ||
155 | |||
156 | iccsense->data_valid = true; | 274 | iccsense->data_valid = true; |
157 | for (i = 0; i < stbl.nr_entry; ++i) { | 275 | for (i = 0; i < stbl.nr_entry; ++i) { |
158 | struct pwr_rail_t *r = &stbl.rail[i]; | 276 | struct pwr_rail_t *r = &stbl.rail[i]; |
159 | struct nvbios_extdev_func extdev; | ||
160 | struct nvkm_iccsense_rail *rail; | 277 | struct nvkm_iccsense_rail *rail; |
161 | struct nvkm_i2c_bus *i2c_bus; | 278 | struct nvkm_iccsense_sensor *sensor; |
162 | u8 addr; | ||
163 | 279 | ||
164 | if (!r->mode || r->resistor_mohm == 0) | 280 | if (!r->mode || r->resistor_mohm == 0) |
165 | continue; | 281 | continue; |
166 | 282 | ||
167 | if (nvbios_extdev_parse(bios, r->extdev_id, &extdev)) | 283 | sensor = nvkm_iccsense_get_sensor(iccsense, r->extdev_id); |
284 | if (!sensor) | ||
168 | continue; | 285 | continue; |
169 | 286 | ||
170 | if (extdev.type == 0xff) | 287 | rail = kmalloc(sizeof(*rail), GFP_KERNEL); |
171 | continue; | 288 | if (!rail) |
289 | return -ENOMEM; | ||
172 | 290 | ||
173 | if (extdev.bus) | 291 | switch (sensor->type) { |
174 | i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_SEC); | ||
175 | else | ||
176 | i2c_bus = nvkm_i2c_bus_find(i2c, NVKM_I2C_BUS_PRI); | ||
177 | if (!i2c_bus) | ||
178 | continue; | ||
179 | |||
180 | addr = extdev.addr >> 1; | ||
181 | if (!nvkm_iccsense_validate_device(&i2c_bus->i2c, addr, | ||
182 | extdev.type, r->rail)) { | ||
183 | iccsense->data_valid = false; | ||
184 | nvkm_warn(subdev, "found unknown or invalid rail entry" | ||
185 | " type 0x%x rail %i, power reading might be" | ||
186 | " invalid\n", extdev.type, r->rail); | ||
187 | continue; | ||
188 | } | ||
189 | |||
190 | rail = &iccsense->rails[iccsense->rail_count]; | ||
191 | switch (extdev.type) { | ||
192 | case NVBIOS_EXTDEV_INA209: | 292 | case NVBIOS_EXTDEV_INA209: |
293 | if (r->rail != 0) | ||
294 | continue; | ||
193 | rail->read = nvkm_iccsense_ina209_read; | 295 | rail->read = nvkm_iccsense_ina209_read; |
194 | break; | 296 | break; |
195 | case NVBIOS_EXTDEV_INA219: | 297 | case NVBIOS_EXTDEV_INA219: |
298 | if (r->rail != 0) | ||
299 | continue; | ||
196 | rail->read = nvkm_iccsense_ina219_read; | 300 | rail->read = nvkm_iccsense_ina219_read; |
197 | break; | 301 | break; |
198 | case NVBIOS_EXTDEV_INA3221: | 302 | case NVBIOS_EXTDEV_INA3221: |
303 | if (r->rail >= 3) | ||
304 | continue; | ||
199 | rail->read = nvkm_iccsense_ina3221_read; | 305 | rail->read = nvkm_iccsense_ina3221_read; |
200 | break; | 306 | break; |
307 | default: | ||
308 | continue; | ||
201 | } | 309 | } |
202 | 310 | ||
203 | rail->addr = addr; | 311 | sensor->rail_mask |= 1 << r->rail; |
204 | rail->rail = r->rail; | 312 | rail->sensor = sensor; |
313 | rail->idx = r->rail; | ||
205 | rail->mohm = r->resistor_mohm; | 314 | rail->mohm = r->resistor_mohm; |
206 | rail->i2c = &i2c_bus->i2c; | 315 | list_add_tail(&rail->head, &iccsense->rails); |
207 | ++iccsense->rail_count; | ||
208 | } | 316 | } |
209 | return 0; | 317 | return 0; |
210 | } | 318 | } |
211 | 319 | ||
320 | static int | ||
321 | nvkm_iccsense_init(struct nvkm_subdev *subdev) | ||
322 | { | ||
323 | struct nvkm_iccsense *iccsense = nvkm_iccsense(subdev); | ||
324 | struct nvkm_iccsense_sensor *sensor; | ||
325 | list_for_each_entry(sensor, &iccsense->sensors, head) | ||
326 | nvkm_iccsense_sensor_config(iccsense, sensor); | ||
327 | return 0; | ||
328 | } | ||
329 | |||
212 | struct nvkm_subdev_func iccsense_func = { | 330 | struct nvkm_subdev_func iccsense_func = { |
213 | .oneinit = nvkm_iccsense_oneinit, | 331 | .oneinit = nvkm_iccsense_oneinit, |
332 | .init = nvkm_iccsense_init, | ||
214 | .dtor = nvkm_iccsense_dtor, | 333 | .dtor = nvkm_iccsense_dtor, |
215 | }; | 334 | }; |
216 | 335 | ||
@@ -218,7 +337,7 @@ void | |||
218 | nvkm_iccsense_ctor(struct nvkm_device *device, int index, | 337 | nvkm_iccsense_ctor(struct nvkm_device *device, int index, |
219 | struct nvkm_iccsense *iccsense) | 338 | struct nvkm_iccsense *iccsense) |
220 | { | 339 | { |
221 | nvkm_subdev_ctor(&iccsense_func, device, index, 0, &iccsense->subdev); | 340 | nvkm_subdev_ctor(&iccsense_func, device, index, &iccsense->subdev); |
222 | } | 341 | } |
223 | 342 | ||
224 | int | 343 | int |
@@ -227,6 +346,8 @@ nvkm_iccsense_new_(struct nvkm_device *device, int index, | |||
227 | { | 346 | { |
228 | if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL))) | 347 | if (!(*iccsense = kzalloc(sizeof(**iccsense), GFP_KERNEL))) |
229 | return -ENOMEM; | 348 | return -ENOMEM; |
349 | INIT_LIST_HEAD(&(*iccsense)->sensors); | ||
350 | INIT_LIST_HEAD(&(*iccsense)->rails); | ||
230 | nvkm_iccsense_ctor(device, index, *iccsense); | 351 | nvkm_iccsense_ctor(device, index, *iccsense); |
231 | return 0; | 352 | return 0; |
232 | } | 353 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h index ed398b81e86e..b72c31d2f908 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/iccsense/priv.h | |||
@@ -2,12 +2,22 @@ | |||
2 | #define __NVKM_ICCSENSE_PRIV_H__ | 2 | #define __NVKM_ICCSENSE_PRIV_H__ |
3 | #define nvkm_iccsense(p) container_of((p), struct nvkm_iccsense, subdev) | 3 | #define nvkm_iccsense(p) container_of((p), struct nvkm_iccsense, subdev) |
4 | #include <subdev/iccsense.h> | 4 | #include <subdev/iccsense.h> |
5 | #include <subdev/bios/extdev.h> | ||
5 | 6 | ||
6 | struct nvkm_iccsense_rail { | 7 | struct nvkm_iccsense_sensor { |
7 | int (*read)(struct nvkm_iccsense *, struct nvkm_iccsense_rail *); | 8 | struct list_head head; |
9 | int id; | ||
10 | enum nvbios_extdev_type type; | ||
8 | struct i2c_adapter *i2c; | 11 | struct i2c_adapter *i2c; |
9 | u8 addr; | 12 | u8 addr; |
10 | u8 rail; | 13 | u8 rail_mask; |
14 | }; | ||
15 | |||
16 | struct nvkm_iccsense_rail { | ||
17 | struct list_head head; | ||
18 | int (*read)(struct nvkm_iccsense *, struct nvkm_iccsense_rail *); | ||
19 | struct nvkm_iccsense_sensor *sensor; | ||
20 | u8 idx; | ||
11 | u8 mohm; | 21 | u8 mohm; |
12 | }; | 22 | }; |
13 | 23 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c index 1d7dd38292b3..8ed8f65ff664 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/instmem/base.c | |||
@@ -311,7 +311,7 @@ nvkm_instmem_ctor(const struct nvkm_instmem_func *func, | |||
311 | struct nvkm_device *device, int index, | 311 | struct nvkm_device *device, int index, |
312 | struct nvkm_instmem *imem) | 312 | struct nvkm_instmem *imem) |
313 | { | 313 | { |
314 | nvkm_subdev_ctor(&nvkm_instmem, device, index, 0, &imem->subdev); | 314 | nvkm_subdev_ctor(&nvkm_instmem, device, index, &imem->subdev); |
315 | imem->func = func; | 315 | imem->func = func; |
316 | spin_lock_init(&imem->lock); | 316 | spin_lock_init(&imem->lock); |
317 | INIT_LIST_HEAD(&imem->list); | 317 | INIT_LIST_HEAD(&imem->list); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c index 85b1464c0194..39c2a38e54f7 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/ltc/base.c | |||
@@ -138,7 +138,7 @@ nvkm_ltc_new_(const struct nvkm_ltc_func *func, struct nvkm_device *device, | |||
138 | if (!(ltc = *pltc = kzalloc(sizeof(*ltc), GFP_KERNEL))) | 138 | if (!(ltc = *pltc = kzalloc(sizeof(*ltc), GFP_KERNEL))) |
139 | return -ENOMEM; | 139 | return -ENOMEM; |
140 | 140 | ||
141 | nvkm_subdev_ctor(&nvkm_ltc, device, index, 0, <c->subdev); | 141 | nvkm_subdev_ctor(&nvkm_ltc, device, index, <c->subdev); |
142 | ltc->func = func; | 142 | ltc->func = func; |
143 | ltc->zbc_min = 1; /* reserve 0 for disabled */ | 143 | ltc->zbc_min = 1; /* reserve 0 for disabled */ |
144 | ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1; | 144 | ltc->zbc_max = min(func->zbc, NVKM_LTC_MAX_ZBC_CNT) - 1; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/Kbuild index bef325dcb4d0..49695ac7be2e 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/Kbuild +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/Kbuild | |||
@@ -1,7 +1,12 @@ | |||
1 | nvkm-y += nvkm/subdev/mc/base.o | 1 | nvkm-y += nvkm/subdev/mc/base.o |
2 | nvkm-y += nvkm/subdev/mc/nv04.o | 2 | nvkm-y += nvkm/subdev/mc/nv04.o |
3 | nvkm-y += nvkm/subdev/mc/nv11.o | ||
4 | nvkm-y += nvkm/subdev/mc/nv17.o | ||
3 | nvkm-y += nvkm/subdev/mc/nv44.o | 5 | nvkm-y += nvkm/subdev/mc/nv44.o |
4 | nvkm-y += nvkm/subdev/mc/nv50.o | 6 | nvkm-y += nvkm/subdev/mc/nv50.o |
7 | nvkm-y += nvkm/subdev/mc/g84.o | ||
5 | nvkm-y += nvkm/subdev/mc/g98.o | 8 | nvkm-y += nvkm/subdev/mc/g98.o |
9 | nvkm-y += nvkm/subdev/mc/gt215.o | ||
6 | nvkm-y += nvkm/subdev/mc/gf100.o | 10 | nvkm-y += nvkm/subdev/mc/gf100.o |
11 | nvkm-y += nvkm/subdev/mc/gk104.o | ||
7 | nvkm-y += nvkm/subdev/mc/gk20a.o | 12 | nvkm-y += nvkm/subdev/mc/gk20a.o |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c index 954fbbe56c4b..350a8caa84c8 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/base.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include "priv.h" | 24 | #include "priv.h" |
25 | 25 | ||
26 | #include <core/option.h> | 26 | #include <core/option.h> |
27 | #include <subdev/top.h> | ||
27 | 28 | ||
28 | void | 29 | void |
29 | nvkm_mc_unk260(struct nvkm_mc *mc, u32 data) | 30 | nvkm_mc_unk260(struct nvkm_mc *mc, u32 data) |
@@ -58,10 +59,19 @@ nvkm_mc_intr(struct nvkm_mc *mc, bool *handled) | |||
58 | { | 59 | { |
59 | struct nvkm_device *device = mc->subdev.device; | 60 | struct nvkm_device *device = mc->subdev.device; |
60 | struct nvkm_subdev *subdev; | 61 | struct nvkm_subdev *subdev; |
61 | const struct nvkm_mc_intr *map = mc->func->intr; | 62 | const struct nvkm_mc_map *map = mc->func->intr; |
62 | u32 stat, intr; | 63 | u32 stat, intr = nvkm_mc_intr_mask(mc); |
64 | u64 subdevs; | ||
65 | |||
66 | stat = nvkm_top_intr(device->top, intr, &subdevs); | ||
67 | while (subdevs) { | ||
68 | enum nvkm_devidx subidx = __ffs64(subdevs); | ||
69 | subdev = nvkm_device_subdev(device, subidx); | ||
70 | if (subdev) | ||
71 | nvkm_subdev_intr(subdev); | ||
72 | subdevs &= ~BIT_ULL(subidx); | ||
73 | } | ||
63 | 74 | ||
64 | stat = intr = nvkm_mc_intr_mask(mc); | ||
65 | while (map->stat) { | 75 | while (map->stat) { |
66 | if (intr & map->stat) { | 76 | if (intr & map->stat) { |
67 | subdev = nvkm_device_subdev(device, map->unit); | 77 | subdev = nvkm_device_subdev(device, map->unit); |
@@ -77,6 +87,36 @@ nvkm_mc_intr(struct nvkm_mc *mc, bool *handled) | |||
77 | *handled = intr != 0; | 87 | *handled = intr != 0; |
78 | } | 88 | } |
79 | 89 | ||
90 | static void | ||
91 | nvkm_mc_reset_(struct nvkm_mc *mc, enum nvkm_devidx devidx) | ||
92 | { | ||
93 | struct nvkm_device *device = mc->subdev.device; | ||
94 | const struct nvkm_mc_map *map; | ||
95 | u64 pmc_enable; | ||
96 | |||
97 | if (!(pmc_enable = nvkm_top_reset(device->top, devidx))) { | ||
98 | for (map = mc->func->reset; map && map->stat; map++) { | ||
99 | if (map->unit == devidx) { | ||
100 | pmc_enable = map->stat; | ||
101 | break; | ||
102 | } | ||
103 | } | ||
104 | } | ||
105 | |||
106 | if (pmc_enable) { | ||
107 | nvkm_mask(device, 0x000200, pmc_enable, 0x00000000); | ||
108 | nvkm_mask(device, 0x000200, pmc_enable, pmc_enable); | ||
109 | nvkm_rd32(device, 0x000200); | ||
110 | } | ||
111 | } | ||
112 | |||
113 | void | ||
114 | nvkm_mc_reset(struct nvkm_mc *mc, enum nvkm_devidx devidx) | ||
115 | { | ||
116 | if (likely(mc)) | ||
117 | nvkm_mc_reset_(mc, devidx); | ||
118 | } | ||
119 | |||
80 | static int | 120 | static int |
81 | nvkm_mc_fini(struct nvkm_subdev *subdev, bool suspend) | 121 | nvkm_mc_fini(struct nvkm_subdev *subdev, bool suspend) |
82 | { | 122 | { |
@@ -117,7 +157,7 @@ nvkm_mc_new_(const struct nvkm_mc_func *func, struct nvkm_device *device, | |||
117 | if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL))) | 157 | if (!(mc = *pmc = kzalloc(sizeof(*mc), GFP_KERNEL))) |
118 | return -ENOMEM; | 158 | return -ENOMEM; |
119 | 159 | ||
120 | nvkm_subdev_ctor(&nvkm_mc, device, index, 0, &mc->subdev); | 160 | nvkm_subdev_ctor(&nvkm_mc, device, index, &mc->subdev); |
121 | mc->func = func; | 161 | mc->func = func; |
122 | return 0; | 162 | return 0; |
123 | } | 163 | } |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g84.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g84.c new file mode 100644 index 000000000000..5c85b47f071d --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g84.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | * Copyright 2012 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | static const struct nvkm_mc_map | ||
27 | g84_mc_reset[] = { | ||
28 | { 0x04008000, NVKM_ENGINE_BSP }, | ||
29 | { 0x02004000, NVKM_ENGINE_CIPHER }, | ||
30 | { 0x01020000, NVKM_ENGINE_VP }, | ||
31 | { 0x00400002, NVKM_ENGINE_MPEG }, | ||
32 | { 0x00201000, NVKM_ENGINE_GR }, | ||
33 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
34 | {} | ||
35 | }; | ||
36 | |||
37 | const struct nvkm_mc_map | ||
38 | g84_mc_intr[] = { | ||
39 | { 0x04000000, NVKM_ENGINE_DISP }, | ||
40 | { 0x00020000, NVKM_ENGINE_VP }, | ||
41 | { 0x00008000, NVKM_ENGINE_BSP }, | ||
42 | { 0x00004000, NVKM_ENGINE_CIPHER }, | ||
43 | { 0x00001000, NVKM_ENGINE_GR }, | ||
44 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
45 | { 0x00000001, NVKM_ENGINE_MPEG }, | ||
46 | { 0x0002d101, NVKM_SUBDEV_FB }, | ||
47 | { 0x10000000, NVKM_SUBDEV_BUS }, | ||
48 | { 0x00200000, NVKM_SUBDEV_GPIO }, | ||
49 | { 0x00200000, NVKM_SUBDEV_I2C }, | ||
50 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
51 | {}, | ||
52 | }; | ||
53 | |||
54 | static const struct nvkm_mc_func | ||
55 | g84_mc = { | ||
56 | .init = nv50_mc_init, | ||
57 | .intr = g84_mc_intr, | ||
58 | .intr_unarm = nv04_mc_intr_unarm, | ||
59 | .intr_rearm = nv04_mc_intr_rearm, | ||
60 | .intr_mask = nv04_mc_intr_mask, | ||
61 | .reset = g84_mc_reset, | ||
62 | }; | ||
63 | |||
64 | int | ||
65 | g84_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) | ||
66 | { | ||
67 | return nvkm_mc_new_(&g84_mc, device, index, pmc); | ||
68 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g98.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g98.c index 7344ad659105..0280b43cc10c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g98.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/g98.c | |||
@@ -23,24 +23,31 @@ | |||
23 | */ | 23 | */ |
24 | #include "priv.h" | 24 | #include "priv.h" |
25 | 25 | ||
26 | static const struct nvkm_mc_intr | 26 | static const struct nvkm_mc_map |
27 | g98_mc_intr[] = { | 27 | g98_mc_reset[] = { |
28 | { 0x04000000, NVKM_ENGINE_DISP }, /* DISP first, so pageflip timestamps work */ | 28 | { 0x04008000, NVKM_ENGINE_MSVLD }, |
29 | { 0x00000001, NVKM_ENGINE_MSPPP }, | 29 | { 0x02004000, NVKM_ENGINE_SEC }, |
30 | { 0x01020000, NVKM_ENGINE_MSPDEC }, | ||
31 | { 0x00400002, NVKM_ENGINE_MSPPP }, | ||
32 | { 0x00201000, NVKM_ENGINE_GR }, | ||
30 | { 0x00000100, NVKM_ENGINE_FIFO }, | 33 | { 0x00000100, NVKM_ENGINE_FIFO }, |
31 | { 0x00001000, NVKM_ENGINE_GR }, | 34 | {} |
32 | { 0x00004000, NVKM_ENGINE_SEC }, /* NV84:NVA3 */ | 35 | }; |
33 | { 0x00008000, NVKM_ENGINE_MSVLD }, | 36 | |
37 | static const struct nvkm_mc_map | ||
38 | g98_mc_intr[] = { | ||
39 | { 0x04000000, NVKM_ENGINE_DISP }, | ||
34 | { 0x00020000, NVKM_ENGINE_MSPDEC }, | 40 | { 0x00020000, NVKM_ENGINE_MSPDEC }, |
35 | { 0x00040000, NVKM_SUBDEV_PMU }, /* NVA3:NVC0 */ | 41 | { 0x00008000, NVKM_ENGINE_MSVLD }, |
36 | { 0x00080000, NVKM_SUBDEV_THERM }, /* NVA3:NVC0 */ | 42 | { 0x00004000, NVKM_ENGINE_SEC }, |
37 | { 0x00100000, NVKM_SUBDEV_TIMER }, | 43 | { 0x00001000, NVKM_ENGINE_GR }, |
38 | { 0x00200000, NVKM_SUBDEV_GPIO }, /* PMGR->GPIO */ | 44 | { 0x00000100, NVKM_ENGINE_FIFO }, |
39 | { 0x00200000, NVKM_SUBDEV_I2C }, /* PMGR->I2C/AUX */ | 45 | { 0x00000001, NVKM_ENGINE_MSPPP }, |
40 | { 0x00400000, NVKM_ENGINE_CE0 }, /* NVA3- */ | 46 | { 0x0002d101, NVKM_SUBDEV_FB }, |
41 | { 0x10000000, NVKM_SUBDEV_BUS }, | 47 | { 0x10000000, NVKM_SUBDEV_BUS }, |
42 | { 0x80000000, NVKM_ENGINE_SW }, | 48 | { 0x00200000, NVKM_SUBDEV_GPIO }, |
43 | { 0x0042d101, NVKM_SUBDEV_FB }, | 49 | { 0x00200000, NVKM_SUBDEV_I2C }, |
50 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
44 | {}, | 51 | {}, |
45 | }; | 52 | }; |
46 | 53 | ||
@@ -51,6 +58,7 @@ g98_mc = { | |||
51 | .intr_unarm = nv04_mc_intr_unarm, | 58 | .intr_unarm = nv04_mc_intr_unarm, |
52 | .intr_rearm = nv04_mc_intr_rearm, | 59 | .intr_rearm = nv04_mc_intr_rearm, |
53 | .intr_mask = nv04_mc_intr_mask, | 60 | .intr_mask = nv04_mc_intr_mask, |
61 | .reset = g98_mc_reset, | ||
54 | }; | 62 | }; |
55 | 63 | ||
56 | int | 64 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gf100.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gf100.c index 122fe69e83e4..8397e223bd43 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gf100.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gf100.c | |||
@@ -23,28 +23,38 @@ | |||
23 | */ | 23 | */ |
24 | #include "priv.h" | 24 | #include "priv.h" |
25 | 25 | ||
26 | const struct nvkm_mc_intr | 26 | static const struct nvkm_mc_map |
27 | gf100_mc_intr[] = { | 27 | gf100_mc_reset[] = { |
28 | { 0x04000000, NVKM_ENGINE_DISP }, /* DISP first, so pageflip timestamps work. */ | 28 | { 0x00020000, NVKM_ENGINE_MSPDEC }, |
29 | { 0x00000001, NVKM_ENGINE_MSPPP }, | ||
30 | { 0x00000020, NVKM_ENGINE_CE0 }, | ||
31 | { 0x00000040, NVKM_ENGINE_CE1 }, | ||
32 | { 0x00000080, NVKM_ENGINE_CE2 }, | ||
33 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
34 | { 0x00001000, NVKM_ENGINE_GR }, | ||
35 | { 0x00002000, NVKM_SUBDEV_FB }, | ||
36 | { 0x00008000, NVKM_ENGINE_MSVLD }, | 29 | { 0x00008000, NVKM_ENGINE_MSVLD }, |
37 | { 0x00040000, NVKM_SUBDEV_THERM }, | 30 | { 0x00001000, NVKM_ENGINE_GR }, |
31 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
32 | { 0x00000080, NVKM_ENGINE_CE1 }, | ||
33 | { 0x00000040, NVKM_ENGINE_CE0 }, | ||
34 | { 0x00000002, NVKM_ENGINE_MSPPP }, | ||
35 | {} | ||
36 | }; | ||
37 | |||
38 | static const struct nvkm_mc_map | ||
39 | gf100_mc_intr[] = { | ||
40 | { 0x04000000, NVKM_ENGINE_DISP }, | ||
38 | { 0x00020000, NVKM_ENGINE_MSPDEC }, | 41 | { 0x00020000, NVKM_ENGINE_MSPDEC }, |
39 | { 0x00100000, NVKM_SUBDEV_TIMER }, | 42 | { 0x00008000, NVKM_ENGINE_MSVLD }, |
40 | { 0x00200000, NVKM_SUBDEV_GPIO }, /* PMGR->GPIO */ | 43 | { 0x00001000, NVKM_ENGINE_GR }, |
41 | { 0x00200000, NVKM_SUBDEV_I2C }, /* PMGR->I2C/AUX */ | 44 | { 0x00000100, NVKM_ENGINE_FIFO }, |
42 | { 0x01000000, NVKM_SUBDEV_PMU }, | 45 | { 0x00000040, NVKM_ENGINE_CE1 }, |
43 | { 0x02000000, NVKM_SUBDEV_LTC }, | 46 | { 0x00000020, NVKM_ENGINE_CE0 }, |
44 | { 0x08000000, NVKM_SUBDEV_FB }, | 47 | { 0x00000001, NVKM_ENGINE_MSPPP }, |
45 | { 0x10000000, NVKM_SUBDEV_BUS }, | ||
46 | { 0x40000000, NVKM_SUBDEV_IBUS }, | 48 | { 0x40000000, NVKM_SUBDEV_IBUS }, |
47 | { 0x80000000, NVKM_ENGINE_SW }, | 49 | { 0x10000000, NVKM_SUBDEV_BUS }, |
50 | { 0x08000000, NVKM_SUBDEV_FB }, | ||
51 | { 0x02000000, NVKM_SUBDEV_LTC }, | ||
52 | { 0x01000000, NVKM_SUBDEV_PMU }, | ||
53 | { 0x00200000, NVKM_SUBDEV_GPIO }, | ||
54 | { 0x00200000, NVKM_SUBDEV_I2C }, | ||
55 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
56 | { 0x00040000, NVKM_SUBDEV_THERM }, | ||
57 | { 0x00002000, NVKM_SUBDEV_FB }, | ||
48 | {}, | 58 | {}, |
49 | }; | 59 | }; |
50 | 60 | ||
@@ -87,6 +97,7 @@ gf100_mc = { | |||
87 | .intr_unarm = gf100_mc_intr_unarm, | 97 | .intr_unarm = gf100_mc_intr_unarm, |
88 | .intr_rearm = gf100_mc_intr_rearm, | 98 | .intr_rearm = gf100_mc_intr_rearm, |
89 | .intr_mask = gf100_mc_intr_mask, | 99 | .intr_mask = gf100_mc_intr_mask, |
100 | .reset = gf100_mc_reset, | ||
90 | .unk260 = gf100_mc_unk260, | 101 | .unk260 = gf100_mc_unk260, |
91 | }; | 102 | }; |
92 | 103 | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk104.c new file mode 100644 index 000000000000..317464212c7d --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk104.c | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | const struct nvkm_mc_map | ||
27 | gk104_mc_reset[] = { | ||
28 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
29 | {} | ||
30 | }; | ||
31 | |||
32 | const struct nvkm_mc_map | ||
33 | gk104_mc_intr[] = { | ||
34 | { 0x04000000, NVKM_ENGINE_DISP }, | ||
35 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
36 | { 0x40000000, NVKM_SUBDEV_IBUS }, | ||
37 | { 0x10000000, NVKM_SUBDEV_BUS }, | ||
38 | { 0x08000000, NVKM_SUBDEV_FB }, | ||
39 | { 0x02000000, NVKM_SUBDEV_LTC }, | ||
40 | { 0x01000000, NVKM_SUBDEV_PMU }, | ||
41 | { 0x00200000, NVKM_SUBDEV_GPIO }, | ||
42 | { 0x00200000, NVKM_SUBDEV_I2C }, | ||
43 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
44 | { 0x00040000, NVKM_SUBDEV_THERM }, | ||
45 | { 0x00002000, NVKM_SUBDEV_FB }, | ||
46 | {}, | ||
47 | }; | ||
48 | |||
49 | static const struct nvkm_mc_func | ||
50 | gk104_mc = { | ||
51 | .init = nv50_mc_init, | ||
52 | .intr = gk104_mc_intr, | ||
53 | .intr_unarm = gf100_mc_intr_unarm, | ||
54 | .intr_rearm = gf100_mc_intr_rearm, | ||
55 | .intr_mask = gf100_mc_intr_mask, | ||
56 | .reset = gk104_mc_reset, | ||
57 | .unk260 = gf100_mc_unk260, | ||
58 | }; | ||
59 | |||
60 | int | ||
61 | gk104_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) | ||
62 | { | ||
63 | return nvkm_mc_new_(&gk104_mc, device, index, pmc); | ||
64 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk20a.c index d92efb33bcc3..60b044f517ed 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gk20a.c | |||
@@ -26,10 +26,11 @@ | |||
26 | static const struct nvkm_mc_func | 26 | static const struct nvkm_mc_func |
27 | gk20a_mc = { | 27 | gk20a_mc = { |
28 | .init = nv50_mc_init, | 28 | .init = nv50_mc_init, |
29 | .intr = gf100_mc_intr, | 29 | .intr = gk104_mc_intr, |
30 | .intr_unarm = gf100_mc_intr_unarm, | 30 | .intr_unarm = gf100_mc_intr_unarm, |
31 | .intr_rearm = gf100_mc_intr_rearm, | 31 | .intr_rearm = gf100_mc_intr_rearm, |
32 | .intr_mask = gf100_mc_intr_mask, | 32 | .intr_mask = gf100_mc_intr_mask, |
33 | .reset = gk104_mc_reset, | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | int | 36 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gt215.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gt215.c new file mode 100644 index 000000000000..aad0ba95bf18 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/gt215.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | static const struct nvkm_mc_map | ||
27 | gt215_mc_reset[] = { | ||
28 | { 0x04008000, NVKM_ENGINE_MSVLD }, | ||
29 | { 0x01020000, NVKM_ENGINE_MSPDEC }, | ||
30 | { 0x00802000, NVKM_ENGINE_CE0 }, | ||
31 | { 0x00400002, NVKM_ENGINE_MSPPP }, | ||
32 | { 0x00201000, NVKM_ENGINE_GR }, | ||
33 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
34 | {} | ||
35 | }; | ||
36 | |||
37 | static const struct nvkm_mc_map | ||
38 | gt215_mc_intr[] = { | ||
39 | { 0x04000000, NVKM_ENGINE_DISP }, | ||
40 | { 0x00400000, NVKM_ENGINE_CE0 }, | ||
41 | { 0x00020000, NVKM_ENGINE_MSPDEC }, | ||
42 | { 0x00008000, NVKM_ENGINE_MSVLD }, | ||
43 | { 0x00001000, NVKM_ENGINE_GR }, | ||
44 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
45 | { 0x00000001, NVKM_ENGINE_MSPPP }, | ||
46 | { 0x00429101, NVKM_SUBDEV_FB }, | ||
47 | { 0x10000000, NVKM_SUBDEV_BUS }, | ||
48 | { 0x00200000, NVKM_SUBDEV_GPIO }, | ||
49 | { 0x00200000, NVKM_SUBDEV_I2C }, | ||
50 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
51 | { 0x00080000, NVKM_SUBDEV_THERM }, | ||
52 | { 0x00040000, NVKM_SUBDEV_PMU }, | ||
53 | {}, | ||
54 | }; | ||
55 | |||
56 | static const struct nvkm_mc_func | ||
57 | gt215_mc = { | ||
58 | .init = nv50_mc_init, | ||
59 | .intr = gt215_mc_intr, | ||
60 | .intr_unarm = nv04_mc_intr_unarm, | ||
61 | .intr_rearm = nv04_mc_intr_rearm, | ||
62 | .intr_mask = nv04_mc_intr_mask, | ||
63 | .reset = gt215_mc_reset, | ||
64 | }; | ||
65 | |||
66 | int | ||
67 | gt215_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) | ||
68 | { | ||
69 | return nvkm_mc_new_(>215_mc, device, index, pmc); | ||
70 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv04.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv04.c index d282ec1555f8..a062624e906b 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv04.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv04.c | |||
@@ -23,18 +23,20 @@ | |||
23 | */ | 23 | */ |
24 | #include "priv.h" | 24 | #include "priv.h" |
25 | 25 | ||
26 | const struct nvkm_mc_intr | 26 | const struct nvkm_mc_map |
27 | nv04_mc_intr[] = { | 27 | nv04_mc_reset[] = { |
28 | { 0x00000001, NVKM_ENGINE_MPEG }, /* NV17- MPEG/ME */ | 28 | { 0x00001000, NVKM_ENGINE_GR }, |
29 | { 0x00000100, NVKM_ENGINE_FIFO }, | 29 | { 0x00000100, NVKM_ENGINE_FIFO }, |
30 | {} | ||
31 | }; | ||
32 | |||
33 | static const struct nvkm_mc_map | ||
34 | nv04_mc_intr[] = { | ||
35 | { 0x01010000, NVKM_ENGINE_DISP }, | ||
30 | { 0x00001000, NVKM_ENGINE_GR }, | 36 | { 0x00001000, NVKM_ENGINE_GR }, |
31 | { 0x00010000, NVKM_ENGINE_DISP }, | 37 | { 0x00000100, NVKM_ENGINE_FIFO }, |
32 | { 0x00020000, NVKM_ENGINE_VP }, /* NV40- */ | ||
33 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
34 | { 0x01000000, NVKM_ENGINE_DISP }, /* NV04- PCRTC0 */ | ||
35 | { 0x02000000, NVKM_ENGINE_DISP }, /* NV11- PCRTC1 */ | ||
36 | { 0x10000000, NVKM_SUBDEV_BUS }, | 38 | { 0x10000000, NVKM_SUBDEV_BUS }, |
37 | { 0x80000000, NVKM_ENGINE_SW }, | 39 | { 0x00100000, NVKM_SUBDEV_TIMER }, |
38 | {} | 40 | {} |
39 | }; | 41 | }; |
40 | 42 | ||
@@ -74,6 +76,7 @@ nv04_mc = { | |||
74 | .intr_unarm = nv04_mc_intr_unarm, | 76 | .intr_unarm = nv04_mc_intr_unarm, |
75 | .intr_rearm = nv04_mc_intr_rearm, | 77 | .intr_rearm = nv04_mc_intr_rearm, |
76 | .intr_mask = nv04_mc_intr_mask, | 78 | .intr_mask = nv04_mc_intr_mask, |
79 | .reset = nv04_mc_reset, | ||
77 | }; | 80 | }; |
78 | 81 | ||
79 | int | 82 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv11.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv11.c new file mode 100644 index 000000000000..55f0b9166b52 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv11.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | static const struct nvkm_mc_map | ||
27 | nv11_mc_intr[] = { | ||
28 | { 0x03010000, NVKM_ENGINE_DISP }, | ||
29 | { 0x00001000, NVKM_ENGINE_GR }, | ||
30 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
31 | { 0x10000000, NVKM_SUBDEV_BUS }, | ||
32 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
33 | {} | ||
34 | }; | ||
35 | |||
36 | static const struct nvkm_mc_func | ||
37 | nv11_mc = { | ||
38 | .init = nv04_mc_init, | ||
39 | .intr = nv11_mc_intr, | ||
40 | .intr_unarm = nv04_mc_intr_unarm, | ||
41 | .intr_rearm = nv04_mc_intr_rearm, | ||
42 | .intr_mask = nv04_mc_intr_mask, | ||
43 | .reset = nv04_mc_reset, | ||
44 | }; | ||
45 | |||
46 | int | ||
47 | nv11_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) | ||
48 | { | ||
49 | return nvkm_mc_new_(&nv11_mc, device, index, pmc); | ||
50 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv17.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv17.c new file mode 100644 index 000000000000..c40fa67f79a5 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv17.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | const struct nvkm_mc_map | ||
27 | nv17_mc_reset[] = { | ||
28 | { 0x00001000, NVKM_ENGINE_GR }, | ||
29 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
30 | { 0x00000002, NVKM_ENGINE_MPEG }, | ||
31 | {} | ||
32 | }; | ||
33 | |||
34 | const struct nvkm_mc_map | ||
35 | nv17_mc_intr[] = { | ||
36 | { 0x03010000, NVKM_ENGINE_DISP }, | ||
37 | { 0x00001000, NVKM_ENGINE_GR }, | ||
38 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
39 | { 0x00000001, NVKM_ENGINE_MPEG }, | ||
40 | { 0x10000000, NVKM_SUBDEV_BUS }, | ||
41 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
42 | {} | ||
43 | }; | ||
44 | |||
45 | static const struct nvkm_mc_func | ||
46 | nv17_mc = { | ||
47 | .init = nv04_mc_init, | ||
48 | .intr = nv17_mc_intr, | ||
49 | .intr_unarm = nv04_mc_intr_unarm, | ||
50 | .intr_rearm = nv04_mc_intr_rearm, | ||
51 | .intr_mask = nv04_mc_intr_mask, | ||
52 | .reset = nv17_mc_reset, | ||
53 | }; | ||
54 | |||
55 | int | ||
56 | nv17_mc_new(struct nvkm_device *device, int index, struct nvkm_mc **pmc) | ||
57 | { | ||
58 | return nvkm_mc_new_(&nv17_mc, device, index, pmc); | ||
59 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv44.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv44.c index 9a3ac9965be0..cc56271db564 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv44.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv44.c | |||
@@ -40,10 +40,11 @@ nv44_mc_init(struct nvkm_mc *mc) | |||
40 | static const struct nvkm_mc_func | 40 | static const struct nvkm_mc_func |
41 | nv44_mc = { | 41 | nv44_mc = { |
42 | .init = nv44_mc_init, | 42 | .init = nv44_mc_init, |
43 | .intr = nv04_mc_intr, | 43 | .intr = nv17_mc_intr, |
44 | .intr_unarm = nv04_mc_intr_unarm, | 44 | .intr_unarm = nv04_mc_intr_unarm, |
45 | .intr_rearm = nv04_mc_intr_rearm, | 45 | .intr_rearm = nv04_mc_intr_rearm, |
46 | .intr_mask = nv04_mc_intr_mask, | 46 | .intr_mask = nv04_mc_intr_mask, |
47 | .reset = nv17_mc_reset, | ||
47 | }; | 48 | }; |
48 | 49 | ||
49 | int | 50 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv50.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv50.c index 5f27d7b8fddd..343b6078580d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/nv50.c | |||
@@ -23,21 +23,17 @@ | |||
23 | */ | 23 | */ |
24 | #include "priv.h" | 24 | #include "priv.h" |
25 | 25 | ||
26 | const struct nvkm_mc_intr | 26 | static const struct nvkm_mc_map |
27 | nv50_mc_intr[] = { | 27 | nv50_mc_intr[] = { |
28 | { 0x04000000, NVKM_ENGINE_DISP }, /* DISP before FIFO, so pageflip-timestamping works! */ | 28 | { 0x04000000, NVKM_ENGINE_DISP }, |
29 | { 0x00000001, NVKM_ENGINE_MPEG }, | ||
30 | { 0x00000100, NVKM_ENGINE_FIFO }, | ||
31 | { 0x00001000, NVKM_ENGINE_GR }, | 29 | { 0x00001000, NVKM_ENGINE_GR }, |
32 | { 0x00004000, NVKM_ENGINE_CIPHER }, /* NV84- */ | 30 | { 0x00000100, NVKM_ENGINE_FIFO }, |
33 | { 0x00008000, NVKM_ENGINE_BSP }, /* NV84- */ | 31 | { 0x00000001, NVKM_ENGINE_MPEG }, |
34 | { 0x00020000, NVKM_ENGINE_VP }, /* NV84- */ | 32 | { 0x00001101, NVKM_SUBDEV_FB }, |
35 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
36 | { 0x00200000, NVKM_SUBDEV_GPIO }, /* PMGR->GPIO */ | ||
37 | { 0x00200000, NVKM_SUBDEV_I2C }, /* PMGR->I2C/AUX */ | ||
38 | { 0x10000000, NVKM_SUBDEV_BUS }, | 33 | { 0x10000000, NVKM_SUBDEV_BUS }, |
39 | { 0x80000000, NVKM_ENGINE_SW }, | 34 | { 0x00200000, NVKM_SUBDEV_GPIO }, |
40 | { 0x0002d101, NVKM_SUBDEV_FB }, | 35 | { 0x00200000, NVKM_SUBDEV_I2C }, |
36 | { 0x00100000, NVKM_SUBDEV_TIMER }, | ||
41 | {}, | 37 | {}, |
42 | }; | 38 | }; |
43 | 39 | ||
@@ -55,6 +51,7 @@ nv50_mc = { | |||
55 | .intr_unarm = nv04_mc_intr_unarm, | 51 | .intr_unarm = nv04_mc_intr_unarm, |
56 | .intr_rearm = nv04_mc_intr_rearm, | 52 | .intr_rearm = nv04_mc_intr_rearm, |
57 | .intr_mask = nv04_mc_intr_mask, | 53 | .intr_mask = nv04_mc_intr_mask, |
54 | .reset = nv17_mc_reset, | ||
58 | }; | 55 | }; |
59 | 56 | ||
60 | int | 57 | int |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h index 307f6c692287..a12038118512 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mc/priv.h | |||
@@ -6,37 +6,42 @@ | |||
6 | int nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *, | 6 | int nvkm_mc_new_(const struct nvkm_mc_func *, struct nvkm_device *, |
7 | int index, struct nvkm_mc **); | 7 | int index, struct nvkm_mc **); |
8 | 8 | ||
9 | struct nvkm_mc_intr { | 9 | struct nvkm_mc_map { |
10 | u32 stat; | 10 | u32 stat; |
11 | u32 unit; | 11 | u32 unit; |
12 | }; | 12 | }; |
13 | 13 | ||
14 | struct nvkm_mc_func { | 14 | struct nvkm_mc_func { |
15 | void (*init)(struct nvkm_mc *); | 15 | void (*init)(struct nvkm_mc *); |
16 | const struct nvkm_mc_intr *intr; | 16 | const struct nvkm_mc_map *intr; |
17 | /* disable reporting of interrupts to host */ | 17 | /* disable reporting of interrupts to host */ |
18 | void (*intr_unarm)(struct nvkm_mc *); | 18 | void (*intr_unarm)(struct nvkm_mc *); |
19 | /* enable reporting of interrupts to host */ | 19 | /* enable reporting of interrupts to host */ |
20 | void (*intr_rearm)(struct nvkm_mc *); | 20 | void (*intr_rearm)(struct nvkm_mc *); |
21 | /* retrieve pending interrupt mask (NV_PMC_INTR) */ | 21 | /* retrieve pending interrupt mask (NV_PMC_INTR) */ |
22 | u32 (*intr_mask)(struct nvkm_mc *); | 22 | u32 (*intr_mask)(struct nvkm_mc *); |
23 | const struct nvkm_mc_map *reset; | ||
23 | void (*unk260)(struct nvkm_mc *, u32); | 24 | void (*unk260)(struct nvkm_mc *, u32); |
24 | }; | 25 | }; |
25 | 26 | ||
26 | void nv04_mc_init(struct nvkm_mc *); | 27 | void nv04_mc_init(struct nvkm_mc *); |
27 | extern const struct nvkm_mc_intr nv04_mc_intr[]; | ||
28 | void nv04_mc_intr_unarm(struct nvkm_mc *); | 28 | void nv04_mc_intr_unarm(struct nvkm_mc *); |
29 | void nv04_mc_intr_rearm(struct nvkm_mc *); | 29 | void nv04_mc_intr_rearm(struct nvkm_mc *); |
30 | u32 nv04_mc_intr_mask(struct nvkm_mc *); | 30 | u32 nv04_mc_intr_mask(struct nvkm_mc *); |
31 | extern const struct nvkm_mc_map nv04_mc_reset[]; | ||
32 | |||
33 | extern const struct nvkm_mc_map nv17_mc_intr[]; | ||
34 | extern const struct nvkm_mc_map nv17_mc_reset[]; | ||
31 | 35 | ||
32 | void nv44_mc_init(struct nvkm_mc *); | 36 | void nv44_mc_init(struct nvkm_mc *); |
33 | 37 | ||
34 | void nv50_mc_init(struct nvkm_mc *); | 38 | void nv50_mc_init(struct nvkm_mc *); |
35 | extern const struct nvkm_mc_intr nv50_mc_intr[]; | ||
36 | 39 | ||
37 | extern const struct nvkm_mc_intr gf100_mc_intr[]; | ||
38 | void gf100_mc_intr_unarm(struct nvkm_mc *); | 40 | void gf100_mc_intr_unarm(struct nvkm_mc *); |
39 | void gf100_mc_intr_rearm(struct nvkm_mc *); | 41 | void gf100_mc_intr_rearm(struct nvkm_mc *); |
40 | u32 gf100_mc_intr_mask(struct nvkm_mc *); | 42 | u32 gf100_mc_intr_mask(struct nvkm_mc *); |
41 | void gf100_mc_unk260(struct nvkm_mc *, u32); | 43 | void gf100_mc_unk260(struct nvkm_mc *, u32); |
44 | |||
45 | extern const struct nvkm_mc_map gk104_mc_intr[]; | ||
46 | extern const struct nvkm_mc_map gk104_mc_reset[]; | ||
42 | #endif | 47 | #endif |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c index e04a2296ecd0..5df9669ea39c 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mmu/base.c | |||
@@ -524,7 +524,7 @@ void | |||
524 | nvkm_mmu_ctor(const struct nvkm_mmu_func *func, struct nvkm_device *device, | 524 | nvkm_mmu_ctor(const struct nvkm_mmu_func *func, struct nvkm_device *device, |
525 | int index, struct nvkm_mmu *mmu) | 525 | int index, struct nvkm_mmu *mmu) |
526 | { | 526 | { |
527 | nvkm_subdev_ctor(&nvkm_mmu, device, index, 0, &mmu->subdev); | 527 | nvkm_subdev_ctor(&nvkm_mmu, device, index, &mmu->subdev); |
528 | mmu->func = func; | 528 | mmu->func = func; |
529 | mmu->limit = func->limit; | 529 | mmu->limit = func->limit; |
530 | mmu->dma_bits = func->dma_bits; | 530 | mmu->dma_bits = func->dma_bits; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c index 9700a7625012..21b65ee254e4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/mxm/base.c | |||
@@ -241,7 +241,7 @@ nvkm_mxm_new_(struct nvkm_device *device, int index, struct nvkm_mxm **pmxm) | |||
241 | if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL))) | 241 | if (!(mxm = *pmxm = kzalloc(sizeof(*mxm), GFP_KERNEL))) |
242 | return -ENOMEM; | 242 | return -ENOMEM; |
243 | 243 | ||
244 | nvkm_subdev_ctor(&nvkm_mxm, device, index, 0, &mxm->subdev); | 244 | nvkm_subdev_ctor(&nvkm_mxm, device, index, &mxm->subdev); |
245 | 245 | ||
246 | data = mxm_table(bios, &ver, &len); | 246 | data = mxm_table(bios, &ver, &len); |
247 | if (!data || !(ver = nvbios_rd08(bios, data))) { | 247 | if (!data || !(ver = nvbios_rd08(bios, data))) { |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c index 65057c8310a2..6b0328bd7eed 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pci/base.c | |||
@@ -168,7 +168,7 @@ nvkm_pci_new_(const struct nvkm_pci_func *func, struct nvkm_device *device, | |||
168 | 168 | ||
169 | if (!(pci = *ppci = kzalloc(sizeof(**ppci), GFP_KERNEL))) | 169 | if (!(pci = *ppci = kzalloc(sizeof(**ppci), GFP_KERNEL))) |
170 | return -ENOMEM; | 170 | return -ENOMEM; |
171 | nvkm_subdev_ctor(&nvkm_pci_func, device, index, 0, &pci->subdev); | 171 | nvkm_subdev_ctor(&nvkm_pci_func, device, index, &pci->subdev); |
172 | pci->func = func; | 172 | pci->func = func; |
173 | pci->pdev = device->func->pci(device)->pdev; | 173 | pci->pdev = device->func->pci(device)->pdev; |
174 | pci->irq = -1; | 174 | pci->irq = -1; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c index d95eb8659d1b..8dd164d13043 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c | |||
@@ -40,21 +40,23 @@ nvkm_pmu_send(struct nvkm_pmu *pmu, u32 reply[2], | |||
40 | struct nvkm_device *device = subdev->device; | 40 | struct nvkm_device *device = subdev->device; |
41 | u32 addr; | 41 | u32 addr; |
42 | 42 | ||
43 | mutex_lock(&subdev->mutex); | ||
43 | /* wait for a free slot in the fifo */ | 44 | /* wait for a free slot in the fifo */ |
44 | addr = nvkm_rd32(device, 0x10a4a0); | 45 | addr = nvkm_rd32(device, 0x10a4a0); |
45 | if (nvkm_msec(device, 2000, | 46 | if (nvkm_msec(device, 2000, |
46 | u32 tmp = nvkm_rd32(device, 0x10a4b0); | 47 | u32 tmp = nvkm_rd32(device, 0x10a4b0); |
47 | if (tmp != (addr ^ 8)) | 48 | if (tmp != (addr ^ 8)) |
48 | break; | 49 | break; |
49 | ) < 0) | 50 | ) < 0) { |
51 | mutex_unlock(&subdev->mutex); | ||
50 | return -EBUSY; | 52 | return -EBUSY; |
53 | } | ||
51 | 54 | ||
52 | /* we currently only support a single process at a time waiting | 55 | /* we currently only support a single process at a time waiting |
53 | * on a synchronous reply, take the PMU mutex and tell the | 56 | * on a synchronous reply, take the PMU mutex and tell the |
54 | * receive handler what we're waiting for | 57 | * receive handler what we're waiting for |
55 | */ | 58 | */ |
56 | if (reply) { | 59 | if (reply) { |
57 | mutex_lock(&subdev->mutex); | ||
58 | pmu->recv.message = message; | 60 | pmu->recv.message = message; |
59 | pmu->recv.process = process; | 61 | pmu->recv.process = process; |
60 | } | 62 | } |
@@ -81,9 +83,9 @@ nvkm_pmu_send(struct nvkm_pmu *pmu, u32 reply[2], | |||
81 | wait_event(pmu->recv.wait, (pmu->recv.process == 0)); | 83 | wait_event(pmu->recv.wait, (pmu->recv.process == 0)); |
82 | reply[0] = pmu->recv.data[0]; | 84 | reply[0] = pmu->recv.data[0]; |
83 | reply[1] = pmu->recv.data[1]; | 85 | reply[1] = pmu->recv.data[1]; |
84 | mutex_unlock(&subdev->mutex); | ||
85 | } | 86 | } |
86 | 87 | ||
88 | mutex_unlock(&subdev->mutex); | ||
87 | return 0; | 89 | return 0; |
88 | } | 90 | } |
89 | 91 | ||
@@ -272,7 +274,7 @@ nvkm_pmu_new_(const struct nvkm_pmu_func *func, struct nvkm_device *device, | |||
272 | struct nvkm_pmu *pmu; | 274 | struct nvkm_pmu *pmu; |
273 | if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL))) | 275 | if (!(pmu = *ppmu = kzalloc(sizeof(*pmu), GFP_KERNEL))) |
274 | return -ENOMEM; | 276 | return -ENOMEM; |
275 | nvkm_subdev_ctor(&nvkm_pmu, device, index, 0, &pmu->subdev); | 277 | nvkm_subdev_ctor(&nvkm_pmu, device, index, &pmu->subdev); |
276 | pmu->func = func; | 278 | pmu->func = func; |
277 | INIT_WORK(&pmu->recv.work, nvkm_pmu_recv); | 279 | INIT_WORK(&pmu->recv.work, nvkm_pmu_recv); |
278 | init_waitqueue_head(&pmu->recv.wait); | 280 | init_waitqueue_head(&pmu->recv.wait); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c index 6689d0290a7e..f996d90c9f0d 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/gk20a.c | |||
@@ -220,7 +220,7 @@ gk20a_pmu_new(struct nvkm_device *device, int index, struct nvkm_pmu **ppmu) | |||
220 | pmu->base.func = &func; | 220 | pmu->base.func = &func; |
221 | *ppmu = &pmu->base; | 221 | *ppmu = &pmu->base; |
222 | 222 | ||
223 | nvkm_subdev_ctor(&gk20a_pmu, device, index, 0, &pmu->base.subdev); | 223 | nvkm_subdev_ctor(&gk20a_pmu, device, index, &pmu->base.subdev); |
224 | pmu->data = &gk20a_dvfs_data; | 224 | pmu->data = &gk20a_dvfs_data; |
225 | nvkm_alarm_init(&pmu->alarm, gk20a_pmu_dvfs_work); | 225 | nvkm_alarm_init(&pmu->alarm, gk20a_pmu_dvfs_work); |
226 | return 0; | 226 | return 0; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c index 520facf9bc07..213fdba6cfa0 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/secboot/base.c | |||
@@ -264,7 +264,7 @@ nvkm_secboot_ctor(const struct nvkm_secboot_func *func, | |||
264 | { | 264 | { |
265 | unsigned long fid; | 265 | unsigned long fid; |
266 | 266 | ||
267 | nvkm_subdev_ctor(&nvkm_secboot, device, index, 0, &sb->subdev); | 267 | nvkm_subdev_ctor(&nvkm_secboot, device, index, &sb->subdev); |
268 | sb->func = func; | 268 | sb->func = func; |
269 | 269 | ||
270 | /* setup the performing falcon's base address and masks */ | 270 | /* setup the performing falcon's base address and masks */ |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c index 949dc6101a58..8894fee30cbc 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/therm/base.c | |||
@@ -366,7 +366,7 @@ nvkm_therm_new_(const struct nvkm_therm_func *func, struct nvkm_device *device, | |||
366 | if (!(therm = *ptherm = kzalloc(sizeof(*therm), GFP_KERNEL))) | 366 | if (!(therm = *ptherm = kzalloc(sizeof(*therm), GFP_KERNEL))) |
367 | return -ENOMEM; | 367 | return -ENOMEM; |
368 | 368 | ||
369 | nvkm_subdev_ctor(&nvkm_therm, device, index, 0, &therm->subdev); | 369 | nvkm_subdev_ctor(&nvkm_therm, device, index, &therm->subdev); |
370 | therm->func = func; | 370 | therm->func = func; |
371 | 371 | ||
372 | nvkm_alarm_init(&therm->alarm, nvkm_therm_alarm); | 372 | nvkm_alarm_init(&therm->alarm, nvkm_therm_alarm); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c index d4dae1f12d62..07dc82bfe346 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/timer/base.c | |||
@@ -143,7 +143,7 @@ nvkm_timer_new_(const struct nvkm_timer_func *func, struct nvkm_device *device, | |||
143 | if (!(tmr = *ptmr = kzalloc(sizeof(*tmr), GFP_KERNEL))) | 143 | if (!(tmr = *ptmr = kzalloc(sizeof(*tmr), GFP_KERNEL))) |
144 | return -ENOMEM; | 144 | return -ENOMEM; |
145 | 145 | ||
146 | nvkm_subdev_ctor(&nvkm_timer, device, index, 0, &tmr->subdev); | 146 | nvkm_subdev_ctor(&nvkm_timer, device, index, &tmr->subdev); |
147 | tmr->func = func; | 147 | tmr->func = func; |
148 | INIT_LIST_HEAD(&tmr->alarms); | 148 | INIT_LIST_HEAD(&tmr->alarms); |
149 | spin_lock_init(&tmr->lock); | 149 | spin_lock_init(&tmr->lock); |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/Kbuild b/drivers/gpu/drm/nouveau/nvkm/subdev/top/Kbuild new file mode 100644 index 000000000000..1078401cdcea --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/Kbuild | |||
@@ -0,0 +1,2 @@ | |||
1 | nvkm-y += nvkm/subdev/top/base.o | ||
2 | nvkm-y += nvkm/subdev/top/gk104.o | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c new file mode 100644 index 000000000000..a1b264664aad --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/base.c | |||
@@ -0,0 +1,148 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | struct nvkm_top_device * | ||
27 | nvkm_top_device_new(struct nvkm_top *top) | ||
28 | { | ||
29 | struct nvkm_top_device *info = kmalloc(sizeof(*info), GFP_KERNEL); | ||
30 | if (info) { | ||
31 | info->index = NVKM_SUBDEV_NR; | ||
32 | info->addr = 0; | ||
33 | info->fault = -1; | ||
34 | info->engine = -1; | ||
35 | info->runlist = -1; | ||
36 | info->reset = -1; | ||
37 | info->intr = -1; | ||
38 | list_add_tail(&info->head, &top->device); | ||
39 | } | ||
40 | return info; | ||
41 | } | ||
42 | |||
43 | u32 | ||
44 | nvkm_top_reset(struct nvkm_top *top, enum nvkm_devidx index) | ||
45 | { | ||
46 | struct nvkm_top_device *info; | ||
47 | |||
48 | if (top) { | ||
49 | list_for_each_entry(info, &top->device, head) { | ||
50 | if (info->index == index && info->reset >= 0) | ||
51 | return BIT(info->reset); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | u32 | ||
59 | nvkm_top_intr(struct nvkm_top *top, u32 intr, u64 *psubdevs) | ||
60 | { | ||
61 | struct nvkm_top_device *info; | ||
62 | u64 subdevs = 0; | ||
63 | u32 handled = 0; | ||
64 | |||
65 | if (top) { | ||
66 | list_for_each_entry(info, &top->device, head) { | ||
67 | if (info->index != NVKM_SUBDEV_NR && info->intr >= 0) { | ||
68 | if (intr & BIT(info->intr)) { | ||
69 | subdevs |= BIT_ULL(info->index); | ||
70 | handled |= BIT(info->intr); | ||
71 | } | ||
72 | } | ||
73 | } | ||
74 | } | ||
75 | |||
76 | *psubdevs = subdevs; | ||
77 | return intr & ~handled; | ||
78 | } | ||
79 | |||
80 | enum nvkm_devidx | ||
81 | nvkm_top_fault(struct nvkm_top *top, int fault) | ||
82 | { | ||
83 | struct nvkm_top_device *info; | ||
84 | |||
85 | list_for_each_entry(info, &top->device, head) { | ||
86 | if (info->fault == fault) | ||
87 | return info->index; | ||
88 | } | ||
89 | |||
90 | return NVKM_SUBDEV_NR; | ||
91 | } | ||
92 | |||
93 | enum nvkm_devidx | ||
94 | nvkm_top_engine(struct nvkm_top *top, int index, int *runl, int *engn) | ||
95 | { | ||
96 | struct nvkm_top_device *info; | ||
97 | int n = 0; | ||
98 | |||
99 | list_for_each_entry(info, &top->device, head) { | ||
100 | if (info->engine >= 0 && info->runlist >= 0 && n++ == index) { | ||
101 | *runl = info->runlist; | ||
102 | *engn = info->engine; | ||
103 | return info->index; | ||
104 | } | ||
105 | } | ||
106 | |||
107 | return -ENODEV; | ||
108 | } | ||
109 | |||
110 | static int | ||
111 | nvkm_top_oneinit(struct nvkm_subdev *subdev) | ||
112 | { | ||
113 | struct nvkm_top *top = nvkm_top(subdev); | ||
114 | return top->func->oneinit(top); | ||
115 | } | ||
116 | |||
117 | static void * | ||
118 | nvkm_top_dtor(struct nvkm_subdev *subdev) | ||
119 | { | ||
120 | struct nvkm_top *top = nvkm_top(subdev); | ||
121 | struct nvkm_top_device *info, *temp; | ||
122 | |||
123 | list_for_each_entry_safe(info, temp, &top->device, head) { | ||
124 | list_del(&info->head); | ||
125 | kfree(info); | ||
126 | } | ||
127 | |||
128 | return top; | ||
129 | } | ||
130 | |||
131 | static const struct nvkm_subdev_func | ||
132 | nvkm_top = { | ||
133 | .dtor = nvkm_top_dtor, | ||
134 | .oneinit = nvkm_top_oneinit, | ||
135 | }; | ||
136 | |||
137 | int | ||
138 | nvkm_top_new_(const struct nvkm_top_func *func, struct nvkm_device *device, | ||
139 | int index, struct nvkm_top **ptop) | ||
140 | { | ||
141 | struct nvkm_top *top; | ||
142 | if (!(top = *ptop = kzalloc(sizeof(*top), GFP_KERNEL))) | ||
143 | return -ENOMEM; | ||
144 | nvkm_subdev_ctor(&nvkm_top, device, index, &top->subdev); | ||
145 | top->func = func; | ||
146 | INIT_LIST_HEAD(&top->device); | ||
147 | return 0; | ||
148 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c new file mode 100644 index 000000000000..e06acc340e99 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/gk104.c | |||
@@ -0,0 +1,110 @@ | |||
1 | /* | ||
2 | * Copyright 2016 Red Hat Inc. | ||
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 shall be included in | ||
12 | * all copies or substantial portions of the Software. | ||
13 | * | ||
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
17 | * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
18 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
20 | * OTHER DEALINGS IN THE SOFTWARE. | ||
21 | * | ||
22 | * Authors: Ben Skeggs <bskeggs@redhat.com> | ||
23 | */ | ||
24 | #include "priv.h" | ||
25 | |||
26 | static int | ||
27 | gk104_top_oneinit(struct nvkm_top *top) | ||
28 | { | ||
29 | struct nvkm_subdev *subdev = &top->subdev; | ||
30 | struct nvkm_device *device = subdev->device; | ||
31 | struct nvkm_top_device *info = NULL; | ||
32 | u32 data, type; | ||
33 | int i; | ||
34 | |||
35 | for (i = 0; i < 64; i++) { | ||
36 | if (!info) { | ||
37 | if (!(info = nvkm_top_device_new(top))) | ||
38 | return -ENOMEM; | ||
39 | type = ~0; | ||
40 | } | ||
41 | |||
42 | data = nvkm_rd32(device, 0x022700 + (i * 0x04)); | ||
43 | nvkm_trace(subdev, "%02x: %08x\n", i, data); | ||
44 | switch (data & 0x00000003) { | ||
45 | case 0x00000000: /* NOT_VALID */ | ||
46 | continue; | ||
47 | case 0x00000001: /* DATA */ | ||
48 | info->addr = (data & 0x00fff000); | ||
49 | info->fault = (data & 0x000000f8) >> 3; | ||
50 | break; | ||
51 | case 0x00000002: /* ENUM */ | ||
52 | if (data & 0x00000020) | ||
53 | info->engine = (data & 0x3c000000) >> 26; | ||
54 | if (data & 0x00000010) | ||
55 | info->runlist = (data & 0x01e00000) >> 21; | ||
56 | if (data & 0x00000008) | ||
57 | info->intr = (data & 0x000f8000) >> 15; | ||
58 | if (data & 0x00000004) | ||
59 | info->reset = (data & 0x00003e00) >> 9; | ||
60 | break; | ||
61 | case 0x00000003: /* ENGINE_TYPE */ | ||
62 | type = (data & 0x7ffffffc) >> 2; | ||
63 | break; | ||
64 | } | ||
65 | |||
66 | if (data & 0x80000000) | ||
67 | continue; | ||
68 | |||
69 | /* Translate engine type to NVKM engine identifier. */ | ||
70 | switch (type) { | ||
71 | case 0x00000000: info->index = NVKM_ENGINE_GR; break; | ||
72 | case 0x00000001: info->index = NVKM_ENGINE_CE0; break; | ||
73 | case 0x00000002: info->index = NVKM_ENGINE_CE1; break; | ||
74 | case 0x00000003: info->index = NVKM_ENGINE_CE2; break; | ||
75 | case 0x00000008: info->index = NVKM_ENGINE_MSPDEC; break; | ||
76 | case 0x00000009: info->index = NVKM_ENGINE_MSPPP; break; | ||
77 | case 0x0000000a: info->index = NVKM_ENGINE_MSVLD; break; | ||
78 | case 0x0000000b: info->index = NVKM_ENGINE_MSENC; break; | ||
79 | case 0x0000000c: info->index = NVKM_ENGINE_VIC; break; | ||
80 | case 0x0000000d: info->index = NVKM_ENGINE_SEC; break; | ||
81 | case 0x0000000e: info->index = NVKM_ENGINE_NVENC0; break; | ||
82 | case 0x0000000f: info->index = NVKM_ENGINE_NVENC1; break; | ||
83 | case 0x00000010: info->index = NVKM_ENGINE_NVDEC; break; | ||
84 | break; | ||
85 | default: | ||
86 | break; | ||
87 | } | ||
88 | |||
89 | nvkm_debug(subdev, "%02x (%8s): addr %06x fault %2d engine %2d " | ||
90 | "runlist %2d intr %2d reset %2d\n", type, | ||
91 | info->index == NVKM_SUBDEV_NR ? NULL : | ||
92 | nvkm_subdev_name[info->index], | ||
93 | info->addr, info->fault, info->engine, info->runlist, | ||
94 | info->intr, info->reset); | ||
95 | info = NULL; | ||
96 | } | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | static const struct nvkm_top_func | ||
102 | gk104_top = { | ||
103 | .oneinit = gk104_top_oneinit, | ||
104 | }; | ||
105 | |||
106 | int | ||
107 | gk104_top_new(struct nvkm_device *device, int index, struct nvkm_top **ptop) | ||
108 | { | ||
109 | return nvkm_top_new_(&gk104_top, device, index, ptop); | ||
110 | } | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/top/priv.h b/drivers/gpu/drm/nouveau/nvkm/subdev/top/priv.h new file mode 100644 index 000000000000..adb3ed03d937 --- /dev/null +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/top/priv.h | |||
@@ -0,0 +1,25 @@ | |||
1 | #ifndef __NVKM_TOP_PRIV_H__ | ||
2 | #define __NVKM_TOP_PRIV_H__ | ||
3 | #define nvkm_top(p) container_of((p), struct nvkm_top, subdev) | ||
4 | #include <subdev/top.h> | ||
5 | |||
6 | struct nvkm_top_func { | ||
7 | int (*oneinit)(struct nvkm_top *); | ||
8 | }; | ||
9 | |||
10 | int nvkm_top_new_(const struct nvkm_top_func *, struct nvkm_device *, | ||
11 | int, struct nvkm_top **); | ||
12 | |||
13 | struct nvkm_top_device { | ||
14 | enum nvkm_devidx index; | ||
15 | u32 addr; | ||
16 | int fault; | ||
17 | int engine; | ||
18 | int runlist; | ||
19 | int reset; | ||
20 | int intr; | ||
21 | struct list_head head; | ||
22 | }; | ||
23 | |||
24 | struct nvkm_top_device *nvkm_top_device_new(struct nvkm_top *); | ||
25 | #endif | ||
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c index 50b5649ad1a4..6b2d7531a7ff 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/base.c | |||
@@ -177,7 +177,7 @@ nvkm_volt_ctor(const struct nvkm_volt_func *func, struct nvkm_device *device, | |||
177 | struct nvkm_bios *bios = device->bios; | 177 | struct nvkm_bios *bios = device->bios; |
178 | int i; | 178 | int i; |
179 | 179 | ||
180 | nvkm_subdev_ctor(&nvkm_volt, device, index, 0, &volt->subdev); | 180 | nvkm_subdev_ctor(&nvkm_volt, device, index, &volt->subdev); |
181 | volt->func = func; | 181 | volt->func = func; |
182 | 182 | ||
183 | /* Assuming the non-bios device should build the voltage table later */ | 183 | /* Assuming the non-bios device should build the voltage table later */ |
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c index b735173a18ff..420bd84d8483 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gk104.c | |||
@@ -56,7 +56,7 @@ gk104_volt_set(struct nvkm_volt *base, u32 uv) | |||
56 | 56 | ||
57 | /* the blob uses this crystal frequency, let's use it too. */ | 57 | /* the blob uses this crystal frequency, let's use it too. */ |
58 | div = 27648000 / bios->pwm_freq; | 58 | div = 27648000 / bios->pwm_freq; |
59 | duty = (uv - bios->base) * div / bios->pwm_range; | 59 | duty = DIV_ROUND_UP((uv - bios->base) * div, bios->pwm_range); |
60 | 60 | ||
61 | nvkm_wr32(device, 0x20340, div); | 61 | nvkm_wr32(device, 0x20340, div); |
62 | nvkm_wr32(device, 0x20344, 0x80000000 | duty); | 62 | nvkm_wr32(device, 0x20344, 0x80000000 | duty); |