Commit f21950ea authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/pm: stack perfdom class under perfmon

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 2d4b94b9
...@@ -576,12 +576,32 @@ nvkm_perfmon_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) ...@@ -576,12 +576,32 @@ nvkm_perfmon_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
return -EINVAL; return -EINVAL;
} }
static struct nvkm_oclass
nvkm_perfmon_sclass[] = {
{ .handle = NVIF_IOCTL_NEW_V0_PERFDOM,
.ofuncs = &nvkm_perfdom_ofuncs,
},
{}
};
static int
nvkm_perfmon_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_oclass *oclass, void *data, u32 size,
struct nvkm_object **pobject)
{
struct nvkm_parent *perfmon;
int ret = nvkm_parent_create(parent, engine, oclass, 0,
nvkm_perfmon_sclass, 0, &perfmon);
*pobject = perfmon ? &perfmon->object : NULL;
return ret;
}
static struct nvkm_ofuncs static struct nvkm_ofuncs
nvkm_perfmon_ofuncs = { nvkm_perfmon_ofuncs = {
.ctor = _nvkm_object_ctor, .ctor = nvkm_perfmon_ctor,
.dtor = nvkm_object_destroy, .dtor = _nvkm_parent_dtor,
.init = nvkm_object_init, .init = _nvkm_parent_init,
.fini = nvkm_object_fini, .fini = _nvkm_parent_fini,
.mthd = nvkm_perfmon_mthd, .mthd = nvkm_perfmon_mthd,
}; };
...@@ -591,9 +611,6 @@ nvkm_pm_sclass[] = { ...@@ -591,9 +611,6 @@ nvkm_pm_sclass[] = {
.handle = NVIF_IOCTL_NEW_V0_PERFMON, .handle = NVIF_IOCTL_NEW_V0_PERFMON,
.ofuncs = &nvkm_perfmon_ofuncs, .ofuncs = &nvkm_perfmon_ofuncs,
}, },
{ .handle = NVIF_IOCTL_NEW_V0_PERFDOM,
.ofuncs = &nvkm_perfdom_ofuncs,
},
{}, {},
}; };
...@@ -622,6 +639,13 @@ nvkm_perfctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -622,6 +639,13 @@ nvkm_perfctx_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_perfctx *ctx; struct nvkm_perfctx *ctx;
int ret; int ret;
/* no context needed for perfdom objects... */
if (nv_mclass(parent) != NV_DEVICE) {
atomic_inc(&parent->refcount);
*pobject = parent;
return 1;
}
ret = nvkm_engctx_create(parent, engine, oclass, NULL, 0, 0, 0, &ctx); ret = nvkm_engctx_create(parent, engine, oclass, NULL, 0, 0, 0, &ctx);
*pobject = nv_object(ctx); *pobject = nv_object(ctx);
if (ret) if (ret)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment