drm/nouveau/nvkm: fini object children in reverse order
Subsystems (3)
PATCH 1/10 drm/nouveau/nvkm: fini object children in reverse order
From: Ben Skeggs <[email protected]>
Turns out, we're currently tearing down the disp core channel *before* the satellite channels (wndw, etc) during suspend.
This makes RM return NV_ERR_NOT_SUPPORTED on attempting to reallocate the core channel on resume for some reason, but we probably shouldn't be doing it on HW either.
Tear down children in the reverse of allocation order instead.
--- drivers/gpu/drm/nouveau/nvkm/core/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/core/object.c +1 -1
@@ -185,7 +185,7 @@ nvkm_object_fini(struct nvkm_object *object, bool suspend)nvif_debug (object,"%s children...\n" , action); time =ktime_to_us (ktime_get ()); -list_for_each_entry (child, &object->tree, head) { +list_for_each_entry_reverse (child, &object->tree, head) { ret =nvkm_object_fini (child, suspend);if (ret && suspend) goto fail_child;
Signature · 1 line
2.40.1
PATCH 2/10 drm/nouveau/nvkm: punt spurious irq messages to debug level
From: Ben Skeggs <[email protected]>
This can be completely normal in some situations (ie. non-stall intrs when nothing is waiting on them).
--- drivers/gpu/drm/nouveau/nvkm/core/intr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/core/intr.c +2 -2
@@ -212,8 +212,8 @@ nvkm_intr(int irq, void *arg)list_for_each_entry (intr, &device->intr.intr, head) {for (leaf =0 ; leaf < intr->leaves; leaf++) {if (intr->stat[leaf]) { -nvkm_warn (intr->subdev,"intr%d: %08x\n" , - leaf, intr->stat[leaf]); +nvkm_debug (intr->subdev,"intr%d: %08x\n" , + leaf, intr->stat[leaf]);nvkm_intr_block_locked (intr, leaf, intr->stat[leaf]); } }
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 02/10] drm/nouveau/nvkm: punt spurious irq messages to debug level
Quoted 27 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
This can be completely normal in some situations (ie. non-stall intrs when nothing is waiting on them).
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/core/intr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nvkm/core/intr.c +2
-3@@ -212,8 +212,8 @@ nvkm_intr(int irq, void *arg)list_for_each_entry (intr, &device->intr.intr, head) {for (leaf =0 ; leaf < intr->leaves; leaf++) {if (intr->stat[leaf]) { -nvkm_warn (intr->subdev,"intr%d: %08x\n" , - leaf, intr->stat[leaf]); +nvkm_debug (intr->subdev,"intr%d: %08x\n" , + leaf, intr->stat[leaf]);nvkm_intr_block_locked (intr, leaf, intr->stat[leaf]); } } --
Quoted 2 lines
2.40.1
PATCH 3/10 drm/nouveau/fb/gp102-ga100: switch to simpler vram size detection method
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Also exposes this for use by upcoming GSP-RM initialisation code.
--- .../gpu/drm/nouveau/include/nvkm/subdev/fb.h | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c | 12 +++++ .../gpu/drm/nouveau/nvkm/subdev/fb/ga100.c | 3 +- .../gpu/drm/nouveau/nvkm/subdev/fb/gp102.c | 17 ++++++- .../gpu/drm/nouveau/nvkm/subdev/fb/gv100.c | 3 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h | 5 ++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h | 1 + .../gpu/drm/nouveau/nvkm/subdev/fb/ramgp102.c | 50 +++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/fb/tu102.c | 3 +- 10 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp102.c
drivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h +1 -0
@@ -59,6 +59,7 @@ struct nvkm_fb {struct nvkm_memory *mmu_wr; }; +u64 nvkm_fb_vidmem_size (struct nvkm_device *);int nvkm_fb_mem_unlock (struct nvkm_fb *); void nvkm_fb_tile_init(struct nvkm_fb *, int region, u32 addr, u32 size,
drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild +1 -0
@@ -55,6 +55,7 @@ nvkm-y += nvkm/subdev/fb/ramgk104.o nvkm-y += nvkm/subdev/fb/ramgm107.o nvkm-y += nvkm/subdev/fb/ramgm200.o nvkm-y += nvkm/subdev/fb/ramgp100.o +nvkm-y += nvkm/subdev/fb/ramgp102.o nvkm-y += nvkm/subdev/fb/ramga102.o nvkm-y += nvkm/subdev/fb/sddr2.o nvkm-y += nvkm/subdev/fb/sddr3.o
drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c +12 -0
@@ -174,6 +174,18 @@ nvkm_fb_mem_unlock(struct nvkm_fb *fb)return 0 ; } +u64 +nvkm_fb_vidmem_size (struct nvkm_device *device) +{ +struct nvkm_fb *fb = device->fb; + +if (fb && fb->func->vidmem.size) +return fb->func->vidmem.size (fb); + +WARN_ON (1 ); +return 0 ; +} +static int nvkm_fb_init (struct nvkm_subdev *subdev) {
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ga100.c +2 -1
@@ -30,7 +30,8 @@ ga100_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, - .ram_new = gp100_ram_new, + .vidmem.size = gp102_fb_vidmem_size, + .ram_new = gp102_ram_new, .default_bigpage = 16, };
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp102.c +16 -1
@@ -40,6 +40,20 @@ gp102_fb_vpr_scrub_required(struct nvkm_fb *fb)return (nvkm_rd32 (device,0x100cd0 ) &0x00000010 ) !=0 ; } +u64 +gp102_fb_vidmem_size (struct nvkm_fb *fb) +{ +const u32 data =nvkm_rd32 (fb->subdev.device,0x100ce0 ); +const u32 lmag = (data &0x000003f0 ) >>4 ; +const u32 lsca = (data &0x0000000f ); +const u64 size = (u64 )lmag << (lsca +20 ); + +if (data &0x40000000 ) +return size /16 *15 ; + +return size; +} +int gp102_fb_oneinit (struct nvkm_fb *fb) {
@@ -59,9 +73,10 @@ gp102_fb = { .init_remapper = gp100_fb_init_remapper, .init_page = gm200_fb_init_page, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, + .vidmem.size = gp102_fb_vidmem_size, .vpr.scrub_required = gp102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub, - .ram_new = gp100_ram_new, + .ram_new = gp102_ram_new, };int
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gv100.c +2 -1
@@ -36,9 +36,10 @@ gv100_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, + .vidmem.size = gp102_fb_vidmem_size, .vpr.scrub_required = gp102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub, - .ram_new = gp100_ram_new, + .ram_new = gp102_ram_new, .default_bigpage = 16, };
drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h +5 -0
@@ -20,6 +20,10 @@ struct nvkm_fb_func {void (*flush_page_init)(struct nvkm_fb *); } sysmem; +struct nvkm_fb_func_vidmem { +u64 (*size)(struct nvkm_fb *); + } vidmem; +struct {bool (*scrub_required)(struct nvkm_fb *);int (*scrub)(struct nvkm_fb *);
@@ -84,6 +88,7 @@ void gp100_fb_init_remapper(struct nvkm_fb *);void gp100_fb_init_unkn (struct nvkm_fb *);int gp102_fb_oneinit (struct nvkm_fb *); +u64 gp102_fb_vidmem_size (struct nvkm_fb *);bool gp102_fb_vpr_scrub_required (struct nvkm_fb *);int gp102_fb_vpr_scrub (struct nvkm_fb *);
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h +1 -0
@@ -70,5 +70,6 @@ int gk104_ram_new(struct nvkm_fb *, struct nvkm_ram **);int gm107_ram_new (struct nvkm_fb *,struct nvkm_ram **);int gm200_ram_new (struct nvkm_fb *,struct nvkm_ram **);int gp100_ram_new (struct nvkm_fb *,struct nvkm_ram **); +int gp102_ram_new (struct nvkm_fb *,struct nvkm_ram **);int ga102_ram_new (struct nvkm_fb *,struct nvkm_ram **);#endif
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp102.c new file +50 -0
50 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/subdev/fb/tu102.c +2 -1
@@ -36,9 +36,10 @@ tu102_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, + .vidmem.size = gp102_fb_vidmem_size, .vpr.scrub_required = tu102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub, - .ram_new = gp100_ram_new, + .ram_new = gp102_ram_new, .default_bigpage = 16, };
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 03/10] drm/nouveau/fb/gp102-ga100: switch to simpler vram size detection method
Quoted 86 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Also exposes this for use by upcoming GSP-RM initialisation code.
Signed-off-by Ben Skeggs <[email protected]>--- .../gpu/drm/nouveau/include/nvkm/subdev/fb.h | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c | 12 +++++ .../gpu/drm/nouveau/nvkm/subdev/fb/ga100.c | 3 +- .../gpu/drm/nouveau/nvkm/subdev/fb/gp102.c | 17 ++++++- .../gpu/drm/nouveau/nvkm/subdev/fb/gv100.c | 3 +- drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h | 5 ++ drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h | 1 + .../gpu/drm/nouveau/nvkm/subdev/fb/ramgp102.c | 50 +++++++++++++++++++ .../gpu/drm/nouveau/nvkm/subdev/fb/tu102.c | 3 +- 10 files changed, 92 insertions(+), 4 deletions(-) create mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp102.cdrivers/gpu/drm/nouveau/include/nvkm/subdev/fb.h +1
-0@@ -59,6 +59,7 @@ struct nvkm_fb {struct nvkm_memory *mmu_wr; }; +u64 nvkm_fb_vidmem_size (struct nvkm_device *);int nvkm_fb_mem_unlock (struct nvkm_fb *); void nvkm_fb_tile_init(struct nvkm_fb *, int region, u32 addr, u32 size,drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild +1
-0@@ -55,6 +55,7 @@ nvkm-y += nvkm/subdev/fb/ramgk104.o nvkm-y += nvkm/subdev/fb/ramgm107.o nvkm-y += nvkm/subdev/fb/ramgm200.o nvkm-y += nvkm/subdev/fb/ramgp100.o +nvkm-y += nvkm/subdev/fb/ramgp102.o nvkm-y += nvkm/subdev/fb/ramga102.o nvkm-y += nvkm/subdev/fb/sddr2.o nvkm-y += nvkm/subdev/fb/sddr3.odrivers/gpu/drm/nouveau/nvkm/subdev/fb/base.c +12
-0@@ -174,6 +174,18 @@ nvkm_fb_mem_unlock(struct nvkm_fb *fb)return 0 ; } +u64 +nvkm_fb_vidmem_size (struct nvkm_device *device) +{ +struct nvkm_fb *fb = device->fb; + +if (fb && fb->func->vidmem.size) +return fb->func->vidmem.size (fb); + +WARN_ON (1 ); +return 0 ; +} +static int nvkm_fb_init (struct nvkm_subdev *subdev) {drivers/gpu/drm/nouveau/nvkm/subdev/fb/ga100.c +2
-1@@ -30,7 +30,8 @@ ga100_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, - .ram_new = gp100_ram_new, + .vidmem.size = gp102_fb_vidmem_size, + .ram_new = gp102_ram_new, .default_bigpage = 16, };drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp102.c +0
-0
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp102.c gp102_fb_vpr_scrub_required(struct nvkm_fb *fb) · line 46
Quoted 7 lines
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp102.c +4
-0@@ -40,6 +40,20 @@ gp102_fb_vpr_scrub_required(struct nvkm_fb *fb)return (nvkm_rd32 (device,0x100cd0 ) &0x00000010 ) !=0 ; } +u64 +gp102_fb_vidmem_size (struct nvkm_fb *fb) +{ +const u32 data =nvkm_rd32 (fb->subdev.device,0x100ce0 );
Do we have any kind of documentation for this register?
Quoted 150 lines
drivers/gpu/drm/nouveau/nvkm/subdev/fb/gp102.c +12
-1+const u32 lmag = (data &0x000003f0 ) >>4 ; +const u32 lsca = (data &0x0000000f ); +const u64 size = (u64 )lmag << (lsca +20 ); + +if (data &0x40000000 ) +return size /16 *15 ; + +return size; +} +int gp102_fb_oneinit (struct nvkm_fb *fb) {@@ -59,9 +73,10 @@ gp102_fb = { .init_remapper = gp100_fb_init_remapper, .init_page = gm200_fb_init_page, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, + .vidmem.size = gp102_fb_vidmem_size, .vpr.scrub_required = gp102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub, - .ram_new = gp100_ram_new, + .ram_new = gp102_ram_new, };int drivers/gpu/drm/nouveau/nvkm/subdev/fb/gv100.c +2
-1@@ -36,9 +36,10 @@ gv100_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, + .vidmem.size = gp102_fb_vidmem_size, .vpr.scrub_required = gp102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub, - .ram_new = gp100_ram_new, + .ram_new = gp102_ram_new, .default_bigpage = 16, };drivers/gpu/drm/nouveau/nvkm/subdev/fb/priv.h +5
-0@@ -20,6 +20,10 @@ struct nvkm_fb_func {void (*flush_page_init)(struct nvkm_fb *); } sysmem; +struct nvkm_fb_func_vidmem { +u64 (*size)(struct nvkm_fb *); + } vidmem; +struct {bool (*scrub_required)(struct nvkm_fb *);int (*scrub)(struct nvkm_fb *);@@ -84,6 +88,7 @@ void gp100_fb_init_remapper(struct nvkm_fb *);void gp100_fb_init_unkn (struct nvkm_fb *);int gp102_fb_oneinit (struct nvkm_fb *); +u64 gp102_fb_vidmem_size (struct nvkm_fb *);bool gp102_fb_vpr_scrub_required (struct nvkm_fb *);int gp102_fb_vpr_scrub (struct nvkm_fb *);drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h +1
-0@@ -70,5 +70,6 @@ int gk104_ram_new(struct nvkm_fb *, struct nvkm_ram **);int gm107_ram_new (struct nvkm_fb *,struct nvkm_ram **);int gm200_ram_new (struct nvkm_fb *,struct nvkm_ram **);int gp100_ram_new (struct nvkm_fb *,struct nvkm_ram **); +int gp102_ram_new (struct nvkm_fb *,struct nvkm_ram **);int ga102_ram_new (struct nvkm_fb *,struct nvkm_ram **);#endif drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramgp102.c new file +50
-0@@ -0,0 +1,50 @@ +/* +* Copyright 2023 Red Hat Inc. +* +* Permission is hereby granted, free of charge, to any person obtaining a +* copy of this software and associated documentation files (the "Software"), +* to deal in the Software without restriction, including without limitation +* the rights to use, copy, modify, merge, publish, distribute, sublicense, +* and/or sell copies of the Software, and to permit persons to whom the +* Software is furnished to do so, subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included in +* all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +* OTHER DEALINGS IN THE SOFTWARE. +*/ +#include "ram.h" + +#include <subdev/bios.h> + +static const struct nvkm_ram_func +gp102_ram = { +}; + +int +gp102_ram_new (struct nvkm_fb *fb,struct nvkm_ram **pram) +{ +enum nvkm_ram_type type =nvkm_fb_bios_memtype (fb->subdev.device->bios); +const u32 rsvd_head = (256 *1024 );/* vga memory */ +const u32 rsvd_tail = (1024 *1024 );/* vbios etc */ +u64 size = fb->func->vidmem.size (fb); +int ret; + + ret =nvkm_ram_new_ (&gp102_ram, fb, type, size, pram); +if (ret) +return ret; + +nvkm_mm_fini (&(*pram)->vram); + +return nvkm_mm_init (&(*pram)->vram,NVKM_RAM_MM_NORMAL , + rsvd_head >>NVKM_RAM_MM_SHIFT , + (size - rsvd_head - rsvd_tail) >>NVKM_RAM_MM_SHIFT , +1 ); + +}drivers/gpu/drm/nouveau/nvkm/subdev/fb/tu102.c +2
-2@@ -36,9 +36,10 @@ tu102_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, + .vidmem.size = gp102_fb_vidmem_size, .vpr.scrub_required = tu102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub, - .ram_new = gp100_ram_new, + .ram_new = gp102_ram_new, .default_bigpage = 16, }; --2.40.1
PATCH 4/10 drm/nouveau/fb/ga102-: construct vidmem heap via new gp102 paths
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
No need for custom implementation anymore.
--- drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild | 1 - .../gpu/drm/nouveau/nvkm/subdev/fb/ga102.c | 9 ++++- drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h | 1 - .../gpu/drm/nouveau/nvkm/subdev/fb/ramga102.c | 40 ------------------- 4 files changed, 8 insertions(+), 43 deletions(-) delete mode 100644 drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramga102.c
drivers/gpu/drm/nouveau/nvkm/subdev/fb/Kbuild +0 -1
@@ -56,7 +56,6 @@ nvkm-y += nvkm/subdev/fb/ramgm107.o nvkm-y += nvkm/subdev/fb/ramgm200.o nvkm-y += nvkm/subdev/fb/ramgp100.o nvkm-y += nvkm/subdev/fb/ramgp102.o -nvkm-y += nvkm/subdev/fb/ramga102.o nvkm-y += nvkm/subdev/fb/sddr2.o nvkm-y += nvkm/subdev/fb/sddr3.o nvkm-y += nvkm/subdev/fb/gddr3.o
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ga102.c +8 -1
@@ -24,6 +24,12 @@#include <engine/nvdec.h> +static u64 +ga102_fb_vidmem_size (struct nvkm_fb *fb) +{ +return (u64 )nvkm_rd32 (fb->subdev.device,0x1183a4 ) <<20 ; +} +static int ga102_fb_oneinit (struct nvkm_fb *fb) {
@@ -43,7 +49,8 @@ ga102_fb = { .init_page = gv100_fb_init_page, .init_unkn = gp100_fb_init_unkn, .sysmem.flush_page_init = gf100_fb_sysmem_flush_page_init, - .ram_new = ga102_ram_new, + .vidmem.size = ga102_fb_vidmem_size, + .ram_new = gp102_ram_new, .default_bigpage = 16, .vpr.scrub_required = tu102_fb_vpr_scrub_required, .vpr.scrub = gp102_fb_vpr_scrub,
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ram.h +0 -1
@@ -71,5 +71,4 @@ int gm107_ram_new(struct nvkm_fb *, struct nvkm_ram **);int gm200_ram_new (struct nvkm_fb *,struct nvkm_ram **);int gp100_ram_new (struct nvkm_fb *,struct nvkm_ram **);int gp102_ram_new (struct nvkm_fb *,struct nvkm_ram **); -int ga102_ram_new (struct nvkm_fb *,struct nvkm_ram **);#endif
drivers/gpu/drm/nouveau/nvkm/subdev/fb/ramga102.c deleted +0 -40
@@ -1,40 +0,0 @@ -/* -* Copyright 2021 Red Hat Inc. -* -* Permission is hereby granted, free of charge, to any person obtaining a -* copy of this software and associated documentation files (the "Software"), -* to deal in the Software without restriction, including without limitation -* the rights to use, copy, modify, merge, publish, distribute, sublicense, -* and/or sell copies of the Software, and to permit persons to whom the -* Software is furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR -* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -* OTHER DEALINGS IN THE SOFTWARE. -*/ -#include "ram.h" - -#include <subdev/bios.h> -#include <subdev/bios/init.h> -#include <subdev/bios/rammap.h> - -static const struct nvkm_ram_func -ga102_ram = { -}; - -int -ga102_ram_new (struct nvkm_fb *fb,struct nvkm_ram **pram) -{ -struct nvkm_device *device = fb->subdev.device; -enum nvkm_ram_type type =nvkm_fb_bios_memtype (device->bios); -u32 size =nvkm_rd32 (device,0x1183a4 ); - -return nvkm_ram_new_ (&ga102_ram, fb, type, (u64 )size <<20 , pram); -}
Signature · 1 line
2.40.1
PATCH 5/10 drm/nouveau/fifo: remove left-over references to nvkm_fifo_chan
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
This was renamed to nvkm_chan in the host rework.
--- drivers/gpu/drm/nouveau/include/nvkm/core/engine.h | 5 ++--- drivers/gpu/drm/nouveau/include/nvkm/core/os.h | 5 ----- drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv25.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv2a.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv35.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c | 5 ++--- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/priv.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h | 2 +- 32 files changed, 37 insertions(+), 47 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h +2 -3
@@ -3,7 +3,7 @@#define __NVKM_ENGINE_H__#define nvkm_engine (p) container_of((p), struct nvkm_engine, subdev)#include <core/subdev.h> -struct nvkm_fifo_chan ; +struct nvkm_chan ;struct nvkm_fb_tile ;extern const struct nvkm_subdev_func nvkm_engine;
@@ -32,8 +32,7 @@ struct nvkm_engine_func { } base;struct { -int (*cclass)(struct nvkm_fifo_chan *, -const struct nvkm_oclass *, +int (*cclass)(struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);int (*sclass)(struct nvkm_oclass *,int index); } fifo;
drivers/gpu/drm/nouveau/include/nvkm/core/os.h +0 -5
@@ -49,9 +49,4 @@ nvkm_blob_dtor(struct nvkm_blob *blob) (p = container_of((h), typeof(*p), m), nvkm_list_find_next(p, (h), m, (c)))#define nvkm_list_foreach (p,h,m,c) \ for (p = nvkm_list_find(p, (h), m, (c)); p; p = nvkm_list_find_next(p, (h), m, (c))) - -/*FIXME: remove after */ -#define nvkm_fifo_chan nvkm_chan -#define nvkm_fifo_chan_func nvkm_chan_func -#define nvkm_fifo_cgrp nvkm_cgrp#endif
drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +1 -1
@@ -3,7 +3,7 @@#define __NVKM_FLCNEN_H__#define nvkm_falcon (p) container_of((p), struct nvkm_falcon, engine)#include <core/engine.h> -struct nvkm_fifo_chan ; +struct nvkm_chan ;enum nvkm_falcon_dmaidx {FALCON_DMAIDX_UCODE =0 ,
drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h +1 -1
@@ -3,7 +3,7 @@#define __NVKM_CE_PRIV_H__#include <engine/ce.h> -void gt215_ce_intr (struct nvkm_falcon *,struct nvkm_fifo_chan *); +void gt215_ce_intr (struct nvkm_falcon *,struct nvkm_chan *);void gk104_ce_intr (struct nvkm_engine *);void gp100_ce_intr (struct nvkm_engine *);
drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +1 -2
@@ -109,8 +109,7 @@ nvkm_gr_oclass_get(struct nvkm_oclass *oclass, int index) }static int -nvkm_gr_cclass_new (struct nvkm_fifo_chan *chan, -const struct nvkm_oclass *oclass, +nvkm_gr_cclass_new (struct nvkm_chan *chan,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_gr *gr =nvkm_gr (oclass->engine);
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +1 -1
@@ -374,7 +374,7 @@ gf100_gr_chan = { };static int -gf100_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +gf100_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c +1 -1
@@ -1181,7 +1181,7 @@ nv04_gr_chan = { };static int -nv04_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv04_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv04_gr *gr =nv04_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c +1 -1
@@ -999,7 +999,7 @@ nv10_gr_chan = { }while (0 ) int -nv10_gr_chan_new(struct nvkm_gr *base, struct nvkm_fifo_chan *fifoch, +nv10_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch, const struct nvkm_oclass *oclass, struct nvkm_object **pobject) { struct nv10_gr *gr = nv10_gr(base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.h +1 -1
@@ -9,6 +9,6 @@ int nv10_gr_init(struct nvkm_gr *);void nv10_gr_intr (struct nvkm_gr *);void nv10_gr_tile (struct nvkm_gr *,int ,struct nvkm_fb_tile *); -int nv10_gr_chan_new (struct nvkm_gr *,struct nvkm_fifo_chan *, +int nv10_gr_chan_new (struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);#endif
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c +1 -1
@@ -72,7 +72,7 @@ nv20_gr_chan = { };static int -nv20_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv20_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv25.c +1 -1
@@ -18,7 +18,7 @@ nv25_gr_chan = { };static int -nv25_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv25_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv2a.c +1 -1
@@ -18,7 +18,7 @@ nv2a_gr_chan = { };static int -nv2a_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv2a_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c +1 -1
@@ -19,7 +19,7 @@ nv30_gr_chan = { };static int -nv30_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv30_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c +1 -1
@@ -18,7 +18,7 @@ nv34_gr_chan = { };static int -nv34_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv34_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv35.c +1 -1
@@ -18,7 +18,7 @@ nv35_gr_chan = { };static int -nv35_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv35_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c +1 -1
@@ -145,7 +145,7 @@ nv40_gr_chan = { };int -nv40_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv40_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv40_gr *gr =nv40_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.h +2 -2
@@ -22,12 +22,12 @@ u64 nv40_gr_units(struct nvkm_gr *);struct nv40_gr_chan {struct nvkm_object object;struct nv40_gr *gr; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo;u32 inst;struct list_head head; }; -int nv40_gr_chan_new (struct nvkm_gr *,struct nvkm_fifo_chan *, +int nv40_gr_chan_new (struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);extern const struct nvkm_object_func nv40_gr_object;
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c +1 -1
@@ -86,7 +86,7 @@ nv50_gr_chan = { };int -nv50_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv50_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv50_gr *gr =nv50_gr (base);
drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.h +1 -1
@@ -27,7 +27,7 @@ struct nv50_gr_chan {struct nv50_gr *gr; }; -int nv50_gr_chan_new (struct nvkm_gr *,struct nvkm_fifo_chan *, +int nv50_gr_chan_new (struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);extern const struct nvkm_object_func nv50_gr_object;
drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h +2 -2
@@ -5,7 +5,7 @@#include <engine/gr.h> #include <core/enum.h> struct nvkm_fb_tile ; -struct nvkm_fifo_chan ; +struct nvkm_chan ;int nvkm_gr_ctor (const struct nvkm_gr_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,bool enable,struct nvkm_gr *);
@@ -21,7 +21,7 @@ struct nvkm_gr_func {void (*intr)(struct nvkm_gr *);void (*tile)(struct nvkm_gr *,int region,struct nvkm_fb_tile *);int (*tlb_flush)(struct nvkm_gr *); -int (*chan_new)(struct nvkm_gr *,struct nvkm_fifo_chan *, +int (*chan_new)(struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);int (*object_get)(struct nvkm_gr *,int ,struct nvkm_sclass *);/* Returns chipset-specific counts of units packed into an u64.
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c +1 -2
@@ -81,8 +81,7 @@ nv31_mpeg_chan = { };int -nv31_mpeg_chan_new (struct nvkm_fifo_chan *fifoch, -const struct nvkm_oclass *oclass, +nv31_mpeg_chan_new (struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv31_mpeg *mpeg =nv31_mpeg (oclass->engine);
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.h +2 -2
@@ -24,9 +24,9 @@ struct nv31_mpeg_func {struct nv31_mpeg_chan {struct nvkm_object object;struct nv31_mpeg *mpeg; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo; }; -int nv31_mpeg_chan_new (struct nvkm_fifo_chan *,const struct nvkm_oclass *, +int nv31_mpeg_chan_new (struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);#endif
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c +2 -3
@@ -43,7 +43,7 @@ struct nv44_mpeg {struct nv44_mpeg_chan {struct nvkm_object object;struct nv44_mpeg *mpeg; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo;struct list_head head;u32 inst; };
@@ -100,8 +100,7 @@ nv44_mpeg_chan = { };static int -nv44_mpeg_chan_new (struct nvkm_fifo_chan *fifoch, -const struct nvkm_oclass *oclass, +nv44_mpeg_chan_new (struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv44_mpeg *mpeg =nv44_mpeg (oclass->engine);
drivers/gpu/drm/nouveau/nvkm/engine/mpeg/priv.h +1 -1
@@ -2,7 +2,7 @@#ifndef __NVKM_MPEG_PRIV_H__#define __NVKM_MPEG_PRIV_H__#include <engine/mpeg.h> -struct nvkm_fifo_chan ; +struct nvkm_chan ;int nv31_mpeg_init (struct nvkm_engine *);void nv31_mpeg_tile (struct nvkm_engine *,int ,struct nvkm_fb_tile *);
drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c +1 -2
@@ -74,8 +74,7 @@ nvkm_sw_oclass_get(struct nvkm_oclass *oclass, int index) }static int -nvkm_sw_cclass_get (struct nvkm_fifo_chan *fifoch, -const struct nvkm_oclass *oclass, +nvkm_sw_cclass_get (struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_sw *sw =nvkm_sw (oclass->engine);
drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c +1 -1
@@ -74,7 +74,7 @@ nvkm_sw_chan = {int nvkm_sw_chan_ctor (const struct nvkm_sw_chan_func *func,struct nvkm_sw *sw, -struct nvkm_fifo_chan *fifo,const struct nvkm_oclass *oclass, +struct nvkm_chan *fifo,const struct nvkm_oclass *oclass,struct nvkm_sw_chan *chan) {unsigned long flags;
drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.h +2 -2
@@ -11,7 +11,7 @@ struct nvkm_sw_chan {const struct nvkm_sw_chan_func *func;struct nvkm_object object;struct nvkm_sw *sw; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo;struct list_head head;#define NVKM_SW_CHAN_EVENT_PAGE_FLIP BIT(0)
@@ -24,7 +24,7 @@ struct nvkm_sw_chan_func { };int nvkm_sw_chan_ctor (const struct nvkm_sw_chan_func *,struct nvkm_sw *, -struct nvkm_fifo_chan *,const struct nvkm_oclass *, +struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_sw_chan *);bool nvkm_sw_chan_mthd (struct nvkm_sw_chan *,int subc,u32 mthd,u32 data);#endif
drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c +1 -1
@@ -102,7 +102,7 @@ gf100_sw_chan = { };static int -gf100_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifoch, +gf100_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {
drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c +1 -1
@@ -106,7 +106,7 @@ nv04_sw_chan = { };static int -nv04_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifo, +nv04_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifo,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv04_sw_chan *chan;
drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c +1 -1
@@ -36,7 +36,7 @@ nv10_sw_chan = { };static int -nv10_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifo, +nv10_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifo,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_sw_chan *chan;
drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c +1 -1
@@ -99,7 +99,7 @@ nv50_sw_chan = { };static int -nv50_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifoch, +nv50_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_disp *disp = sw->engine.subdev.device->disp;
drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h +1 -1
@@ -15,7 +15,7 @@ struct nvkm_sw_chan_sclass { };struct nvkm_sw_func { -int (*chan_new)(struct nvkm_sw *,struct nvkm_fifo_chan *, +int (*chan_new)(struct nvkm_sw *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);const struct nvkm_sw_chan_sclass sclass[]; };
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 05/10] drm/nouveau/fifo: remove left-over references to nvkm_fifo_chan
Quoted 508 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
This was renamed to
nvkm_chanin the host rework.Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/include/nvkm/core/engine.h | 5 ++--- drivers/gpu/drm/nouveau/include/nvkm/core/os.h | 5 ----- drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv25.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv2a.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv35.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c | 5 ++--- drivers/gpu/drm/nouveau/nvkm/engine/mpeg/priv.h | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c | 3 +-- drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.h | 4 ++-- drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h | 2 +- 32 files changed, 37 insertions(+), 47 deletions(-)drivers/gpu/drm/nouveau/include/nvkm/core/engine.h +2
-3@@ -3,7 +3,7 @@#define __NVKM_ENGINE_H__#define nvkm_engine (p) container_of((p), struct nvkm_engine, subdev)#include <core/subdev.h> -struct nvkm_fifo_chan ; +struct nvkm_chan ;struct nvkm_fb_tile ;extern const struct nvkm_subdev_func nvkm_engine;@@ -32,8 +32,7 @@ struct nvkm_engine_func { } base;struct { -int (*cclass)(struct nvkm_fifo_chan *, -const struct nvkm_oclass *, +int (*cclass)(struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);int (*sclass)(struct nvkm_oclass *,int index); } fifo;drivers/gpu/drm/nouveau/include/nvkm/core/os.h +0
-5@@ -49,9 +49,4 @@ nvkm_blob_dtor(struct nvkm_blob *blob) (p = container_of((h), typeof(*p), m), nvkm_list_find_next(p, (h), m, (c)))#define nvkm_list_foreach (p,h,m,c) \ for (p = nvkm_list_find(p, (h), m, (c)); p; p = nvkm_list_find_next(p, (h), m, (c))) - -/*FIXME: remove after */ -#define nvkm_fifo_chan nvkm_chan -#define nvkm_fifo_chan_func nvkm_chan_func -#define nvkm_fifo_cgrp nvkm_cgrp#endif drivers/gpu/drm/nouveau/include/nvkm/engine/falcon.h +1
-1@@ -3,7 +3,7 @@#define __NVKM_FLCNEN_H__#define nvkm_falcon (p) container_of((p), struct nvkm_falcon, engine)#include <core/engine.h> -struct nvkm_fifo_chan ; +struct nvkm_chan ;enum nvkm_falcon_dmaidx {FALCON_DMAIDX_UCODE =0 ,drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h +1
-1@@ -3,7 +3,7 @@#define __NVKM_CE_PRIV_H__#include <engine/ce.h> -void gt215_ce_intr (struct nvkm_falcon *,struct nvkm_fifo_chan *); +void gt215_ce_intr (struct nvkm_falcon *,struct nvkm_chan *);void gk104_ce_intr (struct nvkm_engine *);void gp100_ce_intr (struct nvkm_engine *);drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +1
-2@@ -109,8 +109,7 @@ nvkm_gr_oclass_get(struct nvkm_oclass *oclass, int index) }static int -nvkm_gr_cclass_new (struct nvkm_fifo_chan *chan, -const struct nvkm_oclass *oclass, +nvkm_gr_cclass_new (struct nvkm_chan *chan,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_gr *gr =nvkm_gr (oclass->engine);drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +1
-1@@ -374,7 +374,7 @@ gf100_gr_chan = { };static int -gf100_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +gf100_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {drivers/gpu/drm/nouveau/nvkm/engine/gr/nv04.c +1
-1@@ -1181,7 +1181,7 @@ nv04_gr_chan = { };static int -nv04_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv04_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv04_gr *gr =nv04_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.c +1
-1@@ -999,7 +999,7 @@ nv10_gr_chan = { }while (0 ) int -nv10_gr_chan_new(struct nvkm_gr *base, struct nvkm_fifo_chan *fifoch, +nv10_gr_chan_new(struct nvkm_gr *base, struct nvkm_chan *fifoch, const struct nvkm_oclass *oclass, struct nvkm_object **pobject) { struct nv10_gr *gr = nv10_gr(base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv10.h +1
-1@@ -9,6 +9,6 @@ int nv10_gr_init(struct nvkm_gr *);void nv10_gr_intr (struct nvkm_gr *);void nv10_gr_tile (struct nvkm_gr *,int ,struct nvkm_fb_tile *); -int nv10_gr_chan_new (struct nvkm_gr *,struct nvkm_fifo_chan *, +int nv10_gr_chan_new (struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);#endif drivers/gpu/drm/nouveau/nvkm/engine/gr/nv20.c +1
-1@@ -72,7 +72,7 @@ nv20_gr_chan = { };static int -nv20_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv20_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv25.c +1
-1@@ -18,7 +18,7 @@ nv25_gr_chan = { };static int -nv25_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv25_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv2a.c +1
-1@@ -18,7 +18,7 @@ nv2a_gr_chan = { };static int -nv2a_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv2a_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv30.c +1
-1@@ -19,7 +19,7 @@ nv30_gr_chan = { };static int -nv30_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv30_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv34.c +1
-1@@ -18,7 +18,7 @@ nv34_gr_chan = { };static int -nv34_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv34_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv35.c +1
-1@@ -18,7 +18,7 @@ nv35_gr_chan = { };static int -nv35_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv35_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv20_gr *gr =nv20_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.c +1
-1@@ -145,7 +145,7 @@ nv40_gr_chan = { };int -nv40_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv40_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv40_gr *gr =nv40_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv40.h +2
-2@@ -22,12 +22,12 @@ u64 nv40_gr_units(struct nvkm_gr *);struct nv40_gr_chan {struct nvkm_object object;struct nv40_gr *gr; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo;u32 inst;struct list_head head; }; -int nv40_gr_chan_new (struct nvkm_gr *,struct nvkm_fifo_chan *, +int nv40_gr_chan_new (struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);extern const struct nvkm_object_func nv40_gr_object;drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.c +1
-1@@ -86,7 +86,7 @@ nv50_gr_chan = { };int -nv50_gr_chan_new (struct nvkm_gr *base,struct nvkm_fifo_chan *fifoch, +nv50_gr_chan_new (struct nvkm_gr *base,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv50_gr *gr =nv50_gr (base);drivers/gpu/drm/nouveau/nvkm/engine/gr/nv50.h +1
-1@@ -27,7 +27,7 @@ struct nv50_gr_chan {struct nv50_gr *gr; }; -int nv50_gr_chan_new (struct nvkm_gr *,struct nvkm_fifo_chan *, +int nv50_gr_chan_new (struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);extern const struct nvkm_object_func nv50_gr_object;drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h +2
-2@@ -5,7 +5,7 @@#include <engine/gr.h> #include <core/enum.h> struct nvkm_fb_tile ; -struct nvkm_fifo_chan ; +struct nvkm_chan ;int nvkm_gr_ctor (const struct nvkm_gr_func *,struct nvkm_device *,enum nvkm_subdev_type ,int ,bool enable,struct nvkm_gr *);@@ -21,7 +21,7 @@ struct nvkm_gr_func {void (*intr)(struct nvkm_gr *);void (*tile)(struct nvkm_gr *,int region,struct nvkm_fb_tile *);int (*tlb_flush)(struct nvkm_gr *); -int (*chan_new)(struct nvkm_gr *,struct nvkm_fifo_chan *, +int (*chan_new)(struct nvkm_gr *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);int (*object_get)(struct nvkm_gr *,int ,struct nvkm_sclass *);/* Returns chipset-specific counts of units packed into an u64. drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.c +1
-2@@ -81,8 +81,7 @@ nv31_mpeg_chan = { };int -nv31_mpeg_chan_new (struct nvkm_fifo_chan *fifoch, -const struct nvkm_oclass *oclass, +nv31_mpeg_chan_new (struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv31_mpeg *mpeg =nv31_mpeg (oclass->engine);drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv31.h +2
-2@@ -24,9 +24,9 @@ struct nv31_mpeg_func {struct nv31_mpeg_chan {struct nvkm_object object;struct nv31_mpeg *mpeg; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo; }; -int nv31_mpeg_chan_new (struct nvkm_fifo_chan *,const struct nvkm_oclass *, +int nv31_mpeg_chan_new (struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);#endif drivers/gpu/drm/nouveau/nvkm/engine/mpeg/nv44.c +2
-3@@ -43,7 +43,7 @@ struct nv44_mpeg {struct nv44_mpeg_chan {struct nvkm_object object;struct nv44_mpeg *mpeg; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo;struct list_head head;u32 inst; };@@ -100,8 +100,7 @@ nv44_mpeg_chan = { };static int -nv44_mpeg_chan_new (struct nvkm_fifo_chan *fifoch, -const struct nvkm_oclass *oclass, +nv44_mpeg_chan_new (struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv44_mpeg *mpeg =nv44_mpeg (oclass->engine);drivers/gpu/drm/nouveau/nvkm/engine/mpeg/priv.h +1
-1@@ -2,7 +2,7 @@#ifndef __NVKM_MPEG_PRIV_H__#define __NVKM_MPEG_PRIV_H__#include <engine/mpeg.h> -struct nvkm_fifo_chan ; +struct nvkm_chan ;int nv31_mpeg_init (struct nvkm_engine *);void nv31_mpeg_tile (struct nvkm_engine *,int ,struct nvkm_fb_tile *);drivers/gpu/drm/nouveau/nvkm/engine/sw/base.c +1
-2@@ -74,8 +74,7 @@ nvkm_sw_oclass_get(struct nvkm_oclass *oclass, int index) }static int -nvkm_sw_cclass_get (struct nvkm_fifo_chan *fifoch, -const struct nvkm_oclass *oclass, +nvkm_sw_cclass_get (struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_sw *sw =nvkm_sw (oclass->engine);drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.c +1
-1@@ -74,7 +74,7 @@ nvkm_sw_chan = {int nvkm_sw_chan_ctor (const struct nvkm_sw_chan_func *func,struct nvkm_sw *sw, -struct nvkm_fifo_chan *fifo,const struct nvkm_oclass *oclass, +struct nvkm_chan *fifo,const struct nvkm_oclass *oclass,struct nvkm_sw_chan *chan) {unsigned long flags;drivers/gpu/drm/nouveau/nvkm/engine/sw/chan.h +2
-2@@ -11,7 +11,7 @@ struct nvkm_sw_chan {const struct nvkm_sw_chan_func *func;struct nvkm_object object;struct nvkm_sw *sw; -struct nvkm_fifo_chan *fifo; +struct nvkm_chan *fifo;struct list_head head;#define NVKM_SW_CHAN_EVENT_PAGE_FLIP BIT(0)@@ -24,7 +24,7 @@ struct nvkm_sw_chan_func { };int nvkm_sw_chan_ctor (const struct nvkm_sw_chan_func *,struct nvkm_sw *, -struct nvkm_fifo_chan *,const struct nvkm_oclass *, +struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_sw_chan *);bool nvkm_sw_chan_mthd (struct nvkm_sw_chan *,int subc,u32 mthd,u32 data);#endif drivers/gpu/drm/nouveau/nvkm/engine/sw/gf100.c +1
-1@@ -102,7 +102,7 @@ gf100_sw_chan = { };static int -gf100_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifoch, +gf100_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {drivers/gpu/drm/nouveau/nvkm/engine/sw/nv04.c +1
-1@@ -106,7 +106,7 @@ nv04_sw_chan = { };static int -nv04_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifo, +nv04_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifo,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nv04_sw_chan *chan;drivers/gpu/drm/nouveau/nvkm/engine/sw/nv10.c +1
-1@@ -36,7 +36,7 @@ nv10_sw_chan = { };static int -nv10_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifo, +nv10_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifo,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_sw_chan *chan;drivers/gpu/drm/nouveau/nvkm/engine/sw/nv50.c +1
-1@@ -99,7 +99,7 @@ nv50_sw_chan = { };static int -nv50_sw_chan_new (struct nvkm_sw *sw,struct nvkm_fifo_chan *fifoch, +nv50_sw_chan_new (struct nvkm_sw *sw,struct nvkm_chan *fifoch,const struct nvkm_oclass *oclass,struct nvkm_object **pobject) {struct nvkm_disp *disp = sw->engine.subdev.device->disp;drivers/gpu/drm/nouveau/nvkm/engine/sw/priv.h +1
-2@@ -15,7 +15,7 @@ struct nvkm_sw_chan_sclass { };struct nvkm_sw_func { -int (*chan_new)(struct nvkm_sw *,struct nvkm_fifo_chan *, +int (*chan_new)(struct nvkm_sw *,struct nvkm_chan *,const struct nvkm_oclass *,struct nvkm_object **);const struct nvkm_sw_chan_sclass sclass[]; }; --
Quoted 2 lines
2.40.1
PATCH 6/10 drm/nouveau/fifo: return ERR_PTR from nvkm_runl_new()
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
Callers expect this - not NULL.
--- drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c +2 -2
@@ -399,7 +399,7 @@ nvkm_runl_new(struct nvkm_fifo *fifo, int runi, u32 addr, int id_nr)int ret;if (!(runl =kzalloc (sizeof (*runl),GFP_KERNEL ))) -return NULL ; +return ERR_PTR (-ENOMEM ); runl->func = fifo->func->runl; runl->fifo = fifo;
@@ -419,7 +419,7 @@ nvkm_runl_new(struct nvkm_fifo *fifo, int runi, u32 addr, int id_nr) (ret = nvkm_chid_new(&nvkm_chan_event, subdev, id_nr, 0, id_nr, &runl->chid))) {RUNL_ERROR (runl,"cgid/chid: %d" , ret);nvkm_runl_del (runl); -return NULL ; +return ERR_PTR (ret); } }else { runl->cgid =nvkm_chid_ref (fifo->cgid);
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 06/10] drm/nouveau/fifo: return ERR_PTR from nvkm_runl_new()
Quoted 33 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Callers expect this - not NULL.
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.c +2
-3@@ -399,7 +399,7 @@ nvkm_runl_new(struct nvkm_fifo *fifo, int runi, u32 addr, int id_nr)int ret;if (!(runl =kzalloc (sizeof (*runl),GFP_KERNEL ))) -return NULL ; +return ERR_PTR (-ENOMEM ); runl->func = fifo->func->runl; runl->fifo = fifo;@@ -419,7 +419,7 @@ nvkm_runl_new(struct nvkm_fifo *fifo, int runi, u32 addr, int id_nr) (ret = nvkm_chid_new(&nvkm_chan_event, subdev, id_nr, 0, id_nr, &runl->chid))) {RUNL_ERROR (runl,"cgid/chid: %d" , ret);nvkm_runl_del (runl); -return NULL ; +return ERR_PTR (ret); } }else { runl->cgid =nvkm_chid_ref (fifo->cgid); --
Quoted 2 lines
2.40.1
PATCH 7/10 drm/nouveau/fifo/ga100-: remove individual runlists rather than failing oneinit
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
We're adding better support for the non-stall interrupt, which will need to fetch the interrupt vector from the runlist's primary engine.
NVKM doesn't support all target engines (ie. NVDEC etc), and it wouldn't be ideal to completely fail initialisation in this case.
Instead. Remove runlists where we can't determine all the needed info.
--- .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +35 -11
@@ -429,7 +429,9 @@ static int ga100_runl_new(struct nvkm_fifo *fifo, int id, u32 addr, struct nvkm_runl **prunl) { struct nvkm_device *device = fifo->engine.subdev.device; +struct nvkm_top_device *tdev;struct nvkm_runl *runl; +struct nvkm_engn *engn;u32 chcfg =nvkm_rd32 (device, addr +0x004 );u32 chnum =1 << (chcfg &0x0000000f );u32 chaddr = (chcfg &0xfffffff0 );
@@ -437,26 +439,50 @@ ga100_runl_new(struct nvkm_fifo *fifo, int id, u32 addr, struct nvkm_runl **prunu32 vector =nvkm_rd32 (device, addr +0x160 );int i, ret; - runl = *prunl =nvkm_runl_new (fifo, id, addr, chnum); + runl =nvkm_runl_new (fifo, id, addr, chnum);if (IS_ERR (runl))return PTR_ERR (runl); + *prunl = runl; +for (i =0 ; i <2 ; i++) {u32 pbcfg =nvkm_rd32 (device, addr +0x010 + (i *0x04 ));if (pbcfg &0x80000000 ) { runl->runq[runl->runq_nr] =nvkm_runq_new (fifo, ((pbcfg &0x03fffc00 ) -0x040000 ) /0x800 ); -if (!runl->runq[runl->runq_nr]) +if (!runl->runq[runl->runq_nr]) { +RUNL_ERROR (runl,"runq %d" , runl->runq_nr);return -ENOMEM ; + } runl->runq_nr++; } } + nvkm_list_foreach(tdev, &device->top->device, head, tdev->runlist == runl->addr) { +if (tdev->engine <0 ) { +RUNL_DEBUG (runl,"engn !top" ); +return -EINVAL ; + } + + engn =nvkm_runl_add (runl, tdev->engine, (tdev->type ==NVKM_ENGINE_CE ) ? + fifo->func->engn_ce : fifo->func->engn, + tdev->type, tdev->inst); +if (!engn) +return -EINVAL ; + } + +if (list_empty (&runl->engns)) { +RUNL_DEBUG (runl,"!engns" ); +return -EINVAL ; + } + ret =nvkm_inth_add (&device->vfn->intr, vector &0x00000fff ,NVKM_INTR_PRIO_NORMAL , &fifo->engine.subdev, ga100_runl_intr, &runl->inth); -if (ret) +if (ret) { +RUNL_ERROR (runl,"inth %d" , ret);return ret; + } runl->chan = chaddr; runl->doorbell = dbcfg >>16 ;
@@ -514,15 +540,13 @@ ga100_fifo_runl_ctor(struct nvkm_fifo *fifo) runl =nvkm_runl_get (fifo,-1 , tdev->runlist);if (!runl) { ret =ga100_runl_new (fifo, id++, tdev->runlist, &runl); -if (ret) -return ret; - } - -if (tdev->engine <0 ) -continue ; +if (ret) { +if (runl) +nvkm_runl_del (runl); -nvkm_runl_add (runl, tdev->engine, (tdev->type ==NVKM_ENGINE_CE ) ? - fifo->func->engn_ce : fifo->func->engn, tdev->type, tdev->inst); +continue ; + } + } }return 0 ;
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 07/10] drm/nouveau/fifo/ga100-: remove individual runlists rather than failing oneinit
Quoted 107 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
We're adding better support for the non-stall interrupt, which will need to fetch the interrupt vector from the runlist's primary engine.
NVKM doesn't support all target engines (ie. NVDEC etc), and it wouldn't be ideal to completely fail initialisation in this case.
Instead. Remove runlists where we can't determine all the needed info.
Signed-off-by Ben Skeggs <[email protected]>--- .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 46 ++++++++++++++----- 1 file changed, 35 insertions(+), 11 deletions(-)drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +35
-12@@ -429,7 +429,9 @@ static int ga100_runl_new(struct nvkm_fifo *fifo, int id, u32 addr, struct nvkm_runl **prunl) { struct nvkm_device *device = fifo->engine.subdev.device; +struct nvkm_top_device *tdev;struct nvkm_runl *runl; +struct nvkm_engn *engn;u32 chcfg =nvkm_rd32 (device, addr +0x004 );u32 chnum =1 << (chcfg &0x0000000f );u32 chaddr = (chcfg &0xfffffff0 );@@ -437,26 +439,50 @@ ga100_runl_new(struct nvkm_fifo *fifo, int id, u32 addr, struct nvkm_runl **prunu32 vector =nvkm_rd32 (device, addr +0x160 );int i, ret; - runl = *prunl =nvkm_runl_new (fifo, id, addr, chnum); + runl =nvkm_runl_new (fifo, id, addr, chnum);if (IS_ERR (runl))return PTR_ERR (runl); + *prunl = runl; +for (i =0 ; i <2 ; i++) {u32 pbcfg =nvkm_rd32 (device, addr +0x010 + (i *0x04 ));if (pbcfg &0x80000000 ) { runl->runq[runl->runq_nr] =nvkm_runq_new (fifo, ((pbcfg &0x03fffc00 ) -0x040000 ) /0x800 ); -if (!runl->runq[runl->runq_nr]) +if (!runl->runq[runl->runq_nr]) { +RUNL_ERROR (runl,"runq %d" , runl->runq_nr);return -ENOMEM ; + } runl->runq_nr++; } } + nvkm_list_foreach(tdev, &device->top->device, head, tdev->runlist == runl->addr) { +if (tdev->engine <0 ) { +RUNL_DEBUG (runl,"engn !top" ); +return -EINVAL ; + } + + engn =nvkm_runl_add (runl, tdev->engine, (tdev->type ==NVKM_ENGINE_CE ) ? + fifo->func->engn_ce : fifo->func->engn, + tdev->type, tdev->inst); +if (!engn) +return -EINVAL ; + } + +if (list_empty (&runl->engns)) { +RUNL_DEBUG (runl,"!engns" ); +return -EINVAL ; + } + ret =nvkm_inth_add (&device->vfn->intr, vector &0x00000fff ,NVKM_INTR_PRIO_NORMAL , &fifo->engine.subdev, ga100_runl_intr, &runl->inth); -if (ret) +if (ret) { +RUNL_ERROR (runl,"inth %d" , ret);return ret; + } runl->chan = chaddr; runl->doorbell = dbcfg >>16 ;@@ -514,15 +540,13 @@ ga100_fifo_runl_ctor(struct nvkm_fifo *fifo) runl =nvkm_runl_get (fifo,-1 , tdev->runlist);if (!runl) { ret =ga100_runl_new (fifo, id++, tdev->runlist, &runl); -if (ret) -return ret; - } - -if (tdev->engine <0 ) -continue ; +if (ret) { +if (runl) +nvkm_runl_del (runl); -nvkm_runl_add (runl, tdev->engine, (tdev->type ==NVKM_ENGINE_CE ) ? - fifo->func->engn_ce : fifo->func->engn, tdev->type, tdev->inst); +continue ; + } + } }return 0 ; --
Quoted 2 lines
2.40.1
PATCH 8/10 drm/nouveau/fifo/ga100-: add per-runlist nonstall intr handling
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
GSP-RM will enforce this, so implement on HW too so we can share code.
--- .../drm/nouveau/include/nvkm/core/engine.h | 1 + .../gpu/drm/nouveau/nvkm/engine/ce/ga100.c | 10 ++++ .../gpu/drm/nouveau/nvkm/engine/ce/ga102.c | 1 + drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h | 1 + .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 32 +++++----- .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 59 +++++++++++++++---- .../gpu/drm/nouveau/nvkm/engine/fifo/runl.h | 6 ++ .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | 12 ++++ .../gpu/drm/nouveau/nvkm/engine/gr/ga102.c | 7 +++ .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 12 ++++ .../gpu/drm/nouveau/nvkm/engine/gr/gf100.h | 1 + drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h | 1 + 13 files changed, 116 insertions(+), 29 deletions(-)
drivers/gpu/drm/nouveau/include/nvkm/core/engine.h +1 -0
@@ -22,6 +22,7 @@ struct nvkm_engine_func {int (*init)(struct nvkm_engine *);int (*fini)(struct nvkm_engine *,bool suspend);int (*reset)(struct nvkm_engine *); +int (*nonstall)(struct nvkm_engine *);void (*intr)(struct nvkm_engine *);void (*tile)(struct nvkm_engine *,int region,struct nvkm_fb_tile *);bool (*chsw_load)(struct nvkm_engine *);
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c +10 -0
@@ -35,6 +35,15 @@ ga100_ce_intr(struct nvkm_inth *inth)return IRQ_NONE ; } +int +ga100_ce_nonstall (struct nvkm_engine *engine) +{ +struct nvkm_subdev *subdev = &engine->subdev; +struct nvkm_device *device = subdev->device; + +return nvkm_rd32 (device,0x104424 + (subdev->inst *0x80 )) &0x00000fff ; +} +int ga100_ce_fini (struct nvkm_engine *engine,bool suspend) {
@@ -67,6 +76,7 @@ ga100_ce = { .oneinit = ga100_ce_oneinit, .init = ga100_ce_init, .fini = ga100_ce_fini, + .nonstall = ga100_ce_nonstall, .cclass = &gv100_ce_cclass, .sclass = { { -1, -1, AMPERE_DMA_COPY_A },
drivers/gpu/drm/nouveau/nvkm/engine/ce/ga102.c +1 -0
@@ -28,6 +28,7 @@ ga102_ce = { .oneinit = ga100_ce_oneinit, .init = ga100_ce_init, .fini = ga100_ce_fini, + .nonstall = ga100_ce_nonstall, .cclass = &gv100_ce_cclass, .sclass = { { -1, -1, AMPERE_DMA_COPY_A },
drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h +1 -0
@@ -12,4 +12,5 @@ extern const struct nvkm_object_func gv100_ce_cclass;int ga100_ce_oneinit (struct nvkm_engine *);int ga100_ce_init (struct nvkm_engine *);int ga100_ce_fini (struct nvkm_engine *,bool ); +int ga100_ce_nonstall (struct nvkm_engine *);#endif
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +15 -17
@@ -283,11 +283,21 @@ nvkm_fifo_oneinit(struct nvkm_engine *engine) }/* Initialise non-stall intr handling. */ -if (fifo->func->nonstall_ctor) { - ret = fifo->func->nonstall_ctor (fifo); -if (ret) { -nvkm_error (subdev,"nonstall %d\n" , ret); +if (fifo->func->nonstall) { +if (fifo->func->nonstall_ctor) { + ret = fifo->func->nonstall_ctor (fifo); +if (ret <0 ) { +nvkm_error (subdev,"nonstall %d\n" , ret); +return ret; + } + }else { + ret =1 ; } + + ret =nvkm_event_init (fifo->func->nonstall, &fifo->engine.subdev,1 , ret, + &fifo->nonstall.event); +if (ret) +return ret; }/* Allocate USERD + BAR1 polling area. */
@@ -358,7 +368,6 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) { struct nvkm_fifo *fifo; -int ret;if (!(fifo = *pfifo =kzalloc (sizeof (*fifo),GFP_KERNEL )))return -ENOMEM ;
@@ -374,16 +383,5 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device,spin_lock_init (&fifo->lock);mutex_init (&fifo->mutex); - ret =nvkm_engine_ctor (&nvkm_fifo, device, type, inst, true, &fifo->engine); -if (ret) -return ret; - -if (func->nonstall) { - ret =nvkm_event_init (func->nonstall, &fifo->engine.subdev,1 ,1 , - &fifo->nonstall.event); -if (ret) -return ret; - } - -return 0 ; +return nvkm_engine_ctor (&nvkm_fifo, device, type, inst, true, &fifo->engine); }
drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +48 -11
118 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.h +6 -0
@@ -11,6 +11,7 @@ enum nvkm_subdev_type;struct nvkm_engn {const struct nvkm_engn_func { +int (*nonstall)(struct nvkm_engn *);bool (*chsw)(struct nvkm_engn *);int (*cxid)(struct nvkm_engn *,bool *cgid);void (*mmu_fault_trigger)(struct nvkm_engn *);
@@ -69,6 +70,11 @@ struct nvkm_runl {struct nvkm_inth inth; +struct { +int vector; +struct nvkm_inth inth; + } nonstall; +struct list_head cgrps;int cgrp_nr;int chan_nr;
drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +1 -1
@@ -52,7 +52,7 @@ nvkm_uchan_uevent(struct nvkm_object *object, void *argv, u32 argc, struct nvkm_switch (args->v0.type) {case NVIF_CHAN_EVENT_V0_NON_STALL_INTR : -return nvkm_uevent_add (uevent, &runl->fifo->nonstall.event,0 , +return nvkm_uevent_add (uevent, &runl->fifo->nonstall.event, runl->id,NVKM_FIFO_NONSTALL_EVENT ,NULL );case NVIF_CHAN_EVENT_V0_KILLED : return nvkm_uevent_add(uevent, &runl->chid->event, chan->id,
drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +12 -0
@@ -125,6 +125,17 @@ nvkm_gr_intr(struct nvkm_engine *engine) gr->func->intr (gr); } +static int +nvkm_gr_nonstall (struct nvkm_engine *engine) +{ +struct nvkm_gr *gr =nvkm_gr (engine); + +if (gr->func->nonstall) +return gr->func->nonstall (gr); + +return -EINVAL ; +} +static int nvkm_gr_oneinit (struct nvkm_engine *engine) {
@@ -177,6 +188,7 @@ nvkm_gr = { .init = nvkm_gr_init, .fini = nvkm_gr_fini, .reset = nvkm_gr_reset, + .nonstall = nvkm_gr_nonstall, .intr = nvkm_gr_intr, .tile = nvkm_gr_tile, .chsw_load = nvkm_gr_chsw_load,
drivers/gpu/drm/nouveau/nvkm/engine/gr/ga102.c +7 -0
@@ -137,8 +137,15 @@ ga102_gr_oneinit_intr(struct gf100_gr *gr, enum nvkm_intr_type *pvector)return &device->vfn->intr; } +static int +ga102_gr_nonstall (struct gf100_gr *gr) +{ +return nvkm_rd32 (gr->base.engine.subdev.device,0x400160 ) &0x00000fff ; +} +static const struct gf100_gr_func ga102_gr = { + .nonstall = ga102_gr_nonstall, .oneinit_intr = ga102_gr_oneinit_intr, .oneinit_tiles = gm200_gr_oneinit_tiles, .oneinit_sm_id = gv100_gr_oneinit_sm_id,
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +12 -0
@@ -2494,12 +2494,24 @@ gf100_gr_gpccs_ucode = { .data.size = sizeof(gf100_grgpc_data), }; +static int +gf100_gr_nonstall (struct nvkm_gr *base) +{ +struct gf100_gr *gr =gf100_gr (base); + +if (gr->func->nonstall) +return gr->func->nonstall (gr); + +return -EINVAL ; +} +static const struct nvkm_gr_func gf100_gr_ = { .dtor = gf100_gr_dtor, .oneinit = gf100_gr_oneinit, .init = gf100_gr_init_, .fini = gf100_gr_fini, + .nonstall = gf100_gr_nonstall, .reset = gf100_gr_reset, .units = gf100_gr_units, .chan_new = gf100_gr_chan_new,
drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h +1 -0
@@ -147,6 +147,7 @@ struct gf100_gr_func_zbc { };struct gf100_gr_func { +int (*nonstall)(struct gf100_gr *);struct nvkm_intr *(*oneinit_intr)(struct gf100_gr *,enum nvkm_intr_type *);void (*oneinit_tiles)(struct gf100_gr *);int (*oneinit_sm_id)(struct gf100_gr *);
drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h +1 -0
@@ -18,6 +18,7 @@ struct nvkm_gr_func {int (*init)(struct nvkm_gr *);int (*fini)(struct nvkm_gr *,bool );int (*reset)(struct nvkm_gr *); +int (*nonstall)(struct nvkm_gr *);void (*intr)(struct nvkm_gr *);void (*tile)(struct nvkm_gr *,int region,struct nvkm_fb_tile *);int (*tlb_flush)(struct nvkm_gr *);
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 08/10] drm/nouveau/fifo/ga100-: add per-runlist nonstall intr handling
Quoted 411 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
GSP-RM will enforce this, so implement on HW too so we can share code.
Signed-off-by Ben Skeggs <[email protected]>--- .../drm/nouveau/include/nvkm/core/engine.h | 1 + .../gpu/drm/nouveau/nvkm/engine/ce/ga100.c | 10 ++++ .../gpu/drm/nouveau/nvkm/engine/ce/ga102.c | 1 + drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h | 1 + .../gpu/drm/nouveau/nvkm/engine/fifo/base.c | 32 +++++----- .../gpu/drm/nouveau/nvkm/engine/fifo/ga100.c | 59 +++++++++++++++---- .../gpu/drm/nouveau/nvkm/engine/fifo/runl.h | 6 ++ .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c | 12 ++++ .../gpu/drm/nouveau/nvkm/engine/gr/ga102.c | 7 +++ .../gpu/drm/nouveau/nvkm/engine/gr/gf100.c | 12 ++++ .../gpu/drm/nouveau/nvkm/engine/gr/gf100.h | 1 + drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h | 1 + 13 files changed, 116 insertions(+), 29 deletions(-)drivers/gpu/drm/nouveau/include/nvkm/core/engine.h +1
-0@@ -22,6 +22,7 @@ struct nvkm_engine_func {int (*init)(struct nvkm_engine *);int (*fini)(struct nvkm_engine *,bool suspend);int (*reset)(struct nvkm_engine *); +int (*nonstall)(struct nvkm_engine *);void (*intr)(struct nvkm_engine *);void (*tile)(struct nvkm_engine *,int region,struct nvkm_fb_tile *);bool (*chsw_load)(struct nvkm_engine *);drivers/gpu/drm/nouveau/nvkm/engine/ce/ga100.c +10
-0@@ -35,6 +35,15 @@ ga100_ce_intr(struct nvkm_inth *inth)return IRQ_NONE ; } +int +ga100_ce_nonstall (struct nvkm_engine *engine) +{ +struct nvkm_subdev *subdev = &engine->subdev; +struct nvkm_device *device = subdev->device; + +return nvkm_rd32 (device,0x104424 + (subdev->inst *0x80 )) &0x00000fff ; +} +int ga100_ce_fini (struct nvkm_engine *engine,bool suspend) {@@ -67,6 +76,7 @@ ga100_ce = { .oneinit = ga100_ce_oneinit, .init = ga100_ce_init, .fini = ga100_ce_fini, + .nonstall = ga100_ce_nonstall, .cclass = &gv100_ce_cclass, .sclass = { { -1, -1, AMPERE_DMA_COPY_A },drivers/gpu/drm/nouveau/nvkm/engine/ce/ga102.c +1
-0@@ -28,6 +28,7 @@ ga102_ce = { .oneinit = ga100_ce_oneinit, .init = ga100_ce_init, .fini = ga100_ce_fini, + .nonstall = ga100_ce_nonstall, .cclass = &gv100_ce_cclass, .sclass = { { -1, -1, AMPERE_DMA_COPY_A },drivers/gpu/drm/nouveau/nvkm/engine/ce/priv.h +1
-0@@ -12,4 +12,5 @@ extern const struct nvkm_object_func gv100_ce_cclass;int ga100_ce_oneinit (struct nvkm_engine *);int ga100_ce_init (struct nvkm_engine *);int ga100_ce_fini (struct nvkm_engine *,bool ); +int ga100_ce_nonstall (struct nvkm_engine *);#endif drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c +15
-17@@ -283,11 +283,21 @@ nvkm_fifo_oneinit(struct nvkm_engine *engine) }/* Initialise non-stall intr handling. */ -if (fifo->func->nonstall_ctor) { - ret = fifo->func->nonstall_ctor (fifo); -if (ret) { -nvkm_error (subdev,"nonstall %d\n" , ret); +if (fifo->func->nonstall) { +if (fifo->func->nonstall_ctor) { + ret = fifo->func->nonstall_ctor (fifo); +if (ret <0 ) { +nvkm_error (subdev,"nonstall %d\n" , ret); +return ret; + } + }else { + ret =1 ; } + + ret =nvkm_event_init (fifo->func->nonstall, &fifo->engine.subdev,1 , ret, + &fifo->nonstall.event); +if (ret) +return ret; }/* Allocate USERD + BAR1 polling area. */ @@ -358,7 +368,6 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device, enum nvkm_subdev_type type, int inst, struct nvkm_fifo **pfifo) { struct nvkm_fifo *fifo; -int ret;if (!(fifo = *pfifo =kzalloc (sizeof (*fifo),GFP_KERNEL )))return -ENOMEM ;@@ -374,16 +383,5 @@ nvkm_fifo_new_(const struct nvkm_fifo_func *func, struct nvkm_device *device,spin_lock_init (&fifo->lock);mutex_init (&fifo->mutex); - ret =nvkm_engine_ctor (&nvkm_fifo, device, type, inst, true, &fifo->engine); -if (ret) -return ret; - -if (func->nonstall) { - ret =nvkm_event_init (func->nonstall, &fifo->engine.subdev,1 ,1 , - &fifo->nonstall.event); -if (ret) -return ret; - } - -return 0 ; +return nvkm_engine_ctor (&nvkm_fifo, device, type, inst, true, &fifo->engine); }drivers/gpu/drm/nouveau/nvkm/engine/fifo/ga100.c +48
-11@@ -32,9 +32,6 @@#include <nvif/class.h> -/*TODO: allocate? */ -#define GA100_FIFO_NONSTALL_VECTOR 0 -static u32 ga100_chan_doorbell_handle (struct nvkm_chan *chan) {@@ -83,7 +80,7 @@ ga100_chan_ramfc_write(struct nvkm_chan *chan, u64 offset, u64 length, u32 devm,nvkm_wo32 (chan->inst,0x0e4 , priv ?0x00000020 :0x00000000 );nvkm_wo32 (chan->inst,0x0e8 , chan->id);nvkm_wo32 (chan->inst,0x0f4 ,0x00001000 | (priv ?0x00000100 :0x00000000 )); -nvkm_wo32 (chan->inst,0x0f8 ,0x80000000 |GA100_FIFO_NONSTALL_VECTOR ); +nvkm_wo32 (chan->inst,0x0f8 ,0x80000000 | chan->cgrp->runl->nonstall.vector);nvkm_mo32 (chan->inst,0x218 ,0x00000000 ,0x00000000 );nvkm_done (chan->inst);return 0 ;@@ -148,8 +145,20 @@ ga100_engn_cxid(struct nvkm_engn *engn, bool *cgid)return -ENODEV ; } +static int +ga100_engn_nonstall (struct nvkm_engn *engn) +{ +struct nvkm_engine *engine = engn->engine; + +if (WARN_ON (!engine->func->nonstall)) +return -EINVAL ; + +return engine->func->nonstall (engine); +} +const struct nvkm_engn_func ga100_engn = { + .nonstall = ga100_engn_nonstall, .cxid = ga100_engn_cxid, .ctor = gk104_ectx_ctor, .bind = gv100_ectx_bind,@@ -157,6 +166,7 @@ ga100_engn = {const struct nvkm_engn_func ga100_engn_ce = { + .nonstall = ga100_engn_nonstall, .cxid = ga100_engn_cxid, .ctor = gv100_ectx_ce_ctor, .bind = gv100_ectx_ce_bind,@@ -470,6 +480,11 @@ ga100_runl_new(struct nvkm_fifo *fifo, int id, u32 addr, struct nvkm_runl **prun tdev->type, tdev->inst);if (!engn)return -EINVAL ; + +if (!engn->engine->func->nonstall) { +RUNL_DEBUG (runl,"engn %s !nonstall" , engn->engine->subdev.name); +return -EINVAL ; + } }if (list_empty (&runl->engns)) {@@ -492,9 +507,9 @@ ga100_runl_new(struct nvkm_fifo *fifo, int id, u32 addr, struct nvkm_runl **prunstatic irqreturn_t ga100_fifo_nonstall_intr (struct nvkm_inth *inth) { -struct nvkm_fifo *fifo =container_of (inth,typeof (*fifo), nonstall.intr); +struct nvkm_runl *runl =container_of (inth,typeof (*runl), nonstall.inth); -nvkm_event_ntfy (&fifo->nonstall.event,0 ,NVKM_FIFO_NONSTALL_EVENT ); +nvkm_event_ntfy (&runl->fifo->nonstall.event, runl->id,NVKM_FIFO_NONSTALL_EVENT );return IRQ_HANDLED ; }@@ -502,16 +517,18 @@ static void ga100_fifo_nonstall_block(struct nvkm_event *event, int type, int index) { struct nvkm_fifo *fifo = container_of(event, typeof(*fifo), nonstall.event); +struct nvkm_runl *runl =nvkm_runl_get (fifo, index,0 ); -nvkm_inth_block (&fifo->nonstall.intr); +nvkm_inth_block (&runl->nonstall.inth); }static void ga100_fifo_nonstall_allow (struct nvkm_event *event,int type,int index) {struct nvkm_fifo *fifo =container_of (event,typeof (*fifo), nonstall.event); +struct nvkm_runl *runl =nvkm_runl_get (fifo, index,0 ); -nvkm_inth_allow (&fifo->nonstall.intr); +nvkm_inth_allow (&runl->nonstall.inth); } const struct nvkm_event_func@@ -523,9 +540,29 @@ ga100_fifo_nonstall = {int ga100_fifo_nonstall_ctor (struct nvkm_fifo *fifo) { -return nvkm_inth_add (&fifo->engine.subdev.device->vfn->intr,GA100_FIFO_NONSTALL_VECTOR , -NVKM_INTR_PRIO_NORMAL , &fifo->engine.subdev, ga100_fifo_nonstall_intr, - &fifo->nonstall.intr); +struct nvkm_subdev *subdev = &fifo->engine.subdev; +struct nvkm_vfn *vfn = subdev->device->vfn; +struct nvkm_runl *runl; +int ret, nr =0 ; + + nvkm_runl_foreach(runl, fifo) { +struct nvkm_engn *engn =list_first_entry (&runl->engns,typeof (*engn), head); + + runl->nonstall.vector = engn->func->nonstall (engn); +if (runl->nonstall.vector <0 ) { +RUNL_ERROR (runl,"nonstall %d" , runl->nonstall.vector); +return runl->nonstall.vector; + } + + ret =nvkm_inth_add (&vfn->intr, runl->nonstall.vector,NVKM_INTR_PRIO_NORMAL , + subdev, ga100_fifo_nonstall_intr, &runl->nonstall.inth); +if (ret) +return ret; + + nr =max (nr, runl->id +1 ); + } + +return nr; }int drivers/gpu/drm/nouveau/nvkm/engine/fifo/runl.h +6
-0@@ -11,6 +11,7 @@ enum nvkm_subdev_type;struct nvkm_engn {const struct nvkm_engn_func { +int (*nonstall)(struct nvkm_engn *);bool (*chsw)(struct nvkm_engn *);int (*cxid)(struct nvkm_engn *,bool *cgid);void (*mmu_fault_trigger)(struct nvkm_engn *);@@ -69,6 +70,11 @@ struct nvkm_runl {struct nvkm_inth inth; +struct { +int vector; +struct nvkm_inth inth; + } nonstall; +struct list_head cgrps;int cgrp_nr;int chan_nr;drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c +1
-1@@ -52,7 +52,7 @@ nvkm_uchan_uevent(struct nvkm_object *object, void *argv, u32 argc, struct nvkm_switch (args->v0.type) {case NVIF_CHAN_EVENT_V0_NON_STALL_INTR : -return nvkm_uevent_add (uevent, &runl->fifo->nonstall.event,0 , +return nvkm_uevent_add (uevent, &runl->fifo->nonstall.event, runl->id,NVKM_FIFO_NONSTALL_EVENT ,NULL );case NVIF_CHAN_EVENT_V0_KILLED : return nvkm_uevent_add(uevent, &runl->chid->event, chan->id,drivers/gpu/drm/nouveau/nvkm/engine/gr/base.c +12
-0@@ -125,6 +125,17 @@ nvkm_gr_intr(struct nvkm_engine *engine) gr->func->intr (gr); } +static int +nvkm_gr_nonstall (struct nvkm_engine *engine) +{ +struct nvkm_gr *gr =nvkm_gr (engine); + +if (gr->func->nonstall) +return gr->func->nonstall (gr); + +return -EINVAL ; +} +static int nvkm_gr_oneinit (struct nvkm_engine *engine) {@@ -177,6 +188,7 @@ nvkm_gr = { .init = nvkm_gr_init, .fini = nvkm_gr_fini, .reset = nvkm_gr_reset, + .nonstall = nvkm_gr_nonstall, .intr = nvkm_gr_intr, .tile = nvkm_gr_tile, .chsw_load = nvkm_gr_chsw_load,drivers/gpu/drm/nouveau/nvkm/engine/gr/ga102.c +7
-0@@ -137,8 +137,15 @@ ga102_gr_oneinit_intr(struct gf100_gr *gr, enum nvkm_intr_type *pvector)return &device->vfn->intr; } +static int +ga102_gr_nonstall (struct gf100_gr *gr) +{ +return nvkm_rd32 (gr->base.engine.subdev.device,0x400160 ) &0x00000fff ; +} +static const struct gf100_gr_func ga102_gr = { + .nonstall = ga102_gr_nonstall, .oneinit_intr = ga102_gr_oneinit_intr, .oneinit_tiles = gm200_gr_oneinit_tiles, .oneinit_sm_id = gv100_gr_oneinit_sm_id,drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.c +12
-0@@ -2494,12 +2494,24 @@ gf100_gr_gpccs_ucode = { .data.size = sizeof(gf100_grgpc_data), }; +static int +gf100_gr_nonstall (struct nvkm_gr *base) +{ +struct gf100_gr *gr =gf100_gr (base); + +if (gr->func->nonstall) +return gr->func->nonstall (gr); + +return -EINVAL ; +} +static const struct nvkm_gr_func gf100_gr_ = { .dtor = gf100_gr_dtor, .oneinit = gf100_gr_oneinit, .init = gf100_gr_init_, .fini = gf100_gr_fini, + .nonstall = gf100_gr_nonstall, .reset = gf100_gr_reset, .units = gf100_gr_units, .chan_new = gf100_gr_chan_new,drivers/gpu/drm/nouveau/nvkm/engine/gr/gf100.h +1
-0@@ -147,6 +147,7 @@ struct gf100_gr_func_zbc { };struct gf100_gr_func { +int (*nonstall)(struct gf100_gr *);struct nvkm_intr *(*oneinit_intr)(struct gf100_gr *,enum nvkm_intr_type *);void (*oneinit_tiles)(struct gf100_gr *);int (*oneinit_sm_id)(struct gf100_gr *);drivers/gpu/drm/nouveau/nvkm/engine/gr/priv.h +1
-1@@ -18,6 +18,7 @@ struct nvkm_gr_func {int (*init)(struct nvkm_gr *);int (*fini)(struct nvkm_gr *,bool );int (*reset)(struct nvkm_gr *); +int (*nonstall)(struct nvkm_gr *);void (*intr)(struct nvkm_gr *);void (*tile)(struct nvkm_gr *,int region,struct nvkm_fb_tile *);int (*tlb_flush)(struct nvkm_gr *); --
Quoted 2 lines
2.40.1
PATCH 9/10 drm/nouveau/nvif: fix potential double-free
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
DRM cleanup paths unconditionally call nvif_mmu_dtor() for clients, which would result in a double-free if nvif_mmu_ctor()'d previously failed.
--- drivers/gpu/drm/nouveau/nvif/mmu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nvif/mmu.c +3 -0
@@ -27,6 +27,9 @@void nvif_mmu_dtor (struct nvif_mmu *mmu) { +if (!nvif_object_constructed (&mmu->object)) +return ; +kfree (mmu->kind);kfree (mmu->type);kfree (mmu->heap);
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 09/10] drm/nouveau/nvif: fix potential double-free
Quoted 17 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
DRM cleanup paths unconditionally call
nvif_mmu_dtor()for clients, which would result in a double-free if nvif_mmu_ctor()'d previously failed.Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nvif/mmu.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/nouveau/nvif/mmu.c +0
-0
drivers/gpu/drm/nouveau/nvif/mmu.c line 32
Quoted 6 lines
drivers/gpu/drm/nouveau/nvif/mmu.c +3
-0@@ -27,6 +27,9 @@void nvif_mmu_dtor (struct nvif_mmu *mmu) { +if (!nvif_object_constructed (&mmu->object)) +return ; +
nvif_mmu_ctor seems to be calling into this in its clean up path, so this could now leaks memory in case nvif_mmu_ctor fails, no?
Quoted 6 lines
drivers/gpu/drm/nouveau/nvif/mmu.c +0
-1kfree (mmu->kind);kfree (mmu->type);kfree (mmu->heap); --2.40.1
PATCH 10/10 drm/nouveau/kms: don't call drm_dp_cec_set_edid() on TMDS
In reply to Ben SkeggsFrom: Ben Skeggs <[email protected]>
RM complains very loudly at the aux transaction attempts.
--- drivers/gpu/drm/nouveau/nouveau_connector.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +4 -1
@@ -619,7 +619,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)nouveau_connector_set_encoder (connector, nv_encoder); conn_status = connector_status_connected; -drm_dp_cec_set_edid (&nv_connector->aux, nv_connector->edid); + +if (nv_encoder->dcb->type ==DCB_OUTPUT_DP ) +drm_dp_cec_set_edid (&nv_connector->aux, nv_connector->edid); + goto out; }else {nouveau_connector_set_edid (nv_connector,NULL );
Signature · 1 line
2.40.1
Re: [Nouveau] [PATCH 10/10] drm/nouveau/kms: don't call drm_dp_cec_set_edid() on TMDS
Quoted 27 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
RM complains very loudly at the aux transaction attempts.
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nouveau_connector.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/gpu/drm/nouveau/nouveau_connector.c +4
-2@@ -619,7 +619,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)nouveau_connector_set_encoder (connector, nv_encoder); conn_status = connector_status_connected; -drm_dp_cec_set_edid (&nv_connector->aux, nv_connector->edid); + +if (nv_encoder->dcb->type ==DCB_OUTPUT_DP ) +drm_dp_cec_set_edid (&nv_connector->aux, nv_connector->edid); + goto out; }else {nouveau_connector_set_edid (nv_connector,NULL ); --
Quoted 2 lines
2.40.1
Quoted 31 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Turns out, we're currently tearing down the disp core channel *before* the satellite channels (wndw, etc) during suspend.
This makes RM return
NV_ERR_NOT_SUPPORTEDon attempting to reallocate the core channel on resume for some reason, but we probably shouldn't be doing it on HW either.Tear down children in the reverse of allocation order instead.
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/core/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/nouveau/nvkm/core/object.c +1
-2@@ -185,7 +185,7 @@ nvkm_object_fini(struct nvkm_object *object, bool suspend)nvif_debug (object,"%s children...\n" , action); time =ktime_to_us (ktime_get ()); -list_for_each_entry (child, &object->tree, head) { +list_for_each_entry_reverse (child, &object->tree, head) { ret =nvkm_object_fini (child, suspend);if (ret && suspend) goto fail_child; --
Quoted 2 lines
2.40.1
For the whole series:
Quoted 29 lines · Ben Skeggs
From: Ben Skeggs <[email protected]>
Turns out, we're currently tearing down the disp core channel *before* the satellite channels (wndw, etc) during suspend.
This makes RM return
NV_ERR_NOT_SUPPORTEDon attempting to reallocate the core channel on resume for some reason, but we probably shouldn't be doing it on HW either.Tear down children in the reverse of allocation order instead.
Signed-off-by Ben Skeggs <[email protected]>--- drivers/gpu/drm/nouveau/nvkm/core/object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpu/drm/nouveau/nvkm/core/object.c +1
-1@@ -185,7 +185,7 @@ nvkm_object_fini(struct nvkm_object *object, bool suspend)nvif_debug (object,"%s children...\n" , action); time =ktime_to_us (ktime_get ()); -list_for_each_entry (child, &object->tree, head) { +list_for_each_entry_reverse (child, &object->tree, head) { ret =nvkm_object_fini (child, suspend);if (ret && suspend) goto fail_child;
Signature · 3 lines
Cheers, Lyude Paul (she/her) Software Engineer at Red Hat