gpu: nvgpu: add a reboot notifier

In some case, CDE is keeping require FW during device shutdown.
So add a reboot notifier to set driver_is_dying during shutdown.

Bug 200455178

Change-Id: Iec324855b15f5f3432ac9358d08ed7cfe4640bf6
Signed-off-by: Jeffery Yu <jefferyy@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1928717
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hayden Du <haydend@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jeffery Yu
2018-10-10 19:04:17 +08:00
committed by mobile promotions
parent a71da1d3f3
commit 17fa44836b
2 changed files with 27 additions and 0 deletions

View File

@@ -1598,6 +1598,21 @@ int gk20a_secure_page_alloc(struct device *dev)
return err;
}
static int gk20a_reboot_cb(struct notifier_block *nb,
unsigned long event, void *unused)
{
struct gk20a_platform *platform = NULL;
platform = container_of(nb, struct gk20a_platform,
reboot_notifier);
down_write(&platform->g->busy_lock);
platform->g->driver_is_dying = 1;
up_write(&platform->g->busy_lock);
return NOTIFY_DONE;
}
static int gk20a_probe(struct platform_device *dev)
{
struct gk20a *gk20a;
@@ -1635,6 +1650,15 @@ static int gk20a_probe(struct platform_device *dev)
}
set_gk20a(dev, gk20a);
platform->reboot_notifier.notifier_call = gk20a_reboot_cb;
err = register_reboot_notifier(&platform->reboot_notifier);
if (err) {
dev_err(&dev->dev,
"failed to register reboot notifier\n");
return err;
}
gk20a->dev = &dev->dev;
nvgpu_kmem_init(gk20a);

View File

@@ -43,6 +43,9 @@ struct gk20a_platform {
/* Populated by the gk20a driver before probing the platform. */
struct gk20a *g;
/* Make gpu be "can't be busy" during system shutdown. */
struct notifier_block reboot_notifier;
/* Should be populated at probe. */
bool is_fmodel;