diff --git a/drivers/gpu/nvgpu/hal/fb/fb_gm20b_fusa.c b/drivers/gpu/nvgpu/hal/fb/fb_gm20b_fusa.c index 0e18196f4..1842f72d5 100644 --- a/drivers/gpu/nvgpu/hal/fb/fb_gm20b_fusa.c +++ b/drivers/gpu/nvgpu/hal/fb/fb_gm20b_fusa.c @@ -139,6 +139,11 @@ int gm20b_fb_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) } while (nvgpu_timeout_expired_msg(&timeout, "wait mmu invalidate") == 0); + if (nvgpu_timeout_peek_expired(&timeout)) { + err = -ETIMEDOUT; + goto out; + } + #ifdef CONFIG_NVGPU_TRACE trace_gk20a_mm_tlb_invalidate_done(g->name); #endif diff --git a/drivers/gpu/nvgpu/hal/fb/fb_tu104.c b/drivers/gpu/nvgpu/hal/fb/fb_tu104.c index b0ae89df7..0b3e61a2e 100644 --- a/drivers/gpu/nvgpu/hal/fb/fb_tu104.c +++ b/drivers/gpu/nvgpu/hal/fb/fb_tu104.c @@ -92,6 +92,10 @@ int fb_tu104_tlb_invalidate(struct gk20a *g, struct nvgpu_mem *pdb) } while (nvgpu_timeout_expired_msg(&timeout, "wait mmu invalidate") == 0); + if (nvgpu_timeout_peek_expired(&timeout)) { + err = -ETIMEDOUT; + } + #ifdef CONFIG_NVGPU_TRACE trace_gk20a_mm_tlb_invalidate_done(g->name); #endif diff --git a/userspace/units/fb/fb_gm20b_fusa.c b/userspace/units/fb/fb_gm20b_fusa.c index a357e3479..165b25dd8 100644 --- a/userspace/units/fb/fb_gm20b_fusa.c +++ b/userspace/units/fb/fb_gm20b_fusa.c @@ -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 * 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); /* - * Timeout on fb_mmu_ctrl_r read after MMU invalidate (does not return - * a failure) + * Timeout on fb_mmu_ctrl_r read after MMU invalidate. */ helper_intercept_mmu_write(0); err = g->ops.fb.tlb_invalidate(g, &pdb); - if (err != 0) { - unit_return_fail(m, "tlb_invalidate failed (2)\n"); + if (err == 0) { + unit_return_fail(m, "tlb_invalidate did not fail as expected (2)\n"); } /* Success */