gk104.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef __GK104_FIFO_H__
  2. #define __GK104_FIFO_H__
  3. #define gk104_fifo(p) container_of((p), struct gk104_fifo, base)
  4. #include "priv.h"
  5. #include <core/enum.h>
  6. #include <subdev/mmu.h>
  7. struct gk104_fifo_chan;
  8. struct gk104_fifo {
  9. const struct gk104_fifo_func *func;
  10. struct nvkm_fifo base;
  11. struct {
  12. struct work_struct work;
  13. u32 engm;
  14. u32 runm;
  15. } recover;
  16. int pbdma_nr;
  17. struct {
  18. struct nvkm_engine *engine;
  19. int runl;
  20. int pbid;
  21. } engine[16];
  22. int engine_nr;
  23. struct {
  24. struct nvkm_memory *mem[2];
  25. int next;
  26. wait_queue_head_t wait;
  27. struct list_head chan;
  28. u32 engm;
  29. } runlist[16];
  30. int runlist_nr;
  31. struct {
  32. struct nvkm_memory *mem;
  33. struct nvkm_vma bar;
  34. } user;
  35. };
  36. struct gk104_fifo_func {
  37. struct {
  38. const struct nvkm_enum *engine;
  39. const struct nvkm_enum *reason;
  40. const struct nvkm_enum *hubclient;
  41. const struct nvkm_enum *gpcclient;
  42. } fault;
  43. const struct nvkm_fifo_chan_oclass *chan[];
  44. };
  45. int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *,
  46. int index, int nr, struct nvkm_fifo **);
  47. void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
  48. void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
  49. void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl);
  50. static inline u64
  51. gk104_fifo_engine_subdev(int engine)
  52. {
  53. switch (engine) {
  54. case 0: return (1ULL << NVKM_ENGINE_GR) |
  55. (1ULL << NVKM_ENGINE_SW) |
  56. (1ULL << NVKM_ENGINE_CE2);
  57. case 1: return (1ULL << NVKM_ENGINE_MSPDEC);
  58. case 2: return (1ULL << NVKM_ENGINE_MSPPP);
  59. case 3: return (1ULL << NVKM_ENGINE_MSVLD);
  60. case 4: return (1ULL << NVKM_ENGINE_CE0);
  61. case 5: return (1ULL << NVKM_ENGINE_CE1);
  62. case 6: return (1ULL << NVKM_ENGINE_MSENC);
  63. default:
  64. WARN_ON(1);
  65. return 0;
  66. }
  67. }
  68. extern const struct nvkm_enum gk104_fifo_fault_engine[];
  69. extern const struct nvkm_enum gk104_fifo_fault_reason[];
  70. extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
  71. extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
  72. extern const struct nvkm_enum gm107_fifo_fault_engine[];
  73. #endif