提交 8de65bd0 编写于 作者: B Ben Skeggs

drm/nouveau/devinit: run devinit scripts right after preinit

This ensures we have a valid mask of disabled engines before we start
trying to execute fini()/init() on the subdevs, potentially touching
devices that don't exist.
Signed-off-by: NBen Skeggs <bskeggs@redhat.com>
上级 551d3417
......@@ -13,6 +13,7 @@ u32 nvkm_devinit_mmio(struct nvkm_devinit *, u32 addr);
int nvkm_devinit_pll_set(struct nvkm_devinit *, u32 type, u32 khz);
void nvkm_devinit_meminit(struct nvkm_devinit *);
u64 nvkm_devinit_disable(struct nvkm_devinit *);
int nvkm_devinit_post(struct nvkm_devinit *, u64 *disable);
int nv04_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv05_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
......
......@@ -2167,7 +2167,9 @@ nvkm_device_preinit(struct nvkm_device *device)
}
}
/*XXX: devinit */
ret = nvkm_devinit_post(device->devinit, &device->disable_mask);
if (ret)
goto fail;
time = ktime_to_us(ktime_get()) - time;
nvdev_trace(device, "preinit completed in %lldus\n", time);
......
......@@ -50,11 +50,21 @@ nvkm_devinit_meminit(struct nvkm_devinit *init)
u64
nvkm_devinit_disable(struct nvkm_devinit *init)
{
if (init->func->disable)
if (init && init->func->disable)
return init->func->disable(init);
return 0;
}
int
nvkm_devinit_post(struct nvkm_devinit *init, u64 *disable)
{
int ret = 0;
if (init && init->func->post)
ret = init->func->post(init, init->post);
*disable = nvkm_devinit_disable(init);
return ret;
}
static int
nvkm_devinit_fini(struct nvkm_subdev *subdev, bool suspend)
{
......@@ -82,17 +92,8 @@ static int
nvkm_devinit_init(struct nvkm_subdev *subdev)
{
struct nvkm_devinit *init = nvkm_devinit(subdev);
int ret;
ret = init->func->post(init, init->post);
if (ret)
return ret;
if (init->func->init)
init->func->init(init);
if (init->func->disable)
subdev->device->disable_mask |= init->func->disable(init);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册