gpu: nvgpu: Move device de-init call

Move the device de-init call to when the gk20a struct is being freed;
the device list can live for as long as the gk20a struct does. This
will be a problem later, since the current location causes the device
structs to get freed and allocatoed over and over. That'll cause gross
corruption in the FIFO code when the engine_info struct is replaced
with pointers to the device structs.

JIRA NVGPU-5421

Change-Id: If4e08ea88dbcae7acd599e3fad29f72ece63b8e0
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2361269
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Alex Waterman
2020-06-15 18:58:13 -05:00
parent 5c7b73e6ca
commit 8c5972ac7f
2 changed files with 9 additions and 2 deletions

View File

@@ -116,6 +116,13 @@ void nvgpu_device_cleanup(struct gk20a *g)
u32 i;
struct nvgpu_list_node *devlist;
/*
* Make unit testing a bit easier.
*/
if (g->devs == NULL) {
return;
}
for (i = 0; i < NVGPU_MAX_DEVTYPE; i++) {
devlist = &g->devs->devlist_heads[i];

View File

@@ -326,8 +326,6 @@ int nvgpu_prepare_poweroff(struct gk20a *g)
}
#endif
nvgpu_device_cleanup(g);
/* Disable GPCPLL */
if (g->ops.clk.suspend_clk_support != NULL) {
g->ops.clk.suspend_clk_support(g);
@@ -868,6 +866,8 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount)
g->ops.ltc.ltc_remove_support(g);
}
nvgpu_device_cleanup(g);
nvgpu_sw_quiesce_remove_support(g);
if (g->gfree != NULL) {