From bf5f86b354ed98ea3e4ae2477ac1a174a8d3e23b Mon Sep 17 00:00:00 2001 From: Prateek Sethi Date: Sun, 26 May 2019 21:54:54 +0530 Subject: [PATCH] gpu: nvgpu: fix boot time process crash In poweron sequence the mc interrupts are being enabled before initializing ecc support. That means ecc handler can be triggered if there is ecc error occur and can cause Segmentation Fault. To fix this issue adding a check in tu104_fbpa_handle_ecc_intr() Bug 2540926 Change-Id: I277a8946d797bfcaac353d27f4eadf0c7ebbadfa Signed-off-by: Prateek Sethi Reviewed-on: https://git-master.nvidia.com/r/2125568 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: Vaibhav Kachore Reviewed-by: Vijayakumar Subbu Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/hal/fbpa/fbpa_tu104.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/nvgpu/hal/fbpa/fbpa_tu104.c b/drivers/gpu/nvgpu/hal/fbpa/fbpa_tu104.c index 08dad8f8f..4659a2ef0 100644 --- a/drivers/gpu/nvgpu/hal/fbpa/fbpa_tu104.c +++ b/drivers/gpu/nvgpu/hal/fbpa/fbpa_tu104.c @@ -52,6 +52,11 @@ static void tu104_fbpa_handle_ecc_intr(struct gk20a *g, status = gk20a_readl(g, offset + fbpa_0_ecc_status_r(subp_id)); + if (!g->ecc.initialized) { + nvgpu_info(g, "ecc support is not initialized"); + goto out; + } + if ((status & fbpa_0_ecc_status_sec_counter_overflow_pending_f()) != 0U) { nvgpu_err(g, "fbpa %u subp %u ecc sec counter overflow", fbpa_id, subp_id); @@ -76,6 +81,7 @@ static void tu104_fbpa_handle_ecc_intr(struct gk20a *g, g->ecc.fbpa.fbpa_ecc_ded_err_count[cnt_idx].counter += ded_cnt; } +out: gk20a_writel(g, offset + fbpa_0_ecc_status_r(subp_id), status); }