nouveau/gsp: fix getting max channel id for GSP
Subsystems (3)
Dave Airlie
maintainerPATCH 1/1 nouveau/gsp: fix getting max channel id for GSP
From: Dave Airlie <[email protected]>
The fence code uses the total number of channel ids to allocate a bunch of memory for fencing. This is probably not the best way to do this, but it's hard to fix right now.
The GSP code realises it can fit 8 channels into a USERD page, so it claims it can support 256 channels max, but it then allocates channel ids sparsely (0, 8, 16 etc).
This just exposes the multiplier to userspace so the fence code gets things right, however I think this might all need more thought.
--- drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c | 7 ++++++- drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 ++ drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +6 -1
@@ -178,7 +178,12 @@ nvkm_fifo_info(struct nvkm_engine *engine, u64 mthd, u64 *data)return ret;switch (mthd) { -case NV_DEVICE_HOST_CHANNELS : *data = fifo->chid ? fifo->chid->nr :0 ;return 0 ; +case NV_DEVICE_HOST_CHANNELS : +if (fifo->func->chid_total) + *data = fifo->func->chid_total (fifo); +else + *data = fifo->chid ? fifo->chid->nr :0 ; +return 0 ;case NV_DEVICE_HOST_RUNLISTS : *data =0 ;nvkm_runl_foreach (runl, fifo)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +2 -0
@@ -17,6 +17,8 @@ struct nvkm_fifo_func {int (*chid_nr)(struct nvkm_fifo *);int (*chid_ctor)(struct nvkm_fifo *,int nr); + +int (*chid_total)(struct nvkm_fifo *);int (*runq_nr)(struct nvkm_fifo *);int (*runl_ctor)(struct nvkm_fifo *);
drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c +7 -0
@@ -641,6 +641,12 @@ r535_fifo_dtor(struct nvkm_fifo *fifo)kfree (fifo->func); } +static int +r535_fifo_chid_total (struct nvkm_fifo *fifo) +{ +return fifo->chid->nr *CHID_PER_USERD ; +} +int r535_fifo_new (const struct nvkm_fifo_func *hw,struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_fifo **pfifo)
@@ -652,6 +658,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device, rm->dtor = r535_fifo_dtor; rm->runl_ctor = r535_fifo_runl_ctor; + rm->chid_total = r535_fifo_chid_total; rm->runl = &r535_runl; rm->cgrp = hw->cgrp; rm->cgrp.func = &r535_cgrp;
Signature · 1 line
2.42.0
Dave Airlie
maintainerSelf NAK, this isn't sufficient to fix events.
Quoted 81 lines · Dave Airlie
From: Dave Airlie <[email protected]>
The fence code uses the total number of channel ids to allocate a bunch of memory for fencing. This is probably not the best way to do this, but it's hard to fix right now.
The GSP code realises it can fit 8 channels into a USERD page, so it claims it can support 256 channels max, but it then allocates channel ids sparsely (0, 8, 16 etc).
This just exposes the multiplier to userspace so the fence code gets things right, however I think this might all need more thought.
Signed-off-by Dave Airlie <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c | 7 ++++++- drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h | 2 ++ drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c | 7 +++++++ 3 files changed, 15 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +6
-1@@ -178,7 +178,12 @@ nvkm_fifo_info(struct nvkm_engine *engine, u64 mthd, u64 *data)return ret;switch (mthd) { -case NV_DEVICE_HOST_CHANNELS : *data = fifo->chid ? fifo->chid->nr :0 ;return 0 ; +case NV_DEVICE_HOST_CHANNELS : +if (fifo->func->chid_total) + *data = fifo->func->chid_total (fifo); +else + *data = fifo->chid ? fifo->chid->nr :0 ; +return 0 ;case NV_DEVICE_HOST_RUNLISTS : *data =0 ;nvkm_runl_foreach (runl, fifo)drivers/gpu/drm/nouveau/nvkm/engine/fifo/priv.h +2
-0@@ -17,6 +17,8 @@ struct nvkm_fifo_func {int (*chid_nr)(struct nvkm_fifo *);int (*chid_ctor)(struct nvkm_fifo *,int nr); + +int (*chid_total)(struct nvkm_fifo *);int (*runq_nr)(struct nvkm_fifo *);int (*runl_ctor)(struct nvkm_fifo *);drivers/gpu/drm/nouveau/nvkm/engine/fifo/r535.c +7
-1@@ -641,6 +641,12 @@ r535_fifo_dtor(struct nvkm_fifo *fifo)kfree (fifo->func); } +static int +r535_fifo_chid_total (struct nvkm_fifo *fifo) +{ +return fifo->chid->nr *CHID_PER_USERD ; +} +int r535_fifo_new (const struct nvkm_fifo_func *hw,struct nvkm_device *device,enum nvkm_subdev_type type,int inst,struct nvkm_fifo **pfifo)@@ -652,6 +658,7 @@ r535_fifo_new(const struct nvkm_fifo_func *hw, struct nvkm_device *device, rm->dtor = r535_fifo_dtor; rm->runl_ctor = r535_fifo_runl_ctor; + rm->chid_total = r535_fifo_chid_total; rm->runl = &r535_runl; rm->cgrp = hw->cgrp; rm->cgrp.func = &r535_cgrp; --2.42.0