linux/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2#ifndef __GK104_FIFO_H__
   3#define __GK104_FIFO_H__
   4#define gk104_fifo(p) container_of((p), struct gk104_fifo, base)
   5#include "priv.h"
   6struct nvkm_fifo_cgrp;
   7
   8#include <core/enum.h>
   9#include <subdev/mmu.h>
  10
  11struct gk104_fifo_chan;
  12struct gk104_fifo {
  13        const struct gk104_fifo_func *func;
  14        struct nvkm_fifo base;
  15
  16        struct {
  17                struct work_struct work;
  18                u32 engm;
  19                u32 runm;
  20        } recover;
  21
  22        int pbdma_nr;
  23
  24        struct {
  25                struct nvkm_engine *engine;
  26                int runl;
  27                int pbid;
  28        } engine[16];
  29        int engine_nr;
  30
  31        struct {
  32                struct nvkm_memory *mem[2];
  33                int next;
  34                wait_queue_head_t wait;
  35                struct list_head cgrp;
  36                struct list_head chan;
  37                u32 engm;
  38        } runlist[16];
  39        int runlist_nr;
  40
  41        struct {
  42                struct nvkm_memory *mem;
  43                struct nvkm_vma *bar;
  44        } user;
  45};
  46
  47struct gk104_fifo_func {
  48        const struct gk104_fifo_pbdma_func {
  49                int (*nr)(struct gk104_fifo *);
  50                void (*init)(struct gk104_fifo *);
  51                void (*init_timeout)(struct gk104_fifo *);
  52        } *pbdma;
  53
  54        struct {
  55                const struct nvkm_enum *access;
  56                const struct nvkm_enum *engine;
  57                const struct nvkm_enum *reason;
  58                const struct nvkm_enum *hubclient;
  59                const struct nvkm_enum *gpcclient;
  60        } fault;
  61
  62        const struct gk104_fifo_runlist_func {
  63                u8 size;
  64                void (*cgrp)(struct nvkm_fifo_cgrp *,
  65                             struct nvkm_memory *, u32 offset);
  66                void (*chan)(struct gk104_fifo_chan *,
  67                             struct nvkm_memory *, u32 offset);
  68                void (*commit)(struct gk104_fifo *, int runl,
  69                               struct nvkm_memory *, int entries);
  70        } *runlist;
  71
  72        struct gk104_fifo_user_user {
  73                struct nvkm_sclass user;
  74                int (*ctor)(const struct nvkm_oclass *, void *, u32,
  75                            struct nvkm_object **);
  76        } user;
  77
  78        struct gk104_fifo_chan_user {
  79                struct nvkm_sclass user;
  80                int (*ctor)(struct gk104_fifo *, const struct nvkm_oclass *,
  81                            void *, u32, struct nvkm_object **);
  82        } chan;
  83        bool cgrp_force;
  84};
  85
  86int gk104_fifo_new_(const struct gk104_fifo_func *, struct nvkm_device *,
  87                    int index, int nr, struct nvkm_fifo **);
  88void gk104_fifo_runlist_insert(struct gk104_fifo *, struct gk104_fifo_chan *);
  89void gk104_fifo_runlist_remove(struct gk104_fifo *, struct gk104_fifo_chan *);
  90void gk104_fifo_runlist_update(struct gk104_fifo *, int runl);
  91
  92extern const struct gk104_fifo_pbdma_func gk104_fifo_pbdma;
  93int gk104_fifo_pbdma_nr(struct gk104_fifo *);
  94void gk104_fifo_pbdma_init(struct gk104_fifo *);
  95extern const struct nvkm_enum gk104_fifo_fault_access[];
  96extern const struct nvkm_enum gk104_fifo_fault_engine[];
  97extern const struct nvkm_enum gk104_fifo_fault_reason[];
  98extern const struct nvkm_enum gk104_fifo_fault_hubclient[];
  99extern const struct nvkm_enum gk104_fifo_fault_gpcclient[];
 100extern const struct gk104_fifo_runlist_func gk104_fifo_runlist;
 101void gk104_fifo_runlist_chan(struct gk104_fifo_chan *,
 102                             struct nvkm_memory *, u32);
 103void gk104_fifo_runlist_commit(struct gk104_fifo *, int runl,
 104                               struct nvkm_memory *, int);
 105
 106extern const struct gk104_fifo_runlist_func gk110_fifo_runlist;
 107void gk110_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
 108                             struct nvkm_memory *, u32);
 109
 110extern const struct gk104_fifo_pbdma_func gk208_fifo_pbdma;
 111void gk208_fifo_pbdma_init_timeout(struct gk104_fifo *);
 112
 113extern const struct nvkm_enum gm107_fifo_fault_engine[];
 114extern const struct gk104_fifo_runlist_func gm107_fifo_runlist;
 115
 116extern const struct gk104_fifo_pbdma_func gm200_fifo_pbdma;
 117int gm200_fifo_pbdma_nr(struct gk104_fifo *);
 118
 119extern const struct nvkm_enum gp100_fifo_fault_engine[];
 120
 121extern const struct nvkm_enum gv100_fifo_fault_access[];
 122extern const struct nvkm_enum gv100_fifo_fault_reason[];
 123extern const struct nvkm_enum gv100_fifo_fault_hubclient[];
 124extern const struct nvkm_enum gv100_fifo_fault_gpcclient[];
 125void gv100_fifo_runlist_cgrp(struct nvkm_fifo_cgrp *,
 126                             struct nvkm_memory *, u32);
 127void gv100_fifo_runlist_chan(struct gk104_fifo_chan *,
 128                             struct nvkm_memory *, u32);
 129#endif
 130