summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
diff options
context:
space:
mode:
authorAlexandre Courbot <acourbot@nvidia.com>2017-02-22 20:48:30 +0900
committerBen Skeggs <bskeggs@redhat.com>2017-03-07 17:05:12 +1000
commit9e4397579fa4cd5cc411d47815eb805e337d0203 (patch)
treeeb9985d5865f45b44299e76c99a9c01bce09c2df /drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
parent65d9376b74ff651a8d4c6736d32a3bb3aa47bf09 (diff)
downloadblackbird-op-linux-9e4397579fa4cd5cc411d47815eb805e337d0203.tar.gz
blackbird-op-linux-9e4397579fa4cd5cc411d47815eb805e337d0203.zip
drm/nouveau/falcon: delay construction of falcons to oneinit()
Reading registers at device construction time can be harmful, as there is no guarantee the underlying engine will be up, or in its runtime configuration. Defer register reading to the oneinit() hook and update users accordingly. Signed-off-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c')
-rw-r--r--drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
index 1871a92e8f2f..3306f9fe7140 100644
--- a/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
+++ b/drivers/gpu/drm/nouveau/nvkm/subdev/pmu/base.c
@@ -115,6 +115,13 @@ nvkm_pmu_init(struct nvkm_subdev *subdev)
return ret;
}
+static int
+nvkm_pmu_oneinit(struct nvkm_subdev *subdev)
+{
+ struct nvkm_pmu *pmu = nvkm_pmu(subdev);
+ return nvkm_falcon_v1_new(&pmu->subdev, "PMU", 0x10a000, &pmu->falcon);
+}
+
static void *
nvkm_pmu_dtor(struct nvkm_subdev *subdev)
{
@@ -128,6 +135,7 @@ static const struct nvkm_subdev_func
nvkm_pmu = {
.dtor = nvkm_pmu_dtor,
.preinit = nvkm_pmu_preinit,
+ .oneinit = nvkm_pmu_oneinit,
.init = nvkm_pmu_init,
.fini = nvkm_pmu_fini,
.intr = nvkm_pmu_intr,
@@ -141,7 +149,7 @@ nvkm_pmu_ctor(const struct nvkm_pmu_func *func, struct nvkm_device *device,
pmu->func = func;
INIT_WORK(&pmu->recv.work, nvkm_pmu_recv);
init_waitqueue_head(&pmu->recv.wait);
- return nvkm_falcon_v1_new(&pmu->subdev, "PMU", 0x10a000, &pmu->falcon);
+ return 0;
}
int
OpenPOWER on IntegriCloud