]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/nouveau/gr/gf100-: fix race condition in fecs/gpccs ucode
authorBen Skeggs <bskeggs@redhat.com>
Thu, 19 May 2016 23:04:41 +0000 (09:04 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 20 May 2016 04:43:04 +0000 (14:43 +1000)
This is a simplied version of the fix by Roy in fdo#93629.  While this
doesn't appear to fix the issues for the users in that report, it's a
real issue that deserves to be resolved.

Reported-by: Roy Spliet <rspliet@eclipso.eu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
14 files changed:
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpc.fuc
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf100.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgf117.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk104.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk110.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgk208.fuc5.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/gpcgm107.fuc5.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hub.fuc
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf100.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgf117.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk104.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk110.fuc3.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgk208.fuc5.h
drivers/gpu/drm/nouveau/nvkm/engine/gr/fuc/hubgm107.fuc5.h

index dc60509f76f7f85ba9f39eea8355f464c5277054..4984b0069dfda636b34c4a775b24a84874e01cfb 100644 (file)
@@ -291,12 +291,13 @@ init:
 // Main program loop, very simple, sleeps until woken up by the interrupt
 // handler, pulls a command from the queue and executes its handler
 //
-main:
-       bset $flags $p0
+wait:
        sleep $p0
+       bset $flags $p0
+main:
        mov $r13 #cmd_queue
        call(queue_get)
-       bra $p1 #main
+       bra $p1 #wait
 
        // 0x0000-0x0003 are all context transfers
        cmpu b32 $r14 0x04
index 5f4ddfee48a2d21c0ad6701d42179dc048512676..8cb240b65ec2003ba31e71d817d6a55ee3986e42 100644 (file)
@@ -370,9 +370,10 @@ uint32_t gf100_grgpc_code[] = {
        0xf11f29f0,
        0xf0080007,
        0x02d00203,
-/* 0x04bb: main */
+/* 0x04bb: wait */
        0xf404bd00,
-       0x28f40031,
+       0x31f40028,
+/* 0x04c1: main */
        0x1cd7f000,
        0xf43921f4,
        0xe4b0f401,
@@ -384,10 +385,10 @@ uint32_t gf100_grgpc_code[] = {
        0x0018fe05,
        0x05b421f5,
 /* 0x04eb: main_not_ctx_xfer */
-       0x94d30ef4,
+       0x94d90ef4,
        0xf5f010ef,
        0x7e21f501,
-       0xc60ef403,
+       0xcc0ef403,
 /* 0x04f8: ih */
        0x80f900f9,
        0xf90188fe,
index 03381b163cfc0225360f8b72870f5f60d150cbd2..550d6ba0933b5ffdf99a97eae9dc3838b3948285 100644 (file)
@@ -397,9 +397,10 @@ uint32_t gf117_grgpc_code[] = {
        0x080007f1,
        0xd00203f0,
        0x04bd0002,
-/* 0x0508: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0508: wait */
+       0xf40028f4,
+/* 0x050e: main */
+       0xd7f00031,
        0x3921f424,
        0xb0f401f4,
        0x18f404e4,
@@ -409,13 +410,13 @@ uint32_t gf117_grgpc_code[] = {
        0xfd01e4b6,
        0x18fe051e,
        0x0121f500,
-       0xd30ef406,
+       0xd90ef406,
 /* 0x0538: main_not_ctx_xfer */
        0xf010ef94,
        0x21f501f5,
        0x0ef4037e,
 /* 0x0545: ih */
-       0xf900f9c6,
+       0xf900f9cc,
        0x0188fe80,
        0x90f980f9,
        0xb0f9a0f9,
index 99d9b48a3b504b3b4a69099ec2291e81c2951c94..271b59d365e5478570b95ae5673307c970e4f812 100644 (file)
@@ -397,9 +397,10 @@ uint32_t gk104_grgpc_code[] = {
        0x080007f1,
        0xd00203f0,
        0x04bd0002,
-/* 0x0508: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0508: wait */
+       0xf40028f4,
+/* 0x050e: main */
+       0xd7f00031,
        0x3921f424,
        0xb0f401f4,
        0x18f404e4,
@@ -409,13 +410,13 @@ uint32_t gk104_grgpc_code[] = {
        0xfd01e4b6,
        0x18fe051e,
        0x0121f500,
-       0xd30ef406,
+       0xd90ef406,
 /* 0x0538: main_not_ctx_xfer */
        0xf010ef94,
        0x21f501f5,
        0x0ef4037e,
 /* 0x0545: ih */
-       0xf900f9c6,
+       0xf900f9cc,
        0x0188fe80,
        0x90f980f9,
        0xb0f9a0f9,
index f7267696cbfd49e18c05d57b217d1214ba6875d4..73b4a32c5d2903cd2f3fd5f10ccb953366031c4c 100644 (file)
@@ -397,9 +397,10 @@ uint32_t gk110_grgpc_code[] = {
        0x300007f1,
        0xd00203f0,
        0x04bd0002,
-/* 0x0508: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0508: wait */
+       0xf40028f4,
+/* 0x050e: main */
+       0xd7f00031,
        0x3921f424,
        0xb0f401f4,
        0x18f404e4,
@@ -409,13 +410,13 @@ uint32_t gk110_grgpc_code[] = {
        0xfd01e4b6,
        0x18fe051e,
        0x0121f500,
-       0xd30ef406,
+       0xd90ef406,
 /* 0x0538: main_not_ctx_xfer */
        0xf010ef94,
        0x21f501f5,
        0x0ef4037e,
 /* 0x0545: ih */
-       0xf900f9c6,
+       0xf900f9cc,
        0x0188fe80,
        0x90f980f9,
        0xb0f9a0f9,
index 387d1fa3e231b50465eb95a94b87b62021d0dca8..01816981831738d33446d7f9eda23c34f6507606 100644 (file)
@@ -349,9 +349,10 @@ uint32_t gk208_grgpc_code[] = {
        0x801f29f0,
        0xf6023000,
        0x04bd0002,
-/* 0x0448: main */
-       0xf40031f4,
-       0x240d0028,
+/* 0x0448: wait */
+       0xf40028f4,
+/* 0x044e: main */
+       0x240d0031,
        0x0000377e,
        0xb0f401f4,
        0x18f404e4,
@@ -362,10 +363,10 @@ uint32_t gk208_grgpc_code[] = {
        0x0018fe05,
        0x00051f7e,
 /* 0x0477: main_not_ctx_xfer */
-       0x94d40ef4,
+       0x94da0ef4,
        0xf5f010ef,
        0x02f87e01,
-       0xc70ef400,
+       0xcd0ef400,
 /* 0x0484: ih */
        0x80f900f9,
        0xf90188fe,
index fa9f3c0c599449eb4927aebfa369e53a1e9cd5ca..eca007f03fa9698b496d014fd5664f57a17fdaa0 100644 (file)
@@ -427,9 +427,10 @@ uint32_t gm107_grgpc_code[] = {
        0x1f29f024,
        0x02300080,
        0xbd0002f6,
-/* 0x0571: main */
-       0x0031f404,
-       0x0d0028f4,
+/* 0x0571: wait */
+       0x0028f404,
+/* 0x0577: main */
+       0x0d0031f4,
        0x00377e24,
        0xf401f400,
        0xf404e4b0,
@@ -439,13 +440,13 @@ uint32_t gm107_grgpc_code[] = {
        0xfd01e4b6,
        0x18fe051e,
        0x06487e00,
-       0xd40ef400,
+       0xda0ef400,
 /* 0x05a0: main_not_ctx_xfer */
        0xf010ef94,
        0xf87e01f5,
        0x0ef40002,
 /* 0x05ad: ih */
-       0xf900f9c7,
+       0xf900f9cd,
        0x0188fe80,
        0x90f980f9,
        0xb0f9a0f9,
index e3a2fb3082710095051a21feaca3a0ac5cda4778..4d416d4f82d759bd1a1004d804c894bfbdbf11f6 100644 (file)
@@ -218,13 +218,14 @@ init:
 // Main program loop, very simple, sleeps until woken up by the interrupt
 // handler, pulls a command from the queue and executes its handler
 //
-main:
+wait:
        // sleep until we have something to do
-       bset $flags $p0
        sleep $p0
+       bset $flags $p0
+main:
        mov $r13 #cmd_queue
        call(queue_get)
-       bra $p1 #main
+       bra $p1 #wait
 
        // context switch, requested by GPU?
        cmpu b32 $r14 0x4001
index 397921a9a46cf419b417535dbe7e20ff11bae846..8015b40a61d69de7863dac560b531b1dc3f090b3 100644 (file)
@@ -584,9 +584,10 @@ uint32_t gf100_grhub_code[] = {
        0x080007f1,
        0xd00203f0,
        0x04bd0001,
-/* 0x0564: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0564: wait */
+       0xf40028f4,
+/* 0x056a: main */
+       0xd7f00031,
        0x3921f410,
        0xb1f401f4,
        0xf54001e4,
@@ -650,7 +651,7 @@ uint32_t gf100_grhub_code[] = {
        0x170007f1,
        0xd00203f0,
        0x04bd0009,
-       0xff080ef5,
+       0xff0e0ef5,
 /* 0x0660: main_not_ctx_switch */
        0xf401e4b0,
        0xf2b90d1b,
@@ -675,12 +676,12 @@ uint32_t gf100_grhub_code[] = {
        0xf501f5f0,
        0xf5037e21,
 /* 0x06b3: main_done */
-       0xbdfeb50e,
+       0xbdfebb0e,
        0x1f29f024,
        0x080007f1,
        0xd00203f0,
        0x04bd0002,
-       0xfea00ef5,
+       0xfea60ef5,
 /* 0x06c8: ih */
        0x80f900f9,
        0xf90188fe,
index 50c97163dcdb0709f4127b7390c4edc6174d373b..2af90ec6852a0e5ab5f5514c1981153a61a91fc7 100644 (file)
@@ -584,9 +584,10 @@ uint32_t gf117_grhub_code[] = {
        0x080007f1,
        0xd00203f0,
        0x04bd0001,
-/* 0x0564: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0564: wait */
+       0xf40028f4,
+/* 0x056a: main */
+       0xd7f00031,
        0x3921f410,
        0xb1f401f4,
        0xf54001e4,
@@ -650,7 +651,7 @@ uint32_t gf117_grhub_code[] = {
        0x170007f1,
        0xd00203f0,
        0x04bd0009,
-       0xff080ef5,
+       0xff0e0ef5,
 /* 0x0660: main_not_ctx_switch */
        0xf401e4b0,
        0xf2b90d1b,
@@ -675,12 +676,12 @@ uint32_t gf117_grhub_code[] = {
        0xf501f5f0,
        0xf5037e21,
 /* 0x06b3: main_done */
-       0xbdfeb50e,
+       0xbdfebb0e,
        0x1f29f024,
        0x080007f1,
        0xd00203f0,
        0x04bd0002,
-       0xfea00ef5,
+       0xfea60ef5,
 /* 0x06c8: ih */
        0x80f900f9,
        0xf90188fe,
index 125824b394bbd632ec1c3dc2bcbf4a0683e0fd4c..e8b8c1c94700fc365e3187ec728365f4cf73d4af 100644 (file)
@@ -584,9 +584,10 @@ uint32_t gk104_grhub_code[] = {
        0x080007f1,
        0xd00203f0,
        0x04bd0001,
-/* 0x0564: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0564: wait */
+       0xf40028f4,
+/* 0x056a: main */
+       0xd7f00031,
        0x3921f410,
        0xb1f401f4,
        0xf54001e4,
@@ -650,7 +651,7 @@ uint32_t gk104_grhub_code[] = {
        0x170007f1,
        0xd00203f0,
        0x04bd0009,
-       0xff080ef5,
+       0xff0e0ef5,
 /* 0x0660: main_not_ctx_switch */
        0xf401e4b0,
        0xf2b90d1b,
@@ -675,12 +676,12 @@ uint32_t gk104_grhub_code[] = {
        0xf501f5f0,
        0xf5037e21,
 /* 0x06b3: main_done */
-       0xbdfeb50e,
+       0xbdfebb0e,
        0x1f29f024,
        0x080007f1,
        0xd00203f0,
        0x04bd0002,
-       0xfea00ef5,
+       0xfea60ef5,
 /* 0x06c8: ih */
        0x80f900f9,
        0xf90188fe,
index 0a1b8c0b8b828adaf87186a63327751dc7eff5d2..f4ed2fb6f714d3f8ddf202bf07fb8ebdf07e8898 100644 (file)
@@ -584,9 +584,10 @@ uint32_t gk110_grhub_code[] = {
        0x300007f1,
        0xd00203f0,
        0x04bd0001,
-/* 0x0564: main */
-       0xf40031f4,
-       0xd7f00028,
+/* 0x0564: wait */
+       0xf40028f4,
+/* 0x056a: main */
+       0xd7f00031,
        0x3921f410,
        0xb1f401f4,
        0xf54001e4,
@@ -650,7 +651,7 @@ uint32_t gk110_grhub_code[] = {
        0x170007f1,
        0xd00203f0,
        0x04bd0009,
-       0xff080ef5,
+       0xff0e0ef5,
 /* 0x0660: main_not_ctx_switch */
        0xf401e4b0,
        0xf2b90d1b,
@@ -675,12 +676,12 @@ uint32_t gk110_grhub_code[] = {
        0xf501f5f0,
        0xf5037e21,
 /* 0x06b3: main_done */
-       0xbdfeb50e,
+       0xbdfebb0e,
        0x1f29f024,
        0x300007f1,
        0xd00203f0,
        0x04bd0002,
-       0xfea00ef5,
+       0xfea60ef5,
 /* 0x06c8: ih */
        0x80f900f9,
        0xf90188fe,
index 16869d0b109b6dfdd56f20d873c53ec73d179eb1..ed488973c1179ddbf4365a6e7e014d0782dbb2a6 100644 (file)
@@ -531,9 +531,10 @@ uint32_t gk208_grhub_code[] = {
        0x1f19f014,
        0x02300080,
        0xbd0001f6,
-/* 0x0491: main */
-       0x0031f404,
-       0x0d0028f4,
+/* 0x0491: wait */
+       0x0028f404,
+/* 0x0497: main */
+       0x0d0031f4,
        0x00377e10,
        0xf401f400,
        0x4001e4b1,
@@ -590,7 +591,7 @@ uint32_t gk208_grhub_code[] = {
        0x09f60217,
        0xf504bd00,
 /* 0x056b: main_not_ctx_switch */
-       0xb0ff2a0e,
+       0xb0ff300e,
        0x1bf401e4,
        0x7ef2b20c,
        0xf4000820,
@@ -612,11 +613,11 @@ uint32_t gk208_grhub_code[] = {
        0x7e01f5f0,
        0xf50002f8,
 /* 0x05b7: main_done */
-       0xbdfede0e,
+       0xbdfee40e,
        0x1f29f024,
        0x02300080,
        0xbd0002f6,
-       0xcc0ef504,
+       0xd20ef504,
 /* 0x05c9: ih */
        0xf900f9fe,
        0x0188fe80,
index d6343d2a614cb6cf99590642078be89cccf505f8..5c9051839557f03cc5f90955763590b75ade6d57 100644 (file)
@@ -531,9 +531,10 @@ uint32_t gm107_grhub_code[] = {
        0x1f19f014,
        0x02300080,
        0xbd0001f6,
-/* 0x0491: main */
-       0x0031f404,
-       0x0d0028f4,
+/* 0x0491: wait */
+       0x0028f404,
+/* 0x0497: main */
+       0x0d0031f4,
        0x00377e10,
        0xf401f400,
        0x4001e4b1,
@@ -590,7 +591,7 @@ uint32_t gm107_grhub_code[] = {
        0x09f60217,
        0xf504bd00,
 /* 0x056b: main_not_ctx_switch */
-       0xb0ff2a0e,
+       0xb0ff300e,
        0x1bf401e4,
        0x7ef2b20c,
        0xf4000820,
@@ -612,11 +613,11 @@ uint32_t gm107_grhub_code[] = {
        0x7e01f5f0,
        0xf50002f8,
 /* 0x05b7: main_done */
-       0xbdfede0e,
+       0xbdfee40e,
        0x1f29f024,
        0x02300080,
        0xbd0002f6,
-       0xcc0ef504,
+       0xd20ef504,
 /* 0x05c9: ih */
        0xf900f9fe,
        0x0188fe80,