gpu: nvgpu: add timeout error handling

Report a timeout error when fb_mmu_ctrl_r() register doesn't
correctly reflect the tlb invalidate status.

Jira NVGPU-7192

Signed-off-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2603267
(cherry picked from commit b16ed38d087667bc2bddaddde820648d6a931064)
Change-Id: I2360c8741b396b26079438a917770e0bb051c661
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2700042
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Debarshi Dutta
2021-09-30 17:44:53 +05:30
committed by mobile promotions
parent 76cc8870e1
commit 48cd58d332
3 changed files with 13 additions and 5 deletions

View File

@@ -139,6 +139,11 @@ int gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb)
} while (nvgpu_timeout_expired_msg(&timeout, } while (nvgpu_timeout_expired_msg(&timeout,
"wait mmu invalidate") == 0); "wait mmu invalidate") == 0);
if (nvgpu_timeout_peek_expired(&timeout)) {
err = -ETIMEDOUT;
goto out;
}
#ifdef CONFIG_NVGPU_TRACE #ifdef CONFIG_NVGPU_TRACE
trace_gk20a_mm_tlb_invalidate_done(g->name); trace_gk20a_mm_tlb_invalidate_done(g->name);
#endif #endif

View File

@@ -92,6 +92,10 @@ int fb_tu104_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb)
} while (nvgpu_timeout_expired_msg(&timeout, } while (nvgpu_timeout_expired_msg(&timeout,
"wait mmu invalidate") == 0); "wait mmu invalidate") == 0);
if (nvgpu_timeout_peek_expired(&timeout)) {
err = -ETIMEDOUT;
}
#ifdef CONFIG_NVGPU_TRACE #ifdef CONFIG_NVGPU_TRACE
trace_gk20a_mm_tlb_invalidate_done(g->name); trace_gk20a_mm_tlb_invalidate_done(g->name);
#endif #endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, 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"),
@@ -73,13 +73,12 @@ int fb_gm20b_tlb_invalidate_test(struct unit_module *m, struct gk20a *g,
nvgpu_writel(g, fb_mmu_ctrl_r(), 1 << 16U); nvgpu_writel(g, fb_mmu_ctrl_r(), 1 << 16U);
/* /*
* Timeout on fb_mmu_ctrl_r read after MMU invalidate (does not return * Timeout on fb_mmu_ctrl_r read after MMU invalidate.
* a failure)
*/ */
helper_intercept_mmu_write(0); helper_intercept_mmu_write(0);
err = g->ops.fb.tlb_invalidate(g, &pdb); err = g->ops.fb.tlb_invalidate(g, &pdb);
if (err != 0) { if (err == 0) {
unit_return_fail(m, "tlb_invalidate failed (2)\n"); unit_return_fail(m, "tlb_invalidate did not fail as expected (2)\n");
} }
/* Success */ /* Success */