From: Dave Airlie <airlied at redhat.com> Timur pointed this out before, and it just slipped my mind, but this might help some things work better, around pcie power management. Fixes: 8d55b0a940bb ("nouveau/gsp: add some basic registry entries.") Signed-off-by: Dave Airlie <airlied at redhat.com> --- drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c index 9ee58e2a0eb2..5e1fa176aac4 100644 --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c @@ -1078,7 +1078,6 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) if (IS_ERR(rpc)) return PTR_ERR(rpc); - rpc->size = sizeof(*rpc); rpc->numEntries = NV_GSP_REG_NUM_ENTRIES; str_offset = offsetof(typeof(*rpc), entries[NV_GSP_REG_NUM_ENTRIES]); @@ -1094,6 +1093,7 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) strings += name_len; str_offset += name_len; } + rpc->size = str_offset; return nvkm_gsp_rpc_wr(gsp, rpc, false); } -- 2.43.0
Danilo Krummrich
2024-Feb-05 16:40 UTC
[PATCH] nouveau/gsp: use correct size for registry rpc.
On 1/30/24 04:26, Dave Airlie wrote:> From: Dave Airlie <airlied at redhat.com> > > Timur pointed this out before, and it just slipped my mind, > but this might help some things work better, around pcie power > management. > > Fixes: 8d55b0a940bb ("nouveau/gsp: add some basic registry entries.") > Signed-off-by: Dave Airlie <airlied at redhat.com>Added stable CC for v6.7 and applied it to drm-misc-fixes.> --- > drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c > index 9ee58e2a0eb2..5e1fa176aac4 100644 > --- a/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c > +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/r535.c > @@ -1078,7 +1078,6 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) > if (IS_ERR(rpc)) > return PTR_ERR(rpc); > > - rpc->size = sizeof(*rpc); > rpc->numEntries = NV_GSP_REG_NUM_ENTRIES; > > str_offset = offsetof(typeof(*rpc), entries[NV_GSP_REG_NUM_ENTRIES]); > @@ -1094,6 +1093,7 @@ r535_gsp_rpc_set_registry(struct nvkm_gsp *gsp) > strings += name_len; > str_offset += name_len; > } > + rpc->size = str_offset; > > return nvkm_gsp_rpc_wr(gsp, rpc, false); > }
Apparently Analagous Threads
- [PATCH] [v2] nouveau: add command-line GSP-RM registry support
- [PATCH] [v4] nouveau: add command-line GSP-RM registry support
- [PATCH] nouveau/gsp: Avoid addressing beyond end of rpc->entries
- [PATCH][next] nouveau/gsp: replace zero-length array with flex-array member and use __counted_by
- [PATCH][next] nouveau/gsp: replace zero-length array with flex-array member and use __counted_by