Skip to content

Commit 015ef61

Browse files
Ben Skeggsairlied
authored andcommitted
drm/nouveau/gsp: prepare for GSP-RM
- move TOP after GSP, so we can disable TOP if GSP is in use - provide plumbing to support falcon-only and GSP-RM paths - provide a method for subdevs to detect GSP-RM paths - split tu102/tu116/ga100 paths from gv100, which can't support GSP-RM Signed-off-by: Ben Skeggs <[email protected]> Signed-off-by: Dave Airlie <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent e866927 commit 015ef61

File tree

11 files changed

+182
-24
lines changed

11 files changed

+182
-24
lines changed

drivers/gpu/drm/nouveau/include/nvkm/core/layout.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* SPDX-License-Identifier: MIT */
2-
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top)
32
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_GSP , struct nvkm_gsp , gsp)
3+
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_TOP , struct nvkm_top , top)
44
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VFN , struct nvkm_vfn , vfn)
55
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_PCI , struct nvkm_pci , pci)
66
NVKM_LAYOUT_ONCE(NVKM_SUBDEV_VBIOS , struct nvkm_bios , bios)

drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,15 @@ struct nvkm_gsp {
1111
struct nvkm_falcon falcon;
1212
};
1313

14+
static inline bool
15+
nvkm_gsp_rm(struct nvkm_gsp *gsp)
16+
{
17+
return false;
18+
}
19+
1420
int gv100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
21+
int tu102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
22+
int tu116_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
23+
int ga100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
1524
int ga102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **);
1625
#endif

