Commit 8de65bd0 authored by Ben Skeggs's avatar 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: default avatarBen Skeggs <bskeggs@redhat.com>
parent 551d3417
...@@ -13,6 +13,7 @@ u32 nvkm_devinit_mmio(struct nvkm_devinit *, u32 addr); ...@@ -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); int nvkm_devinit_pll_set(struct nvkm_devinit *, u32 type, u32 khz);
void nvkm_devinit_meminit(struct nvkm_devinit *); void nvkm_devinit_meminit(struct nvkm_devinit *);
u64 nvkm_devinit_disable(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 nv04_devinit_new(struct nvkm_device *, int, struct nvkm_devinit **);
int nv05_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) ...@@ -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; time = ktime_to_us(ktime_get()) - time;
nvdev_trace(device, "preinit completed in %lldus\n", time); nvdev_trace(device, "preinit completed in %lldus\n", time);
......
...@@ -50,11 +50,21 @@ nvkm_devinit_meminit(struct nvkm_devinit *init) ...@@ -50,11 +50,21 @@ nvkm_devinit_meminit(struct nvkm_devinit *init)
u64 u64
nvkm_devinit_disable(struct nvkm_devinit *init) nvkm_devinit_disable(struct nvkm_devinit *init)
{ {
if (init->func->disable) if (init && init->func->disable)
return init->func->disable(init); return init->func->disable(init);
return 0; 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 static int
nvkm_devinit_fini(struct nvkm_subdev *subdev, bool suspend) nvkm_devinit_fini(struct nvkm_subdev *subdev, bool suspend)
{ {
...@@ -82,17 +92,8 @@ static int ...@@ -82,17 +92,8 @@ static int
nvkm_devinit_init(struct nvkm_subdev *subdev) nvkm_devinit_init(struct nvkm_subdev *subdev)
{ {
struct nvkm_devinit *init = nvkm_devinit(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) if (init->func->init)
init->func->init(init); init->func->init(init);
if (init->func->disable)
subdev->device->disable_mask |= init->func->disable(init);
return 0; return 0;
} }
......
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