nv50_fifo.c 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  1. /*
  2. * Copyright (C) 2007 Ben Skeggs.
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * The above copyright notice and this permission notice (including the
  14. * next paragraph) shall be included in all copies or substantial
  15. * portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  18. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  19. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  20. * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
  21. * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  22. * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  23. * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  24. *
  25. */
  26. #include "drmP.h"
  27. #include "drm.h"
  28. #include "nouveau_drv.h"
  29. #include "nouveau_ramht.h"
  30. #include "nouveau_vm.h"
  31. static void
  32. nv50_fifo_playlist_update(struct drm_device *dev)
  33. {
  34. struct drm_nouveau_private *dev_priv = dev->dev_private;
  35. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  36. struct nouveau_gpuobj *cur;
  37. int i, nr;
  38. NV_DEBUG(dev, "\n");
  39. cur = pfifo->playlist[pfifo->cur_playlist];
  40. pfifo->cur_playlist = !pfifo->cur_playlist;
  41. /* We never schedule channel 0 or 127 */
  42. for (i = 1, nr = 0; i < 127; i++) {
  43. if (dev_priv->channels.ptr[i] &&
  44. dev_priv->channels.ptr[i]->ramfc) {
  45. nv_wo32(cur, (nr * 4), i);
  46. nr++;
  47. }
  48. }
  49. dev_priv->engine.instmem.flush(dev);
  50. nv_wr32(dev, 0x32f4, cur->vinst >> 12);
  51. nv_wr32(dev, 0x32ec, nr);
  52. nv_wr32(dev, 0x2500, 0x101);
  53. }
  54. static void
  55. nv50_fifo_channel_enable(struct drm_device *dev, int channel)
  56. {
  57. struct drm_nouveau_private *dev_priv = dev->dev_private;
  58. struct nouveau_channel *chan = dev_priv->channels.ptr[channel];
  59. uint32_t inst;
  60. NV_DEBUG(dev, "ch%d\n", channel);
  61. if (dev_priv->chipset == 0x50)
  62. inst = chan->ramfc->vinst >> 12;
  63. else
  64. inst = chan->ramfc->vinst >> 8;
  65. nv_wr32(dev, NV50_PFIFO_CTX_TABLE(channel), inst |
  66. NV50_PFIFO_CTX_TABLE_CHANNEL_ENABLED);
  67. }
  68. static void
  69. nv50_fifo_channel_disable(struct drm_device *dev, int channel)
  70. {
  71. struct drm_nouveau_private *dev_priv = dev->dev_private;
  72. uint32_t inst;
  73. NV_DEBUG(dev, "ch%d\n", channel);
  74. if (dev_priv->chipset == 0x50)
  75. inst = NV50_PFIFO_CTX_TABLE_INSTANCE_MASK_G80;
  76. else
  77. inst = NV50_PFIFO_CTX_TABLE_INSTANCE_MASK_G84;
  78. nv_wr32(dev, NV50_PFIFO_CTX_TABLE(channel), inst);
  79. }
  80. static void
  81. nv50_fifo_init_reset(struct drm_device *dev)
  82. {
  83. uint32_t pmc_e = NV_PMC_ENABLE_PFIFO;
  84. NV_DEBUG(dev, "\n");
  85. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) & ~pmc_e);
  86. nv_wr32(dev, NV03_PMC_ENABLE, nv_rd32(dev, NV03_PMC_ENABLE) | pmc_e);
  87. }
  88. static void
  89. nv50_fifo_init_intr(struct drm_device *dev)
  90. {
  91. NV_DEBUG(dev, "\n");
  92. nouveau_irq_register(dev, 8, nv04_fifo_isr);
  93. nv_wr32(dev, NV03_PFIFO_INTR_0, 0xFFFFFFFF);
  94. nv_wr32(dev, NV03_PFIFO_INTR_EN_0, 0xFFFFFFFF);
  95. }
  96. static void
  97. nv50_fifo_init_context_table(struct drm_device *dev)
  98. {
  99. struct drm_nouveau_private *dev_priv = dev->dev_private;
  100. int i;
  101. NV_DEBUG(dev, "\n");
  102. for (i = 0; i < NV50_PFIFO_CTX_TABLE__SIZE; i++) {
  103. if (dev_priv->channels.ptr[i])
  104. nv50_fifo_channel_enable(dev, i);
  105. else
  106. nv50_fifo_channel_disable(dev, i);
  107. }
  108. nv50_fifo_playlist_update(dev);
  109. }
  110. static void
  111. nv50_fifo_init_regs__nv(struct drm_device *dev)
  112. {
  113. NV_DEBUG(dev, "\n");
  114. nv_wr32(dev, 0x250c, 0x6f3cfc34);
  115. }
  116. static void
  117. nv50_fifo_init_regs(struct drm_device *dev)
  118. {
  119. NV_DEBUG(dev, "\n");
  120. nv_wr32(dev, 0x2500, 0);
  121. nv_wr32(dev, 0x3250, 0);
  122. nv_wr32(dev, 0x3220, 0);
  123. nv_wr32(dev, 0x3204, 0);
  124. nv_wr32(dev, 0x3210, 0);
  125. nv_wr32(dev, 0x3270, 0);
  126. nv_wr32(dev, 0x2044, 0x01003fff);
  127. /* Enable dummy channels setup by nv50_instmem.c */
  128. nv50_fifo_channel_enable(dev, 0);
  129. nv50_fifo_channel_enable(dev, 127);
  130. }
  131. int
  132. nv50_fifo_init(struct drm_device *dev)
  133. {
  134. struct drm_nouveau_private *dev_priv = dev->dev_private;
  135. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  136. int ret;
  137. NV_DEBUG(dev, "\n");
  138. if (pfifo->playlist[0]) {
  139. pfifo->cur_playlist = !pfifo->cur_playlist;
  140. goto just_reset;
  141. }
  142. ret = nouveau_gpuobj_new(dev, NULL, 128*4, 0x1000,
  143. NVOBJ_FLAG_ZERO_ALLOC,
  144. &pfifo->playlist[0]);
  145. if (ret) {
  146. NV_ERROR(dev, "error creating playlist 0: %d\n", ret);
  147. return ret;
  148. }
  149. ret = nouveau_gpuobj_new(dev, NULL, 128*4, 0x1000,
  150. NVOBJ_FLAG_ZERO_ALLOC,
  151. &pfifo->playlist[1]);
  152. if (ret) {
  153. nouveau_gpuobj_ref(NULL, &pfifo->playlist[0]);
  154. NV_ERROR(dev, "error creating playlist 1: %d\n", ret);
  155. return ret;
  156. }
  157. just_reset:
  158. nv50_fifo_init_reset(dev);
  159. nv50_fifo_init_intr(dev);
  160. nv50_fifo_init_context_table(dev);
  161. nv50_fifo_init_regs__nv(dev);
  162. nv50_fifo_init_regs(dev);
  163. dev_priv->engine.fifo.enable(dev);
  164. dev_priv->engine.fifo.reassign(dev, true);
  165. return 0;
  166. }
  167. void
  168. nv50_fifo_takedown(struct drm_device *dev)
  169. {
  170. struct drm_nouveau_private *dev_priv = dev->dev_private;
  171. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  172. NV_DEBUG(dev, "\n");
  173. if (!pfifo->playlist[0])
  174. return;
  175. nv_wr32(dev, 0x2140, 0x00000000);
  176. nouveau_irq_unregister(dev, 8);
  177. nouveau_gpuobj_ref(NULL, &pfifo->playlist[0]);
  178. nouveau_gpuobj_ref(NULL, &pfifo->playlist[1]);
  179. }
  180. int
  181. nv50_fifo_channel_id(struct drm_device *dev)
  182. {
  183. return nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) &
  184. NV50_PFIFO_CACHE1_PUSH1_CHID_MASK;
  185. }
  186. int
  187. nv50_fifo_create_context(struct nouveau_channel *chan)
  188. {
  189. struct drm_device *dev = chan->dev;
  190. struct drm_nouveau_private *dev_priv = dev->dev_private;
  191. struct nouveau_gpuobj *ramfc = NULL;
  192. unsigned long flags;
  193. int ret;
  194. NV_DEBUG(dev, "ch%d\n", chan->id);
  195. if (dev_priv->chipset == 0x50) {
  196. ret = nouveau_gpuobj_new_fake(dev, chan->ramin->pinst,
  197. chan->ramin->vinst, 0x100,
  198. NVOBJ_FLAG_ZERO_ALLOC |
  199. NVOBJ_FLAG_ZERO_FREE,
  200. &chan->ramfc);
  201. if (ret)
  202. return ret;
  203. ret = nouveau_gpuobj_new_fake(dev, chan->ramin->pinst + 0x0400,
  204. chan->ramin->vinst + 0x0400,
  205. 4096, 0, &chan->cache);
  206. if (ret)
  207. return ret;
  208. } else {
  209. ret = nouveau_gpuobj_new(dev, chan, 0x100, 256,
  210. NVOBJ_FLAG_ZERO_ALLOC |
  211. NVOBJ_FLAG_ZERO_FREE, &chan->ramfc);
  212. if (ret)
  213. return ret;
  214. ret = nouveau_gpuobj_new(dev, chan, 4096, 1024,
  215. 0, &chan->cache);
  216. if (ret)
  217. return ret;
  218. }
  219. ramfc = chan->ramfc;
  220. chan->user = ioremap(pci_resource_start(dev->pdev, 0) +
  221. NV50_USER(chan->id), PAGE_SIZE);
  222. if (!chan->user)
  223. return -ENOMEM;
  224. spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
  225. nv_wo32(ramfc, 0x48, chan->pushbuf->cinst >> 4);
  226. nv_wo32(ramfc, 0x80, ((chan->ramht->bits - 9) << 27) |
  227. (4 << 24) /* SEARCH_FULL */ |
  228. (chan->ramht->gpuobj->cinst >> 4));
  229. nv_wo32(ramfc, 0x44, 0x01003fff);
  230. nv_wo32(ramfc, 0x60, 0x7fffffff);
  231. nv_wo32(ramfc, 0x40, 0x00000000);
  232. nv_wo32(ramfc, 0x7c, 0x30000001);
  233. nv_wo32(ramfc, 0x78, 0x00000000);
  234. nv_wo32(ramfc, 0x3c, 0x403f6078);
  235. nv_wo32(ramfc, 0x50, chan->pushbuf_base + chan->dma.ib_base * 4);
  236. nv_wo32(ramfc, 0x54, drm_order(chan->dma.ib_max + 1) << 16);
  237. if (dev_priv->chipset != 0x50) {
  238. nv_wo32(chan->ramin, 0, chan->id);
  239. nv_wo32(chan->ramin, 4, chan->ramfc->vinst >> 8);
  240. nv_wo32(ramfc, 0x88, chan->cache->vinst >> 10);
  241. nv_wo32(ramfc, 0x98, chan->ramin->vinst >> 12);
  242. }
  243. dev_priv->engine.instmem.flush(dev);
  244. nv50_fifo_channel_enable(dev, chan->id);
  245. nv50_fifo_playlist_update(dev);
  246. spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
  247. return 0;
  248. }
  249. void
  250. nv50_fifo_destroy_context(struct nouveau_channel *chan)
  251. {
  252. struct drm_device *dev = chan->dev;
  253. struct drm_nouveau_private *dev_priv = dev->dev_private;
  254. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  255. struct nouveau_gpuobj *ramfc = NULL;
  256. unsigned long flags;
  257. NV_DEBUG(dev, "ch%d\n", chan->id);
  258. spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
  259. pfifo->reassign(dev, false);
  260. /* Unload the context if it's the currently active one */
  261. if (pfifo->channel_id(dev) == chan->id) {
  262. pfifo->disable(dev);
  263. pfifo->unload_context(dev);
  264. pfifo->enable(dev);
  265. }
  266. /* This will ensure the channel is seen as disabled. */
  267. nouveau_gpuobj_ref(chan->ramfc, &ramfc);
  268. nouveau_gpuobj_ref(NULL, &chan->ramfc);
  269. nv50_fifo_channel_disable(dev, chan->id);
  270. /* Dummy channel, also used on ch 127 */
  271. if (chan->id == 0)
  272. nv50_fifo_channel_disable(dev, 127);
  273. nv50_fifo_playlist_update(dev);
  274. pfifo->reassign(dev, true);
  275. spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
  276. /* Free the channel resources */
  277. if (chan->user) {
  278. iounmap(chan->user);
  279. chan->user = NULL;
  280. }
  281. nouveau_gpuobj_ref(NULL, &ramfc);
  282. nouveau_gpuobj_ref(NULL, &chan->cache);
  283. }
  284. int
  285. nv50_fifo_load_context(struct nouveau_channel *chan)
  286. {
  287. struct drm_device *dev = chan->dev;
  288. struct drm_nouveau_private *dev_priv = dev->dev_private;
  289. struct nouveau_gpuobj *ramfc = chan->ramfc;
  290. struct nouveau_gpuobj *cache = chan->cache;
  291. int ptr, cnt;
  292. NV_DEBUG(dev, "ch%d\n", chan->id);
  293. nv_wr32(dev, 0x3330, nv_ro32(ramfc, 0x00));
  294. nv_wr32(dev, 0x3334, nv_ro32(ramfc, 0x04));
  295. nv_wr32(dev, 0x3240, nv_ro32(ramfc, 0x08));
  296. nv_wr32(dev, 0x3320, nv_ro32(ramfc, 0x0c));
  297. nv_wr32(dev, 0x3244, nv_ro32(ramfc, 0x10));
  298. nv_wr32(dev, 0x3328, nv_ro32(ramfc, 0x14));
  299. nv_wr32(dev, 0x3368, nv_ro32(ramfc, 0x18));
  300. nv_wr32(dev, 0x336c, nv_ro32(ramfc, 0x1c));
  301. nv_wr32(dev, 0x3370, nv_ro32(ramfc, 0x20));
  302. nv_wr32(dev, 0x3374, nv_ro32(ramfc, 0x24));
  303. nv_wr32(dev, 0x3378, nv_ro32(ramfc, 0x28));
  304. nv_wr32(dev, 0x337c, nv_ro32(ramfc, 0x2c));
  305. nv_wr32(dev, 0x3228, nv_ro32(ramfc, 0x30));
  306. nv_wr32(dev, 0x3364, nv_ro32(ramfc, 0x34));
  307. nv_wr32(dev, 0x32a0, nv_ro32(ramfc, 0x38));
  308. nv_wr32(dev, 0x3224, nv_ro32(ramfc, 0x3c));
  309. nv_wr32(dev, 0x324c, nv_ro32(ramfc, 0x40));
  310. nv_wr32(dev, 0x2044, nv_ro32(ramfc, 0x44));
  311. nv_wr32(dev, 0x322c, nv_ro32(ramfc, 0x48));
  312. nv_wr32(dev, 0x3234, nv_ro32(ramfc, 0x4c));
  313. nv_wr32(dev, 0x3340, nv_ro32(ramfc, 0x50));
  314. nv_wr32(dev, 0x3344, nv_ro32(ramfc, 0x54));
  315. nv_wr32(dev, 0x3280, nv_ro32(ramfc, 0x58));
  316. nv_wr32(dev, 0x3254, nv_ro32(ramfc, 0x5c));
  317. nv_wr32(dev, 0x3260, nv_ro32(ramfc, 0x60));
  318. nv_wr32(dev, 0x3264, nv_ro32(ramfc, 0x64));
  319. nv_wr32(dev, 0x3268, nv_ro32(ramfc, 0x68));
  320. nv_wr32(dev, 0x326c, nv_ro32(ramfc, 0x6c));
  321. nv_wr32(dev, 0x32e4, nv_ro32(ramfc, 0x70));
  322. nv_wr32(dev, 0x3248, nv_ro32(ramfc, 0x74));
  323. nv_wr32(dev, 0x2088, nv_ro32(ramfc, 0x78));
  324. nv_wr32(dev, 0x2058, nv_ro32(ramfc, 0x7c));
  325. nv_wr32(dev, 0x2210, nv_ro32(ramfc, 0x80));
  326. cnt = nv_ro32(ramfc, 0x84);
  327. for (ptr = 0; ptr < cnt; ptr++) {
  328. nv_wr32(dev, NV40_PFIFO_CACHE1_METHOD(ptr),
  329. nv_ro32(cache, (ptr * 8) + 0));
  330. nv_wr32(dev, NV40_PFIFO_CACHE1_DATA(ptr),
  331. nv_ro32(cache, (ptr * 8) + 4));
  332. }
  333. nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, cnt << 2);
  334. nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0);
  335. /* guessing that all the 0x34xx regs aren't on NV50 */
  336. if (dev_priv->chipset != 0x50) {
  337. nv_wr32(dev, 0x340c, nv_ro32(ramfc, 0x88));
  338. nv_wr32(dev, 0x3400, nv_ro32(ramfc, 0x8c));
  339. nv_wr32(dev, 0x3404, nv_ro32(ramfc, 0x90));
  340. nv_wr32(dev, 0x3408, nv_ro32(ramfc, 0x94));
  341. nv_wr32(dev, 0x3410, nv_ro32(ramfc, 0x98));
  342. }
  343. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, chan->id | (1<<16));
  344. return 0;
  345. }
  346. int
  347. nv50_fifo_unload_context(struct drm_device *dev)
  348. {
  349. struct drm_nouveau_private *dev_priv = dev->dev_private;
  350. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  351. struct nouveau_gpuobj *ramfc, *cache;
  352. struct nouveau_channel *chan = NULL;
  353. int chid, get, put, ptr;
  354. NV_DEBUG(dev, "\n");
  355. chid = pfifo->channel_id(dev);
  356. if (chid < 1 || chid >= dev_priv->engine.fifo.channels - 1)
  357. return 0;
  358. chan = dev_priv->channels.ptr[chid];
  359. if (!chan) {
  360. NV_ERROR(dev, "Inactive channel on PFIFO: %d\n", chid);
  361. return -EINVAL;
  362. }
  363. NV_DEBUG(dev, "ch%d\n", chan->id);
  364. ramfc = chan->ramfc;
  365. cache = chan->cache;
  366. nv_wo32(ramfc, 0x00, nv_rd32(dev, 0x3330));
  367. nv_wo32(ramfc, 0x04, nv_rd32(dev, 0x3334));
  368. nv_wo32(ramfc, 0x08, nv_rd32(dev, 0x3240));
  369. nv_wo32(ramfc, 0x0c, nv_rd32(dev, 0x3320));
  370. nv_wo32(ramfc, 0x10, nv_rd32(dev, 0x3244));
  371. nv_wo32(ramfc, 0x14, nv_rd32(dev, 0x3328));
  372. nv_wo32(ramfc, 0x18, nv_rd32(dev, 0x3368));
  373. nv_wo32(ramfc, 0x1c, nv_rd32(dev, 0x336c));
  374. nv_wo32(ramfc, 0x20, nv_rd32(dev, 0x3370));
  375. nv_wo32(ramfc, 0x24, nv_rd32(dev, 0x3374));
  376. nv_wo32(ramfc, 0x28, nv_rd32(dev, 0x3378));
  377. nv_wo32(ramfc, 0x2c, nv_rd32(dev, 0x337c));
  378. nv_wo32(ramfc, 0x30, nv_rd32(dev, 0x3228));
  379. nv_wo32(ramfc, 0x34, nv_rd32(dev, 0x3364));
  380. nv_wo32(ramfc, 0x38, nv_rd32(dev, 0x32a0));
  381. nv_wo32(ramfc, 0x3c, nv_rd32(dev, 0x3224));
  382. nv_wo32(ramfc, 0x40, nv_rd32(dev, 0x324c));
  383. nv_wo32(ramfc, 0x44, nv_rd32(dev, 0x2044));
  384. nv_wo32(ramfc, 0x48, nv_rd32(dev, 0x322c));
  385. nv_wo32(ramfc, 0x4c, nv_rd32(dev, 0x3234));
  386. nv_wo32(ramfc, 0x50, nv_rd32(dev, 0x3340));
  387. nv_wo32(ramfc, 0x54, nv_rd32(dev, 0x3344));
  388. nv_wo32(ramfc, 0x58, nv_rd32(dev, 0x3280));
  389. nv_wo32(ramfc, 0x5c, nv_rd32(dev, 0x3254));
  390. nv_wo32(ramfc, 0x60, nv_rd32(dev, 0x3260));
  391. nv_wo32(ramfc, 0x64, nv_rd32(dev, 0x3264));
  392. nv_wo32(ramfc, 0x68, nv_rd32(dev, 0x3268));
  393. nv_wo32(ramfc, 0x6c, nv_rd32(dev, 0x326c));
  394. nv_wo32(ramfc, 0x70, nv_rd32(dev, 0x32e4));
  395. nv_wo32(ramfc, 0x74, nv_rd32(dev, 0x3248));
  396. nv_wo32(ramfc, 0x78, nv_rd32(dev, 0x2088));
  397. nv_wo32(ramfc, 0x7c, nv_rd32(dev, 0x2058));
  398. nv_wo32(ramfc, 0x80, nv_rd32(dev, 0x2210));
  399. put = (nv_rd32(dev, NV03_PFIFO_CACHE1_PUT) & 0x7ff) >> 2;
  400. get = (nv_rd32(dev, NV03_PFIFO_CACHE1_GET) & 0x7ff) >> 2;
  401. ptr = 0;
  402. while (put != get) {
  403. nv_wo32(cache, ptr + 0,
  404. nv_rd32(dev, NV40_PFIFO_CACHE1_METHOD(get)));
  405. nv_wo32(cache, ptr + 4,
  406. nv_rd32(dev, NV40_PFIFO_CACHE1_DATA(get)));
  407. get = (get + 1) & 0x1ff;
  408. ptr += 8;
  409. }
  410. /* guessing that all the 0x34xx regs aren't on NV50 */
  411. if (dev_priv->chipset != 0x50) {
  412. nv_wo32(ramfc, 0x84, ptr >> 3);
  413. nv_wo32(ramfc, 0x88, nv_rd32(dev, 0x340c));
  414. nv_wo32(ramfc, 0x8c, nv_rd32(dev, 0x3400));
  415. nv_wo32(ramfc, 0x90, nv_rd32(dev, 0x3404));
  416. nv_wo32(ramfc, 0x94, nv_rd32(dev, 0x3408));
  417. nv_wo32(ramfc, 0x98, nv_rd32(dev, 0x3410));
  418. }
  419. dev_priv->engine.instmem.flush(dev);
  420. /*XXX: probably reload ch127 (NULL) state back too */
  421. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, 127);
  422. return 0;
  423. }
  424. void
  425. nv50_fifo_tlb_flush(struct drm_device *dev)
  426. {
  427. nv50_vm_flush_engine(dev, 5);
  428. }