forked from Minki/linux
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: Ben Skeggs <bskeggs@redhat.com>
This commit is contained in:
parent
551d341755
commit
8de65bd090
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user