nv04_fifo.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523
  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_util.h"
  31. #define NV04_RAMFC(c) (dev_priv->ramfc->pinst + ((c) * NV04_RAMFC__SIZE))
  32. #define NV04_RAMFC__SIZE 32
  33. #define NV04_RAMFC_DMA_PUT 0x00
  34. #define NV04_RAMFC_DMA_GET 0x04
  35. #define NV04_RAMFC_DMA_INSTANCE 0x08
  36. #define NV04_RAMFC_DMA_STATE 0x0C
  37. #define NV04_RAMFC_DMA_FETCH 0x10
  38. #define NV04_RAMFC_ENGINE 0x14
  39. #define NV04_RAMFC_PULL1_ENGINE 0x18
  40. #define RAMFC_WR(offset, val) nv_wo32(chan->ramfc, NV04_RAMFC_##offset, (val))
  41. #define RAMFC_RD(offset) nv_ro32(chan->ramfc, NV04_RAMFC_##offset)
  42. void
  43. nv04_fifo_disable(struct drm_device *dev)
  44. {
  45. uint32_t tmp;
  46. tmp = nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUSH);
  47. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_PUSH, tmp & ~1);
  48. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 0);
  49. tmp = nv_rd32(dev, NV03_PFIFO_CACHE1_PULL1);
  50. nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, tmp & ~1);
  51. }
  52. void
  53. nv04_fifo_enable(struct drm_device *dev)
  54. {
  55. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0, 1);
  56. nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1);
  57. }
  58. bool
  59. nv04_fifo_reassign(struct drm_device *dev, bool enable)
  60. {
  61. uint32_t reassign = nv_rd32(dev, NV03_PFIFO_CACHES);
  62. nv_wr32(dev, NV03_PFIFO_CACHES, enable ? 1 : 0);
  63. return (reassign == 1);
  64. }
  65. bool
  66. nv04_fifo_cache_pull(struct drm_device *dev, bool enable)
  67. {
  68. int pull = nv_mask(dev, NV04_PFIFO_CACHE1_PULL0, 1, enable);
  69. if (!enable) {
  70. /* In some cases the PFIFO puller may be left in an
  71. * inconsistent state if you try to stop it when it's
  72. * busy translating handles. Sometimes you get a
  73. * PFIFO_CACHE_ERROR, sometimes it just fails silently
  74. * sending incorrect instance offsets to PGRAPH after
  75. * it's started up again. To avoid the latter we
  76. * invalidate the most recently calculated instance.
  77. */
  78. if (!nv_wait(dev, NV04_PFIFO_CACHE1_PULL0,
  79. NV04_PFIFO_CACHE1_PULL0_HASH_BUSY, 0))
  80. NV_ERROR(dev, "Timeout idling the PFIFO puller.\n");
  81. if (nv_rd32(dev, NV04_PFIFO_CACHE1_PULL0) &
  82. NV04_PFIFO_CACHE1_PULL0_HASH_FAILED)
  83. nv_wr32(dev, NV03_PFIFO_INTR_0,
  84. NV_PFIFO_INTR_CACHE_ERROR);
  85. nv_wr32(dev, NV04_PFIFO_CACHE1_HASH, 0);
  86. }
  87. return pull & 1;
  88. }
  89. int
  90. nv04_fifo_channel_id(struct drm_device *dev)
  91. {
  92. return nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH1) &
  93. NV03_PFIFO_CACHE1_PUSH1_CHID_MASK;
  94. }
  95. #ifdef __BIG_ENDIAN
  96. #define DMA_FETCH_ENDIANNESS NV_PFIFO_CACHE1_BIG_ENDIAN
  97. #else
  98. #define DMA_FETCH_ENDIANNESS 0
  99. #endif
  100. int
  101. nv04_fifo_create_context(struct nouveau_channel *chan)
  102. {
  103. struct drm_device *dev = chan->dev;
  104. struct drm_nouveau_private *dev_priv = dev->dev_private;
  105. unsigned long flags;
  106. int ret;
  107. ret = nouveau_gpuobj_new_fake(dev, NV04_RAMFC(chan->id), ~0,
  108. NV04_RAMFC__SIZE,
  109. NVOBJ_FLAG_ZERO_ALLOC |
  110. NVOBJ_FLAG_ZERO_FREE,
  111. &chan->ramfc);
  112. if (ret)
  113. return ret;
  114. spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
  115. /* Setup initial state */
  116. RAMFC_WR(DMA_PUT, chan->pushbuf_base);
  117. RAMFC_WR(DMA_GET, chan->pushbuf_base);
  118. RAMFC_WR(DMA_INSTANCE, chan->pushbuf->pinst >> 4);
  119. RAMFC_WR(DMA_FETCH, (NV_PFIFO_CACHE1_DMA_FETCH_TRIG_128_BYTES |
  120. NV_PFIFO_CACHE1_DMA_FETCH_SIZE_128_BYTES |
  121. NV_PFIFO_CACHE1_DMA_FETCH_MAX_REQS_8 |
  122. DMA_FETCH_ENDIANNESS));
  123. /* enable the fifo dma operation */
  124. nv_wr32(dev, NV04_PFIFO_MODE,
  125. nv_rd32(dev, NV04_PFIFO_MODE) | (1 << chan->id));
  126. spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
  127. return 0;
  128. }
  129. void
  130. nv04_fifo_destroy_context(struct nouveau_channel *chan)
  131. {
  132. struct drm_device *dev = chan->dev;
  133. struct drm_nouveau_private *dev_priv = dev->dev_private;
  134. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  135. unsigned long flags;
  136. spin_lock_irqsave(&dev_priv->context_switch_lock, flags);
  137. pfifo->reassign(dev, false);
  138. /* Unload the context if it's the currently active one */
  139. if (pfifo->channel_id(dev) == chan->id) {
  140. pfifo->disable(dev);
  141. pfifo->unload_context(dev);
  142. pfifo->enable(dev);
  143. }
  144. /* Keep it from being rescheduled */
  145. nv_mask(dev, NV04_PFIFO_MODE, 1 << chan->id, 0);
  146. pfifo->reassign(dev, true);
  147. spin_unlock_irqrestore(&dev_priv->context_switch_lock, flags);
  148. /* Free the channel resources */
  149. nouveau_gpuobj_ref(NULL, &chan->ramfc);
  150. }
  151. static void
  152. nv04_fifo_do_load_context(struct drm_device *dev, int chid)
  153. {
  154. struct drm_nouveau_private *dev_priv = dev->dev_private;
  155. uint32_t fc = NV04_RAMFC(chid), tmp;
  156. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_PUT, nv_ri32(dev, fc + 0));
  157. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_GET, nv_ri32(dev, fc + 4));
  158. tmp = nv_ri32(dev, fc + 8);
  159. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_INSTANCE, tmp & 0xFFFF);
  160. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_DCOUNT, tmp >> 16);
  161. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_STATE, nv_ri32(dev, fc + 12));
  162. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_FETCH, nv_ri32(dev, fc + 16));
  163. nv_wr32(dev, NV04_PFIFO_CACHE1_ENGINE, nv_ri32(dev, fc + 20));
  164. nv_wr32(dev, NV04_PFIFO_CACHE1_PULL1, nv_ri32(dev, fc + 24));
  165. nv_wr32(dev, NV03_PFIFO_CACHE1_GET, 0);
  166. nv_wr32(dev, NV03_PFIFO_CACHE1_PUT, 0);
  167. }
  168. int
  169. nv04_fifo_load_context(struct nouveau_channel *chan)
  170. {
  171. uint32_t tmp;
  172. nv_wr32(chan->dev, NV03_PFIFO_CACHE1_PUSH1,
  173. NV03_PFIFO_CACHE1_PUSH1_DMA | chan->id);
  174. nv04_fifo_do_load_context(chan->dev, chan->id);
  175. nv_wr32(chan->dev, NV04_PFIFO_CACHE1_DMA_PUSH, 1);
  176. /* Reset NV04_PFIFO_CACHE1_DMA_CTL_AT_INFO to INVALID */
  177. tmp = nv_rd32(chan->dev, NV04_PFIFO_CACHE1_DMA_CTL) & ~(1 << 31);
  178. nv_wr32(chan->dev, NV04_PFIFO_CACHE1_DMA_CTL, tmp);
  179. return 0;
  180. }
  181. int
  182. nv04_fifo_unload_context(struct drm_device *dev)
  183. {
  184. struct drm_nouveau_private *dev_priv = dev->dev_private;
  185. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  186. struct nouveau_channel *chan = NULL;
  187. uint32_t tmp;
  188. int chid;
  189. chid = pfifo->channel_id(dev);
  190. if (chid < 0 || chid >= dev_priv->engine.fifo.channels)
  191. return 0;
  192. chan = dev_priv->channels.ptr[chid];
  193. if (!chan) {
  194. NV_ERROR(dev, "Inactive channel on PFIFO: %d\n", chid);
  195. return -EINVAL;
  196. }
  197. RAMFC_WR(DMA_PUT, nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUT));
  198. RAMFC_WR(DMA_GET, nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_GET));
  199. tmp = nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_DCOUNT) << 16;
  200. tmp |= nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_INSTANCE);
  201. RAMFC_WR(DMA_INSTANCE, tmp);
  202. RAMFC_WR(DMA_STATE, nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_STATE));
  203. RAMFC_WR(DMA_FETCH, nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_FETCH));
  204. RAMFC_WR(ENGINE, nv_rd32(dev, NV04_PFIFO_CACHE1_ENGINE));
  205. RAMFC_WR(PULL1_ENGINE, nv_rd32(dev, NV04_PFIFO_CACHE1_PULL1));
  206. nv04_fifo_do_load_context(dev, pfifo->channels - 1);
  207. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1);
  208. return 0;
  209. }
  210. static void
  211. nv04_fifo_init_reset(struct drm_device *dev)
  212. {
  213. nv_wr32(dev, NV03_PMC_ENABLE,
  214. nv_rd32(dev, NV03_PMC_ENABLE) & ~NV_PMC_ENABLE_PFIFO);
  215. nv_wr32(dev, NV03_PMC_ENABLE,
  216. nv_rd32(dev, NV03_PMC_ENABLE) | NV_PMC_ENABLE_PFIFO);
  217. nv_wr32(dev, 0x003224, 0x000f0078);
  218. nv_wr32(dev, 0x002044, 0x0101ffff);
  219. nv_wr32(dev, 0x002040, 0x000000ff);
  220. nv_wr32(dev, 0x002500, 0x00000000);
  221. nv_wr32(dev, 0x003000, 0x00000000);
  222. nv_wr32(dev, 0x003050, 0x00000000);
  223. nv_wr32(dev, 0x003200, 0x00000000);
  224. nv_wr32(dev, 0x003250, 0x00000000);
  225. nv_wr32(dev, 0x003220, 0x00000000);
  226. nv_wr32(dev, 0x003250, 0x00000000);
  227. nv_wr32(dev, 0x003270, 0x00000000);
  228. nv_wr32(dev, 0x003210, 0x00000000);
  229. }
  230. static void
  231. nv04_fifo_init_ramxx(struct drm_device *dev)
  232. {
  233. struct drm_nouveau_private *dev_priv = dev->dev_private;
  234. nv_wr32(dev, NV03_PFIFO_RAMHT, (0x03 << 24) /* search 128 */ |
  235. ((dev_priv->ramht->bits - 9) << 16) |
  236. (dev_priv->ramht->gpuobj->pinst >> 8));
  237. nv_wr32(dev, NV03_PFIFO_RAMRO, dev_priv->ramro->pinst >> 8);
  238. nv_wr32(dev, NV03_PFIFO_RAMFC, dev_priv->ramfc->pinst >> 8);
  239. }
  240. static void
  241. nv04_fifo_init_intr(struct drm_device *dev)
  242. {
  243. nouveau_irq_register(dev, 8, nv04_fifo_isr);
  244. nv_wr32(dev, 0x002100, 0xffffffff);
  245. nv_wr32(dev, 0x002140, 0xffffffff);
  246. }
  247. int
  248. nv04_fifo_init(struct drm_device *dev)
  249. {
  250. struct drm_nouveau_private *dev_priv = dev->dev_private;
  251. struct nouveau_fifo_engine *pfifo = &dev_priv->engine.fifo;
  252. int i;
  253. nv04_fifo_init_reset(dev);
  254. nv04_fifo_init_ramxx(dev);
  255. nv04_fifo_do_load_context(dev, pfifo->channels - 1);
  256. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH1, pfifo->channels - 1);
  257. nv04_fifo_init_intr(dev);
  258. pfifo->enable(dev);
  259. pfifo->reassign(dev, true);
  260. for (i = 0; i < dev_priv->engine.fifo.channels; i++) {
  261. if (dev_priv->channels.ptr[i]) {
  262. uint32_t mode = nv_rd32(dev, NV04_PFIFO_MODE);
  263. nv_wr32(dev, NV04_PFIFO_MODE, mode | (1 << i));
  264. }
  265. }
  266. return 0;
  267. }
  268. void
  269. nv04_fifo_fini(struct drm_device *dev)
  270. {
  271. nv_wr32(dev, 0x2140, 0x00000000);
  272. nouveau_irq_unregister(dev, 8);
  273. }
  274. static bool
  275. nouveau_fifo_swmthd(struct drm_device *dev, u32 chid, u32 addr, u32 data)
  276. {
  277. struct drm_nouveau_private *dev_priv = dev->dev_private;
  278. struct nouveau_channel *chan = NULL;
  279. struct nouveau_gpuobj *obj;
  280. unsigned long flags;
  281. const int subc = (addr >> 13) & 0x7;
  282. const int mthd = addr & 0x1ffc;
  283. bool handled = false;
  284. u32 engine;
  285. spin_lock_irqsave(&dev_priv->channels.lock, flags);
  286. if (likely(chid >= 0 && chid < dev_priv->engine.fifo.channels))
  287. chan = dev_priv->channels.ptr[chid];
  288. if (unlikely(!chan))
  289. goto out;
  290. switch (mthd) {
  291. case 0x0000: /* bind object to subchannel */
  292. obj = nouveau_ramht_find(chan, data);
  293. if (unlikely(!obj || obj->engine != NVOBJ_ENGINE_SW))
  294. break;
  295. chan->sw_subchannel[subc] = obj->class;
  296. engine = 0x0000000f << (subc * 4);
  297. nv_mask(dev, NV04_PFIFO_CACHE1_ENGINE, engine, 0x00000000);
  298. handled = true;
  299. break;
  300. default:
  301. engine = nv_rd32(dev, NV04_PFIFO_CACHE1_ENGINE);
  302. if (unlikely(((engine >> (subc * 4)) & 0xf) != 0))
  303. break;
  304. if (!nouveau_gpuobj_mthd_call(chan, chan->sw_subchannel[subc],
  305. mthd, data))
  306. handled = true;
  307. break;
  308. }
  309. out:
  310. spin_unlock_irqrestore(&dev_priv->channels.lock, flags);
  311. return handled;
  312. }
  313. void
  314. nv04_fifo_isr(struct drm_device *dev)
  315. {
  316. struct drm_nouveau_private *dev_priv = dev->dev_private;
  317. struct nouveau_engine *engine = &dev_priv->engine;
  318. uint32_t status, reassign;
  319. int cnt = 0;
  320. reassign = nv_rd32(dev, NV03_PFIFO_CACHES) & 1;
  321. while ((status = nv_rd32(dev, NV03_PFIFO_INTR_0)) && (cnt++ < 100)) {
  322. uint32_t chid, get;
  323. nv_wr32(dev, NV03_PFIFO_CACHES, 0);
  324. chid = engine->fifo.channel_id(dev);
  325. get = nv_rd32(dev, NV03_PFIFO_CACHE1_GET);
  326. if (status & NV_PFIFO_INTR_CACHE_ERROR) {
  327. uint32_t mthd, data;
  328. int ptr;
  329. /* NV_PFIFO_CACHE1_GET actually goes to 0xffc before
  330. * wrapping on my G80 chips, but CACHE1 isn't big
  331. * enough for this much data.. Tests show that it
  332. * wraps around to the start at GET=0x800.. No clue
  333. * as to why..
  334. */
  335. ptr = (get & 0x7ff) >> 2;
  336. if (dev_priv->card_type < NV_40) {
  337. mthd = nv_rd32(dev,
  338. NV04_PFIFO_CACHE1_METHOD(ptr));
  339. data = nv_rd32(dev,
  340. NV04_PFIFO_CACHE1_DATA(ptr));
  341. } else {
  342. mthd = nv_rd32(dev,
  343. NV40_PFIFO_CACHE1_METHOD(ptr));
  344. data = nv_rd32(dev,
  345. NV40_PFIFO_CACHE1_DATA(ptr));
  346. }
  347. if (!nouveau_fifo_swmthd(dev, chid, mthd, data)) {
  348. NV_INFO(dev, "PFIFO_CACHE_ERROR - Ch %d/%d "
  349. "Mthd 0x%04x Data 0x%08x\n",
  350. chid, (mthd >> 13) & 7, mthd & 0x1ffc,
  351. data);
  352. }
  353. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_PUSH, 0);
  354. nv_wr32(dev, NV03_PFIFO_INTR_0,
  355. NV_PFIFO_INTR_CACHE_ERROR);
  356. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0,
  357. nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH0) & ~1);
  358. nv_wr32(dev, NV03_PFIFO_CACHE1_GET, get + 4);
  359. nv_wr32(dev, NV03_PFIFO_CACHE1_PUSH0,
  360. nv_rd32(dev, NV03_PFIFO_CACHE1_PUSH0) | 1);
  361. nv_wr32(dev, NV04_PFIFO_CACHE1_HASH, 0);
  362. nv_wr32(dev, NV04_PFIFO_CACHE1_DMA_PUSH,
  363. nv_rd32(dev, NV04_PFIFO_CACHE1_DMA_PUSH) | 1);
  364. nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1);
  365. status &= ~NV_PFIFO_INTR_CACHE_ERROR;
  366. }
  367. if (status & NV_PFIFO_INTR_DMA_PUSHER) {
  368. u32 dma_get = nv_rd32(dev, 0x003244);
  369. u32 dma_put = nv_rd32(dev, 0x003240);
  370. u32 push = nv_rd32(dev, 0x003220);
  371. u32 state = nv_rd32(dev, 0x003228);
  372. if (dev_priv->card_type == NV_50) {
  373. u32 ho_get = nv_rd32(dev, 0x003328);
  374. u32 ho_put = nv_rd32(dev, 0x003320);
  375. u32 ib_get = nv_rd32(dev, 0x003334);
  376. u32 ib_put = nv_rd32(dev, 0x003330);
  377. if (nouveau_ratelimit())
  378. NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%02x%08x "
  379. "Put 0x%02x%08x IbGet 0x%08x IbPut 0x%08x "
  380. "State 0x%08x Push 0x%08x\n",
  381. chid, ho_get, dma_get, ho_put,
  382. dma_put, ib_get, ib_put, state,
  383. push);
  384. /* METHOD_COUNT, in DMA_STATE on earlier chipsets */
  385. nv_wr32(dev, 0x003364, 0x00000000);
  386. if (dma_get != dma_put || ho_get != ho_put) {
  387. nv_wr32(dev, 0x003244, dma_put);
  388. nv_wr32(dev, 0x003328, ho_put);
  389. } else
  390. if (ib_get != ib_put) {
  391. nv_wr32(dev, 0x003334, ib_put);
  392. }
  393. } else {
  394. NV_INFO(dev, "PFIFO_DMA_PUSHER - Ch %d Get 0x%08x "
  395. "Put 0x%08x State 0x%08x Push 0x%08x\n",
  396. chid, dma_get, dma_put, state, push);
  397. if (dma_get != dma_put)
  398. nv_wr32(dev, 0x003244, dma_put);
  399. }
  400. nv_wr32(dev, 0x003228, 0x00000000);
  401. nv_wr32(dev, 0x003220, 0x00000001);
  402. nv_wr32(dev, 0x002100, NV_PFIFO_INTR_DMA_PUSHER);
  403. status &= ~NV_PFIFO_INTR_DMA_PUSHER;
  404. }
  405. if (status & NV_PFIFO_INTR_SEMAPHORE) {
  406. uint32_t sem;
  407. status &= ~NV_PFIFO_INTR_SEMAPHORE;
  408. nv_wr32(dev, NV03_PFIFO_INTR_0,
  409. NV_PFIFO_INTR_SEMAPHORE);
  410. sem = nv_rd32(dev, NV10_PFIFO_CACHE1_SEMAPHORE);
  411. nv_wr32(dev, NV10_PFIFO_CACHE1_SEMAPHORE, sem | 0x1);
  412. nv_wr32(dev, NV03_PFIFO_CACHE1_GET, get + 4);
  413. nv_wr32(dev, NV04_PFIFO_CACHE1_PULL0, 1);
  414. }
  415. if (dev_priv->card_type == NV_50) {
  416. if (status & 0x00000010) {
  417. nv50_fb_vm_trap(dev, 1, "PFIFO_BAR_FAULT");
  418. status &= ~0x00000010;
  419. nv_wr32(dev, 0x002100, 0x00000010);
  420. }
  421. }
  422. if (status) {
  423. if (nouveau_ratelimit())
  424. NV_INFO(dev, "PFIFO_INTR 0x%08x - Ch %d\n",
  425. status, chid);
  426. nv_wr32(dev, NV03_PFIFO_INTR_0, status);
  427. status = 0;
  428. }
  429. nv_wr32(dev, NV03_PFIFO_CACHES, reassign);
  430. }
  431. if (status) {
  432. NV_INFO(dev, "PFIFO still angry after %d spins, halt\n", cnt);
  433. nv_wr32(dev, 0x2140, 0);
  434. nv_wr32(dev, 0x140, 0);
  435. }
  436. nv_wr32(dev, NV03_PMC_INTR_0, NV_PMC_INTR_0_PFIFO_PENDING);
  437. }