aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2014-08-09 14:10:29 -0400
committerBen Skeggs <bskeggs@redhat.com>2014-08-09 15:28:14 -0400
commitaa2d58c33a784d6d8daef66a493502bd8fe325af (patch)
tree863c9ddd6a34c5762aea36469744ea1e0a8d2a74
parent694c6caf92615828dbfd3fc30e937c8f54d2ac93 (diff)
drm/gf100-/gr: unhardcode bundle cb config
Should be the same values as before, except: GF117 has smaller buffer allocated, as per register setup. GK20A now uses values from Tegra driver, not GK104's. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxgk110b.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c4
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxgm107.c30
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnv108.c10
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c21
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h13
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c7
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc4.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c8
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c2
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c28
-rw-r--r--drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c10
13 files changed, 100 insertions, 41 deletions
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk110b.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk110b.c
index 4ae70c11b6e6..b3f5ea66566e 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk110b.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk110b.c
@@ -91,4 +91,8 @@ gk110b_grctx_oclass = &(struct nvc0_grctx_oclass) {
91 .ppc = nvf0_grctx_pack_ppc, 91 .ppc = nvf0_grctx_pack_ppc,
92 .icmd = nvf0_grctx_pack_icmd, 92 .icmd = nvf0_grctx_pack_icmd,
93 .mthd = nvf0_grctx_pack_mthd, 93 .mthd = nvf0_grctx_pack_mthd,
94 .bundle = nve4_grctx_generate_bundle,
95 .bundle_size = 0x3000,
96 .bundle_min_gpm_fifo_depth = 0x180,
97 .bundle_token_limit = 0x600,
94}.base; 98}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c
index 224ee0287ab7..1ec78bdca4b1 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxgk20a.c
@@ -50,4 +50,8 @@ gk20a_grctx_oclass = &(struct nvc0_grctx_oclass) {
50 .ppc = nve4_grctx_pack_ppc, 50 .ppc = nve4_grctx_pack_ppc,
51 .icmd = nve4_grctx_pack_icmd, 51 .icmd = nve4_grctx_pack_icmd,
52 .mthd = gk20a_grctx_pack_mthd, 52 .mthd = gk20a_grctx_pack_mthd,
53 .bundle = nve4_grctx_generate_bundle,
54 .bundle_size = 0x1800,
55 .bundle_min_gpm_fifo_depth = 0x62,
56 .bundle_token_limit = 0x100,
53}.base; 57}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxgm107.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxgm107.c
index b0d0fb2f4d08..a4f008855966 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxgm107.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxgm107.c
@@ -859,9 +859,25 @@ gm107_grctx_pack_ppc[] = {
859 ******************************************************************************/ 859 ******************************************************************************/
860 860
861static void 861static void
862gm107_grctx_generate_bundle(struct nvc0_grctx *info)
863{
864 const struct nvc0_grctx_oclass *impl = nvc0_grctx_impl(info->priv);
865 const u32 state_limit = min(impl->bundle_min_gpm_fifo_depth,
866 impl->bundle_size / 0x20);
867 const u32 token_limit = impl->bundle_token_limit;
868 const u32 access = NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS;
869 const int s = 8;
870 const int b = mmio_vram(info, impl->bundle_size, (1 << s), access);
871 mmio_refn(info, 0x408004, 0x00000000, s, b);
872 mmio_refn(info, 0x408008, 0x80000000 | (impl->bundle_size >> s), 0, b);
873 mmio_refn(info, 0x418e24, 0x00000000, s, b);
874 mmio_refn(info, 0x418e28, 0x80000000 | (impl->bundle_size >> s), 0, b);
875 mmio_wr32(info, 0x4064c8, (state_limit << 16) | token_limit);
876}
877
878static void
862gm107_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) 879gm107_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
863{ 880{
864 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
865 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 881 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
866 mmio_data(0x200000, 0x1000, NV_MEM_ACCESS_RW); 882 mmio_data(0x200000, 0x1000, NV_MEM_ACCESS_RW);
867 883
@@ -872,13 +888,6 @@ gm107_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
872 mmio_list(0x4064cc, 0x80000000, 0, 0); 888 mmio_list(0x4064cc, 0x80000000, 0, 0);
873 mmio_list(0x418e30, 0x80000000, 0, 0); 889 mmio_list(0x418e30, 0x80000000, 0, 0);
874 890
875 mmio_list(0x408004, 0x00000000, 8, 0);
876 mmio_list(0x408008, 0x80000030, 0, 0);
877 mmio_list(0x418e24, 0x00000000, 8, 0);
878 mmio_list(0x418e28, 0x80000030, 0, 0);
879
880 mmio_list(0x4064c8, 0x018002c0, 0, 0);
881
882 mmio_list(0x418810, 0x80000000, 12, 2); 891 mmio_list(0x418810, 0x80000000, 12, 2);
883 mmio_list(0x419848, 0x10000000, 12, 2); 892 mmio_list(0x419848, 0x10000000, 12, 2);
884 mmio_list(0x419c2c, 0x10000000, 12, 2); 893 mmio_list(0x419c2c, 0x10000000, 12, 2);
@@ -934,6 +943,7 @@ gm107_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
934 943
935 nv_wr32(priv, 0x404154, 0x00000000); 944 nv_wr32(priv, 0x404154, 0x00000000);
936 945
946 oclass->bundle(info);
937 oclass->mods(priv, info); 947 oclass->mods(priv, info);
938 oclass->unkn(priv); 948 oclass->unkn(priv);
939 949
@@ -988,4 +998,8 @@ gm107_grctx_oclass = &(struct nvc0_grctx_oclass) {
988 .ppc = gm107_grctx_pack_ppc, 998 .ppc = gm107_grctx_pack_ppc,
989 .icmd = gm107_grctx_pack_icmd, 999 .icmd = gm107_grctx_pack_icmd,
990 .mthd = gm107_grctx_pack_mthd, 1000 .mthd = gm107_grctx_pack_mthd,
1001 .bundle = gm107_grctx_generate_bundle,
1002 .bundle_size = 0x3000,
1003 .bundle_min_gpm_fifo_depth = 0x180,
1004 .bundle_token_limit = 0x2c0,
991}.base; 1005}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv108.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv108.c
index 8de4a4291548..c9eb8ed46d12 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv108.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnv108.c
@@ -538,7 +538,6 @@ nv108_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
538 u32 offset; 538 u32 offset;
539 int gpc; 539 int gpc;
540 540
541 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
542 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 541 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
543 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW); 542 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
544 mmio_list(0x40800c, 0x00000000, 8, 1); 543 mmio_list(0x40800c, 0x00000000, 8, 1);
@@ -546,11 +545,6 @@ nv108_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
546 mmio_list(0x419004, 0x00000000, 8, 1); 545 mmio_list(0x419004, 0x00000000, 8, 1);
547 mmio_list(0x419008, 0x00000000, 0, 0); 546 mmio_list(0x419008, 0x00000000, 0, 0);
548 mmio_list(0x4064cc, 0x80000000, 0, 0); 547 mmio_list(0x4064cc, 0x80000000, 0, 0);
549 mmio_list(0x408004, 0x00000000, 8, 0);
550 mmio_list(0x408008, 0x80000030, 0, 0);
551 mmio_list(0x418808, 0x00000000, 8, 0);
552 mmio_list(0x41880c, 0x80000030, 0, 0);
553 mmio_list(0x4064c8, 0x00c20200, 0, 0);
554 mmio_list(0x418810, 0x80000000, 12, 2); 548 mmio_list(0x418810, 0x80000000, 12, 2);
555 mmio_list(0x419848, 0x10000000, 12, 2); 549 mmio_list(0x419848, 0x10000000, 12, 2);
556 550
@@ -596,4 +590,8 @@ nv108_grctx_oclass = &(struct nvc0_grctx_oclass) {
596 .ppc = nv108_grctx_pack_ppc, 590 .ppc = nv108_grctx_pack_ppc,
597 .icmd = nv108_grctx_pack_icmd, 591 .icmd = nv108_grctx_pack_icmd,
598 .mthd = nvf0_grctx_pack_mthd, 592 .mthd = nvf0_grctx_pack_mthd,
593 .bundle = nve4_grctx_generate_bundle,
594 .bundle_size = 0x3000,
595 .bundle_min_gpm_fifo_depth = 0xc2,
596 .bundle_token_limit = 0x200,
599}.base; 597}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
index a0514d3de615..4186a0a2baa5 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.c
@@ -1021,25 +1021,33 @@ nvc0_grctx_mmio_item(struct nvc0_grctx *info, u32 addr, u32 data,
1021} 1021}
1022 1022
1023void 1023void
1024nvc0_grctx_generate_bundle(struct nvc0_grctx *info)
1025{
1026 const struct nvc0_grctx_oclass *impl = nvc0_grctx_impl(info->priv);
1027 const u32 access = NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS;
1028 const int s = 8;
1029 const int b = mmio_vram(info, impl->bundle_size, (1 << s), access);
1030 mmio_refn(info, 0x408004, 0x00000000, s, b);
1031 mmio_refn(info, 0x408008, 0x80000000 | (impl->bundle_size >> s), 0, b);
1032 mmio_refn(info, 0x418808, 0x00000000, s, b);
1033 mmio_refn(info, 0x41880c, 0x80000000 | (impl->bundle_size >> s), 0, b);
1034}
1035
1036void
1024nvc0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) 1037nvc0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
1025{ 1038{
1026 int gpc, tpc; 1039 int gpc, tpc;
1027 u32 offset; 1040 u32 offset;
1028 1041
1029 mmio_data(0x002000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
1030 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 1042 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
1031 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW); 1043 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
1032 1044
1033 mmio_list(0x408004, 0x00000000, 8, 0);
1034 mmio_list(0x408008, 0x80000018, 0, 0);
1035 mmio_list(0x40800c, 0x00000000, 8, 1); 1045 mmio_list(0x40800c, 0x00000000, 8, 1);
1036 mmio_list(0x408010, 0x80000000, 0, 0); 1046 mmio_list(0x408010, 0x80000000, 0, 0);
1037 mmio_list(0x418810, 0x80000000, 12, 2); 1047 mmio_list(0x418810, 0x80000000, 12, 2);
1038 mmio_list(0x419848, 0x10000000, 12, 2); 1048 mmio_list(0x419848, 0x10000000, 12, 2);
1039 mmio_list(0x419004, 0x00000000, 8, 1); 1049 mmio_list(0x419004, 0x00000000, 8, 1);
1040 mmio_list(0x419008, 0x00000000, 0, 0); 1050 mmio_list(0x419008, 0x00000000, 0, 0);
1041 mmio_list(0x418808, 0x00000000, 8, 0);
1042 mmio_list(0x41880c, 0x80000018, 0, 0);
1043 1051
1044 mmio_list(0x405830, 0x02180000, 0, 0); 1052 mmio_list(0x405830, 0x02180000, 0, 0);
1045 1053
@@ -1218,6 +1226,7 @@ nvc0_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
1218 1226
1219 nv_wr32(priv, 0x404154, 0x00000000); 1227 nv_wr32(priv, 0x404154, 0x00000000);
1220 1228
1229 oclass->bundle(info);
1221 oclass->mods(priv, info); 1230 oclass->mods(priv, info);
1222 oclass->unkn(priv); 1231 oclass->unkn(priv);
1223 1232
@@ -1354,4 +1363,6 @@ nvc0_grctx_oclass = &(struct nvc0_grctx_oclass) {
1354 .tpc = nvc0_grctx_pack_tpc, 1363 .tpc = nvc0_grctx_pack_tpc,
1355 .icmd = nvc0_grctx_pack_icmd, 1364 .icmd = nvc0_grctx_pack_icmd,
1356 .mthd = nvc0_grctx_pack_mthd, 1365 .mthd = nvc0_grctx_pack_mthd,
1366 .bundle = nvc0_grctx_generate_bundle,
1367 .bundle_size = 0x1800,
1357}.base; 1368}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h
index 0579542cde3a..26744ac89fb7 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc0.h
@@ -39,11 +39,23 @@ struct nvc0_grctx_oclass {
39 /* indirect context data, generated with icmds/mthds */ 39 /* indirect context data, generated with icmds/mthds */
40 const struct nvc0_graph_pack *icmd; 40 const struct nvc0_graph_pack *icmd;
41 const struct nvc0_graph_pack *mthd; 41 const struct nvc0_graph_pack *mthd;
42 /* bundle circular buffer */
43 void (*bundle)(struct nvc0_grctx *);
44 u32 bundle_size;
45 u32 bundle_min_gpm_fifo_depth;
46 u32 bundle_token_limit;
42}; 47};
43 48
49static inline const struct nvc0_grctx_oclass *
50nvc0_grctx_impl(struct nvc0_graph_priv *priv)
51{
52 return (void *)nv_engine(priv)->cclass;
53}
54
44extern struct nouveau_oclass *nvc0_grctx_oclass; 55extern struct nouveau_oclass *nvc0_grctx_oclass;
45int nvc0_grctx_generate(struct nvc0_graph_priv *); 56int nvc0_grctx_generate(struct nvc0_graph_priv *);
46void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *); 57void nvc0_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
58void nvc0_grctx_generate_bundle(struct nvc0_grctx *);
47void nvc0_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *); 59void nvc0_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
48void nvc0_grctx_generate_unkn(struct nvc0_graph_priv *); 60void nvc0_grctx_generate_unkn(struct nvc0_graph_priv *);
49void nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *); 61void nvc0_grctx_generate_tpcid(struct nvc0_graph_priv *);
@@ -64,6 +76,7 @@ extern struct nouveau_oclass *nvd9_grctx_oclass;
64extern struct nouveau_oclass *nve4_grctx_oclass; 76extern struct nouveau_oclass *nve4_grctx_oclass;
65extern struct nouveau_oclass *gk20a_grctx_oclass; 77extern struct nouveau_oclass *gk20a_grctx_oclass;
66void nve4_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *); 78void nve4_grctx_generate_main(struct nvc0_graph_priv *, struct nvc0_grctx *);
79void nve4_grctx_generate_bundle(struct nvc0_grctx *);
67void nve4_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *); 80void nve4_grctx_generate_mods(struct nvc0_graph_priv *, struct nvc0_grctx *);
68void nve4_grctx_generate_unkn(struct nvc0_graph_priv *); 81void nve4_grctx_generate_unkn(struct nvc0_graph_priv *);
69void nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *); 82void nve4_grctx_generate_r418bb8(struct nvc0_graph_priv *);
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c
index 24a92c569c0a..9043965c27a4 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc1.c
@@ -732,19 +732,14 @@ nvc1_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
732 int gpc, tpc; 732 int gpc, tpc;
733 u32 offset; 733 u32 offset;
734 734
735 mmio_data(0x002000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
736 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 735 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
737 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW); 736 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
738 mmio_list(0x408004, 0x00000000, 8, 0);
739 mmio_list(0x408008, 0x80000018, 0, 0);
740 mmio_list(0x40800c, 0x00000000, 8, 1); 737 mmio_list(0x40800c, 0x00000000, 8, 1);
741 mmio_list(0x408010, 0x80000000, 0, 0); 738 mmio_list(0x408010, 0x80000000, 0, 0);
742 mmio_list(0x418810, 0x80000000, 12, 2); 739 mmio_list(0x418810, 0x80000000, 12, 2);
743 mmio_list(0x419848, 0x10000000, 12, 2); 740 mmio_list(0x419848, 0x10000000, 12, 2);
744 mmio_list(0x419004, 0x00000000, 8, 1); 741 mmio_list(0x419004, 0x00000000, 8, 1);
745 mmio_list(0x419008, 0x00000000, 0, 0); 742 mmio_list(0x419008, 0x00000000, 0, 0);
746 mmio_list(0x418808, 0x00000000, 8, 0);
747 mmio_list(0x41880c, 0x80000018, 0, 0);
748 743
749 mmio_list(0x405830, 0x02180218, 0, 0); 744 mmio_list(0x405830, 0x02180218, 0, 0);
750 mmio_list(0x4064c4, 0x0086ffff, 0, 0); 745 mmio_list(0x4064c4, 0x0086ffff, 0, 0);
@@ -794,4 +789,6 @@ nvc1_grctx_oclass = &(struct nvc0_grctx_oclass) {
794 .tpc = nvc1_grctx_pack_tpc, 789 .tpc = nvc1_grctx_pack_tpc,
795 .icmd = nvc1_grctx_pack_icmd, 790 .icmd = nvc1_grctx_pack_icmd,
796 .mthd = nvc1_grctx_pack_mthd, 791 .mthd = nvc1_grctx_pack_mthd,
792 .bundle = nvc0_grctx_generate_bundle,
793 .bundle_size = 0x1800,
797}.base; 794}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc4.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc4.c
index e11ed5538193..e96606a57432 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc4.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc4.c
@@ -100,4 +100,6 @@ nvc4_grctx_oclass = &(struct nvc0_grctx_oclass) {
100 .tpc = nvc4_grctx_pack_tpc, 100 .tpc = nvc4_grctx_pack_tpc,
101 .icmd = nvc0_grctx_pack_icmd, 101 .icmd = nvc0_grctx_pack_icmd,
102 .mthd = nvc0_grctx_pack_mthd, 102 .mthd = nvc0_grctx_pack_mthd,
103 .bundle = nvc0_grctx_generate_bundle,
104 .bundle_size = 0x1800,
103}.base; 105}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c
index feebd58dfe8d..cc4646e514fc 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvc8.c
@@ -351,4 +351,6 @@ nvc8_grctx_oclass = &(struct nvc0_grctx_oclass) {
351 .tpc = nvc0_grctx_pack_tpc, 351 .tpc = nvc0_grctx_pack_tpc,
352 .icmd = nvc8_grctx_pack_icmd, 352 .icmd = nvc8_grctx_pack_icmd,
353 .mthd = nvc8_grctx_pack_mthd, 353 .mthd = nvc8_grctx_pack_mthd,
354 .bundle = nvc0_grctx_generate_bundle,
355 .bundle_size = 0x1800,
354}.base; 356}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c
index 944d90bef959..930a205111b2 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd7.c
@@ -184,17 +184,12 @@ nvd7_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
184 u32 offset; 184 u32 offset;
185 int gpc; 185 int gpc;
186 186
187 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
188 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 187 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
189 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW); 188 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
190 mmio_list(0x40800c, 0x00000000, 8, 1); 189 mmio_list(0x40800c, 0x00000000, 8, 1);
191 mmio_list(0x408010, 0x80000000, 0, 0); 190 mmio_list(0x408010, 0x80000000, 0, 0);
192 mmio_list(0x419004, 0x00000000, 8, 1); 191 mmio_list(0x419004, 0x00000000, 8, 1);
193 mmio_list(0x419008, 0x00000000, 0, 0); 192 mmio_list(0x419008, 0x00000000, 0, 0);
194 mmio_list(0x408004, 0x00000000, 8, 0);
195 mmio_list(0x408008, 0x80000018, 0, 0);
196 mmio_list(0x418808, 0x00000000, 8, 0);
197 mmio_list(0x41880c, 0x80000018, 0, 0);
198 mmio_list(0x418810, 0x80000000, 12, 2); 193 mmio_list(0x418810, 0x80000000, 12, 2);
199 mmio_list(0x419848, 0x10000000, 12, 2); 194 mmio_list(0x419848, 0x10000000, 12, 2);
200 195
@@ -233,6 +228,7 @@ nvd7_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
233 228
234 nv_wr32(priv, 0x404154, 0x00000000); 229 nv_wr32(priv, 0x404154, 0x00000000);
235 230
231 oclass->bundle(info);
236 oclass->mods(priv, info); 232 oclass->mods(priv, info);
237 oclass->unkn(priv); 233 oclass->unkn(priv);
238 234
@@ -272,4 +268,6 @@ nvd7_grctx_oclass = &(struct nvc0_grctx_oclass) {
272 .ppc = nvd7_grctx_pack_ppc, 268 .ppc = nvd7_grctx_pack_ppc,
273 .icmd = nvd9_grctx_pack_icmd, 269 .icmd = nvd9_grctx_pack_icmd,
274 .mthd = nvd9_grctx_pack_mthd, 270 .mthd = nvd9_grctx_pack_mthd,
271 .bundle = nvc0_grctx_generate_bundle,
272 .bundle_size = 0x1800,
275}.base; 273}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c
index c665fb7e4660..8aa5e69aecc6 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvd9.c
@@ -519,4 +519,6 @@ nvd9_grctx_oclass = &(struct nvc0_grctx_oclass) {
519 .tpc = nvd9_grctx_pack_tpc, 519 .tpc = nvd9_grctx_pack_tpc,
520 .icmd = nvd9_grctx_pack_icmd, 520 .icmd = nvd9_grctx_pack_icmd,
521 .mthd = nvd9_grctx_pack_mthd, 521 .mthd = nvd9_grctx_pack_mthd,
522 .bundle = nvc0_grctx_generate_bundle,
523 .bundle_size = 0x1800,
522}.base; 524}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c
index cd036322d2d8..678708e15718 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnve4.c
@@ -839,13 +839,29 @@ nve4_grctx_pack_ppc[] = {
839 ******************************************************************************/ 839 ******************************************************************************/
840 840
841void 841void
842nve4_grctx_generate_bundle(struct nvc0_grctx *info)
843{
844 const struct nvc0_grctx_oclass *impl = nvc0_grctx_impl(info->priv);
845 const u32 state_limit = min(impl->bundle_min_gpm_fifo_depth,
846 impl->bundle_size / 0x20);
847 const u32 token_limit = impl->bundle_token_limit;
848 const u32 access = NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS;
849 const int s = 8;
850 const int b = mmio_vram(info, impl->bundle_size, (1 << s), access);
851 mmio_refn(info, 0x408004, 0x00000000, s, b);
852 mmio_refn(info, 0x408008, 0x80000000 | (impl->bundle_size >> s), 0, b);
853 mmio_refn(info, 0x418808, 0x00000000, s, b);
854 mmio_refn(info, 0x41880c, 0x80000000 | (impl->bundle_size >> s), 0, b);
855 mmio_wr32(info, 0x4064c8, (state_limit << 16) | token_limit);
856}
857
858void
842nve4_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info) 859nve4_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
843{ 860{
844 u32 magic[GPC_MAX][2]; 861 u32 magic[GPC_MAX][2];
845 u32 offset; 862 u32 offset;
846 int gpc; 863 int gpc;
847 864
848 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
849 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 865 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
850 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW); 866 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
851 mmio_list(0x40800c, 0x00000000, 8, 1); 867 mmio_list(0x40800c, 0x00000000, 8, 1);
@@ -853,11 +869,6 @@ nve4_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
853 mmio_list(0x419004, 0x00000000, 8, 1); 869 mmio_list(0x419004, 0x00000000, 8, 1);
854 mmio_list(0x419008, 0x00000000, 0, 0); 870 mmio_list(0x419008, 0x00000000, 0, 0);
855 mmio_list(0x4064cc, 0x80000000, 0, 0); 871 mmio_list(0x4064cc, 0x80000000, 0, 0);
856 mmio_list(0x408004, 0x00000000, 8, 0);
857 mmio_list(0x408008, 0x80000030, 0, 0);
858 mmio_list(0x418808, 0x00000000, 8, 0);
859 mmio_list(0x41880c, 0x80000030, 0, 0);
860 mmio_list(0x4064c8, 0x01800600, 0, 0);
861 mmio_list(0x418810, 0x80000000, 12, 2); 872 mmio_list(0x418810, 0x80000000, 12, 2);
862 mmio_list(0x419848, 0x10000000, 12, 2); 873 mmio_list(0x419848, 0x10000000, 12, 2);
863 874
@@ -967,6 +978,7 @@ nve4_grctx_generate_main(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
967 978
968 nv_wr32(priv, 0x404154, 0x00000000); 979 nv_wr32(priv, 0x404154, 0x00000000);
969 980
981 oclass->bundle(info);
970 oclass->mods(priv, info); 982 oclass->mods(priv, info);
971 oclass->unkn(priv); 983 oclass->unkn(priv);
972 984
@@ -1018,4 +1030,8 @@ nve4_grctx_oclass = &(struct nvc0_grctx_oclass) {
1018 .ppc = nve4_grctx_pack_ppc, 1030 .ppc = nve4_grctx_pack_ppc,
1019 .icmd = nve4_grctx_pack_icmd, 1031 .icmd = nve4_grctx_pack_icmd,
1020 .mthd = nve4_grctx_pack_mthd, 1032 .mthd = nve4_grctx_pack_mthd,
1033 .bundle = nve4_grctx_generate_bundle,
1034 .bundle_size = 0x3000,
1035 .bundle_min_gpm_fifo_depth = 0x180,
1036 .bundle_token_limit = 0x600,
1021}.base; 1037}.base;
diff --git a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c
index 3e6ac2703d72..89a77a2788ba 100644
--- a/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c
+++ b/drivers/gpu/drm/nouveau/core/engine/graph/ctxnvf0.c
@@ -816,7 +816,6 @@ nvf0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
816 u32 offset; 816 u32 offset;
817 int gpc; 817 int gpc;
818 818
819 mmio_data(0x003000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
820 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS); 819 mmio_data(0x008000, 0x0100, NV_MEM_ACCESS_RW | NV_MEM_ACCESS_SYS);
821 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW); 820 mmio_data(0x060000, 0x1000, NV_MEM_ACCESS_RW);
822 mmio_list(0x40800c, 0x00000000, 8, 1); 821 mmio_list(0x40800c, 0x00000000, 8, 1);
@@ -824,11 +823,6 @@ nvf0_grctx_generate_mods(struct nvc0_graph_priv *priv, struct nvc0_grctx *info)
824 mmio_list(0x419004, 0x00000000, 8, 1); 823 mmio_list(0x419004, 0x00000000, 8, 1);
825 mmio_list(0x419008, 0x00000000, 0, 0); 824 mmio_list(0x419008, 0x00000000, 0, 0);
826 mmio_list(0x4064cc, 0x80000000, 0, 0); 825 mmio_list(0x4064cc, 0x80000000, 0, 0);
827 mmio_list(0x408004, 0x00000000, 8, 0);
828 mmio_list(0x408008, 0x80000030, 0, 0);
829 mmio_list(0x418808, 0x00000000, 8, 0);
830 mmio_list(0x41880c, 0x80000030, 0, 0);
831 mmio_list(0x4064c8, 0x01800600, 0, 0);
832 mmio_list(0x418810, 0x80000000, 12, 2); 826 mmio_list(0x418810, 0x80000000, 12, 2);
833 mmio_list(0x419848, 0x10000000, 12, 2); 827 mmio_list(0x419848, 0x10000000, 12, 2);
834 828
@@ -882,4 +876,8 @@ nvf0_grctx_oclass = &(struct nvc0_grctx_oclass) {
882 .ppc = nvf0_grctx_pack_ppc, 876 .ppc = nvf0_grctx_pack_ppc,
883 .icmd = nvf0_grctx_pack_icmd, 877 .icmd = nvf0_grctx_pack_icmd,
884 .mthd = nvf0_grctx_pack_mthd, 878 .mthd = nvf0_grctx_pack_mthd,
879 .bundle = nve4_grctx_generate_bundle,
880 .bundle_size = 0x3000,
881 .bundle_min_gpm_fifo_depth = 0x180,
882 .bundle_token_limit = 0x7c0,
885}.base; 883}.base;