gpu: nvgpu: fix nvgpu remove sequence

While removing the nvgpu module, all gpu unmaps should happen before
removing the PMU support as ELPG_MS accesses pmu pg structure and
ELPG_MS is disabled/enabled while accessing TLB or cache flush.

nvgpu_fb_vab_teardown_hal and mmu_fault.info_mem_destroy do gpu
unmaps. They were executed post removal of PMU support. Fix the
sequence.

Bug 3448630

Change-Id: I44925c313c625a2d0f297d1367d69069b3deacef
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2632490
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: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sagar Kamble
2021-11-25 20:49:20 +05:30
committed by mobile promotions
parent 3d9c67a0e7
commit 41df3e17a7
3 changed files with 23 additions and 12 deletions

View File

@@ -143,17 +143,6 @@ static void nvgpu_remove_mm_support(struct mm_gk20a *mm)
nvgpu_dma_free(g, &mm->mmu_wr_mem); nvgpu_dma_free(g, &mm->mmu_wr_mem);
nvgpu_dma_free(g, &mm->mmu_rd_mem); nvgpu_dma_free(g, &mm->mmu_rd_mem);
#if defined(CONFIG_NVGPU_NON_FUSA)
if (nvgpu_fb_vab_teardown_hal(g) != 0) {
nvgpu_err(g, "failed to teardown VAB");
}
#endif
if (g->ops.mm.mmu_fault.info_mem_destroy != NULL) {
g->ops.mm.mmu_fault.info_mem_destroy(g);
}
if (g->ops.mm.remove_bar2_vm != NULL) { if (g->ops.mm.remove_bar2_vm != NULL) {
g->ops.mm.remove_bar2_vm(g); g->ops.mm.remove_bar2_vm(g);
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2014-2020, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -37,6 +37,7 @@
#include <nvgpu/gr/gr.h> #include <nvgpu/gr/gr.h>
#include <nvgpu/nvgpu_init.h> #include <nvgpu/nvgpu_init.h>
#include <nvgpu/device.h> #include <nvgpu/device.h>
#include <nvgpu/fb.h>
#include "init_vgpu.h" #include "init_vgpu.h"
#include "hal/vgpu/init/init_hal_vgpu.h" #include "hal/vgpu/init/init_hal_vgpu.h"
@@ -84,6 +85,16 @@ void vgpu_remove_support_common(struct gk20a *g)
g->fifo.remove_support(&g->fifo); g->fifo.remove_support(&g->fifo);
} }
#if defined(CONFIG_NVGPU_NON_FUSA)
if (nvgpu_fb_vab_teardown_hal(g) != 0) {
nvgpu_err(g, "failed to teardown VAB");
}
#endif
if (g->ops.mm.mmu_fault.info_mem_destroy != NULL) {
g->ops.mm.mmu_fault.info_mem_destroy(g);
}
nvgpu_pmu_remove_support(g, g->pmu); nvgpu_pmu_remove_support(g, g->pmu);
if (g->mm.remove_support) { if (g->mm.remove_support) {

View File

@@ -65,6 +65,7 @@
#include <nvgpu/mc.h> #include <nvgpu/mc.h>
#include <nvgpu/cic_mon.h> #include <nvgpu/cic_mon.h>
#include <nvgpu/cic_rm.h> #include <nvgpu/cic_rm.h>
#include <nvgpu/fb.h>
#include "platform_gk20a.h" #include "platform_gk20a.h"
#include "sysfs.h" #include "sysfs.h"
@@ -1037,6 +1038,16 @@ void gk20a_remove_support(struct gk20a *g)
if (g->fifo.remove_support) if (g->fifo.remove_support)
g->fifo.remove_support(&g->fifo); g->fifo.remove_support(&g->fifo);
#if defined(CONFIG_NVGPU_NON_FUSA)
if (nvgpu_fb_vab_teardown_hal(g) != 0) {
nvgpu_err(g, "failed to teardown VAB");
}
#endif
if (g->ops.mm.mmu_fault.info_mem_destroy != NULL) {
g->ops.mm.mmu_fault.info_mem_destroy(g);
}
nvgpu_pmu_remove_support(g, g->pmu); nvgpu_pmu_remove_support(g, g->pmu);
if (g->mm.remove_support) if (g->mm.remove_support)