drivers/gpu/drm/nouveau/nvkm/engine/device/base.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2408,7 +2408,7 @@ nv162_chipset = {
24082408
.fb = { 0x00000001, tu102_fb_new },
24092409
.fuse = { 0x00000001, gm107_fuse_new },
24102410
.gpio = { 0x00000001, gk104_gpio_new },
2411-
.gsp = { 0x00000001, gv100_gsp_new },
2411+
.gsp = { 0x00000001, tu102_gsp_new },
24122412
.i2c = { 0x00000001, gm200_i2c_new },
24132413
.imem = { 0x00000001, nv50_instmem_new },
24142414
.ltc = { 0x00000001, gp102_ltc_new },
@@ -2443,7 +2443,7 @@ nv164_chipset = {
24432443
.fb = { 0x00000001, tu102_fb_new },
24442444
.fuse = { 0x00000001, gm107_fuse_new },
24452445
.gpio = { 0x00000001, gk104_gpio_new },
2446-
.gsp = { 0x00000001, gv100_gsp_new },
2446+
.gsp = { 0x00000001, tu102_gsp_new },
24472447
.i2c = { 0x00000001, gm200_i2c_new },
24482448
.imem = { 0x00000001, nv50_instmem_new },
24492449
.ltc = { 0x00000001, gp102_ltc_new },
@@ -2478,7 +2478,7 @@ nv166_chipset = {
24782478
.fb = { 0x00000001, tu102_fb_new },
24792479
.fuse = { 0x00000001, gm107_fuse_new },
24802480
.gpio = { 0x00000001, gk104_gpio_new },
2481-
.gsp = { 0x00000001, gv100_gsp_new },
2481+
.gsp = { 0x00000001, tu102_gsp_new },
24822482
.i2c = { 0x00000001, gm200_i2c_new },
24832483
.imem = { 0x00000001, nv50_instmem_new },
24842484
.ltc = { 0x00000001, gp102_ltc_new },
@@ -2513,7 +2513,7 @@ nv167_chipset = {
25132513
.fb = { 0x00000001, tu102_fb_new },
25142514
.fuse = { 0x00000001, gm107_fuse_new },
25152515
.gpio = { 0x00000001, gk104_gpio_new },
2516-
.gsp = { 0x00000001, gv100_gsp_new },
2516+
.gsp = { 0x00000001, tu116_gsp_new },
25172517
.i2c = { 0x00000001, gm200_i2c_new },
25182518
.imem = { 0x00000001, nv50_instmem_new },
25192519
.ltc = { 0x00000001, gp102_ltc_new },
@@ -2548,7 +2548,7 @@ nv168_chipset = {
25482548
.fb = { 0x00000001, tu102_fb_new },
25492549
.fuse = { 0x00000001, gm107_fuse_new },
25502550
.gpio = { 0x00000001, gk104_gpio_new },
2551-
.gsp = { 0x00000001, gv100_gsp_new },
2551+
.gsp = { 0x00000001, tu116_gsp_new },
25522552
.i2c = { 0x00000001, gm200_i2c_new },
25532553
.imem = { 0x00000001, nv50_instmem_new },
25542554
.ltc = { 0x00000001, gp102_ltc_new },
@@ -2580,6 +2580,7 @@ nv170_chipset = {
25802580
.fault = { 0x00000001, tu102_fault_new },
25812581
.fb = { 0x00000001, ga100_fb_new },
25822582
.gpio = { 0x00000001, gk104_gpio_new },
2583+
.gsp = { 0x00000001, ga100_gsp_new },
25832584
.i2c = { 0x00000001, gm200_i2c_new },
25842585
.imem = { 0x00000001, nv50_instmem_new },
25852586
.mc = { 0x00000001, ga100_mc_new },
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
# SPDX-License-Identifier: MIT
22
nvkm-y += nvkm/subdev/gsp/base.o
33
nvkm-y += nvkm/subdev/gsp/gv100.o
4+
nvkm-y += nvkm/subdev/gsp/tu102.o
5+
nvkm-y += nvkm/subdev/gsp/tu116.o
6+
nvkm-y += nvkm/subdev/gsp/ga100.o
47
nvkm-y += nvkm/subdev/gsp/ga102.o

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/base.c

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,58 @@
2020
* OTHER DEALINGS IN THE SOFTWARE.
2121
*/
2222
#include "priv.h"
23-
#include <core/falcon.h>
24-
#include <core/firmware.h>
25-
#include <subdev/acr.h>
26-
#include <subdev/top.h>
23+
24+
static int
25+
nvkm_gsp_fini(struct nvkm_subdev *subdev, bool suspend)
26+
{
27+
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
28+
29+
if (!gsp->func->fini)
30+
return 0;
31+
32+
return gsp->func->fini(gsp, suspend);
33+
}
34+
35+
static int
36+
nvkm_gsp_init(struct nvkm_subdev *subdev)
37+
{
38+
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
39+
40+
if (!gsp->func->init)
41+
return 0;
42+
43+
return gsp->func->init(gsp);
44+
}
45+
46+
static int
47+
nvkm_gsp_oneinit(struct nvkm_subdev *subdev)
48+
{
49+
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
50+
51+
if (!gsp->func->oneinit)
52+
return 0;
53+
54+
return gsp->func->oneinit(gsp);
55+
}
2756

2857
static void *
2958
nvkm_gsp_dtor(struct nvkm_subdev *subdev)
3059
{
3160
struct nvkm_gsp *gsp = nvkm_gsp(subdev);
61+
62+
if (gsp->func && gsp->func->dtor)
63+
gsp->func->dtor(gsp);
64+
3265
nvkm_falcon_dtor(&gsp->falcon);
3366
return gsp;
3467
}
3568

3669
static const struct nvkm_subdev_func
3770
nvkm_gsp = {
3871
.dtor = nvkm_gsp_dtor,
72+
.oneinit = nvkm_gsp_oneinit,
73+
.init = nvkm_gsp_init,
74+
.fini = nvkm_gsp_fini,
3975
};
4076

4177
int
@@ -55,5 +91,6 @@ nvkm_gsp_new_(const struct nvkm_gsp_fwif *fwif, struct nvkm_device *device,
5591

5692
gsp->func = fwif->func;
5793

58-
return nvkm_falcon_ctor(gsp->func->flcn, &gsp->subdev, gsp->subdev.name, 0, &gsp->falcon);
94+
return nvkm_falcon_ctor(gsp->func->flcn, &gsp->subdev, gsp->subdev.name, 0x110000,
95+
&gsp->falcon);
5996
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2022 Red Hat Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
#include "priv.h"
23+
24+
static struct nvkm_gsp_fwif
25+
ga100_gsps[] = {
26+
{ -1, gv100_gsp_nofw, &gv100_gsp },
27+
{}
28+
};
29+
30+
int
31+
ga100_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
32+
struct nvkm_gsp **pgsp)
33+
{
34+
return nvkm_gsp_new_(ga100_gsps, device, type, inst, pgsp);
35+
}

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ga102.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,9 @@ ga102_gsp = {
3939
.flcn = &ga102_gsp_flcn,
4040
};
4141

42-
static int
43-
ga102_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
44-
{
45-
return 0;
46-
}
47-
4842
static struct nvkm_gsp_fwif
4943
ga102_gsps[] = {
50-
{ -1, ga102_gsp_nofw, &ga102_gsp },
44+
{ -1, gv100_gsp_nofw, &ga102_gsp },
5145
{}
5246
};
5347

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/gv100.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ gv100_gsp_flcn = {
3434
.dmem_pio = &gm200_flcn_dmem_pio,
3535
};
3636

37-
static const struct nvkm_gsp_func
37+
const struct nvkm_gsp_func
3838
gv100_gsp = {
3939
.flcn = &gv100_gsp_flcn,
4040
};
4141

42-
static int
42+
int
4343
gv100_gsp_nofw(struct nvkm_gsp *gsp, int ver, const struct nvkm_gsp_fwif *fwif)
4444
{
4545
return 0;

drivers/gpu/drm/nouveau/nvkm/subdev/gsp/priv.h

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,25 @@
44
#include <subdev/gsp.h>
55
enum nvkm_acr_lsf_id;
66

7-
struct nvkm_gsp_func {
8-
const struct nvkm_falcon_func *flcn;
9-
};
10-
117
struct nvkm_gsp_fwif {
128
int version;
139
int (*load)(struct nvkm_gsp *, int ver, const struct nvkm_gsp_fwif *);
1410
const struct nvkm_gsp_func *func;
1511
};
1612

13+
int gv100_gsp_nofw(struct nvkm_gsp *, int, const struct nvkm_gsp_fwif *);
14+
15+
struct nvkm_gsp_func {
16+
const struct nvkm_falcon_func *flcn;
17+
18+
void (*dtor)(struct nvkm_gsp *);
19+
int (*oneinit)(struct nvkm_gsp *);
20+
int (*init)(struct nvkm_gsp *);
21+
int (*fini)(struct nvkm_gsp *, bool suspend);
22+
};
23+
1724
int nvkm_gsp_new_(const struct nvkm_gsp_fwif *, struct nvkm_device *, enum nvkm_subdev_type, int,
1825
struct nvkm_gsp **);
26+
27+
extern const struct nvkm_gsp_func gv100_gsp;
1928
#endif
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2022 Red Hat Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
#include "priv.h"
23+
24+
static struct nvkm_gsp_fwif
25+
tu102_gsps[] = {
26+
{ -1, gv100_gsp_nofw, &gv100_gsp },
27+
{}
28+
};
29+
30+
int
31+
tu102_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
32+
struct nvkm_gsp **pgsp)
33+
{
34+
return nvkm_gsp_new_(tu102_gsps, device, type, inst, pgsp);
35+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2022 Red Hat Inc.
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a
5+
* copy of this software and associated documentation files (the "Software"),
6+
* to deal in the Software without restriction, including without limitation
7+
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
* and/or sell copies of the Software, and to permit persons to whom the
9+
* Software is furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18+
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
* OTHER DEALINGS IN THE SOFTWARE.
21+
*/
22+
#include "priv.h"
23+
24+
static struct nvkm_gsp_fwif
25+
tu116_gsps[] = {
26+
{ -1, gv100_gsp_nofw, &gv100_gsp },
27+
{}
28+
};
29+
30+
int
31+
tu116_gsp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
32+
struct nvkm_gsp **pgsp)
33+
{
34+
return nvkm_gsp_new_(tu116_gsps, device, type, inst, pgsp);
35+
}

0 commit comments

Comments
 (0)