diff --git a/drivers/gpu/nvgpu/Makefile.linux.configs b/drivers/gpu/nvgpu/Makefile.linux.configs index 0dec525ee..b4a82dd2f 100644 --- a/drivers/gpu/nvgpu/Makefile.linux.configs +++ b/drivers/gpu/nvgpu/Makefile.linux.configs @@ -98,6 +98,11 @@ ifdef CONFIG_TEGRA_NVMAP_NEXT CONFIG_NVGPU_NVMAP_NEXT := y endif +CONFIG_NVGPU_ENABLE_MISC_EC := n +ifdef CONFIG_TEGRA_EPL +CONFIG_NVGPU_ENABLE_MISC_EC := y +endif + ifneq ($(findstring 5.10,$(NV_BUILD_KERNEL_OPTIONS)),) CONFIG_NVGPU_NVMAP_NEXT := y endif @@ -273,3 +278,6 @@ endif ifeq ($(CONFIG_NVGPU_IVM_BUILD),y) ccflags-y += -DCONFIG_NVGPU_IVM_BUILD endif +ifeq ($(CONFIG_NVGPU_ENABLE_MISC_EC),y) +ccflags-y += -DCONFIG_NVGPU_ENABLE_MISC_EC +endif diff --git a/drivers/gpu/nvgpu/os/linux/cic/cic_report_err.c b/drivers/gpu/nvgpu/os/linux/cic/cic_report_err.c index 46dc9fb5e..9e3cffdc0 100644 --- a/drivers/gpu/nvgpu/os/linux/cic/cic_report_err.c +++ b/drivers/gpu/nvgpu/os/linux/cic/cic_report_err.c @@ -17,13 +17,33 @@ #include #include +#ifdef CONFIG_NVGPU_ENABLE_MISC_EC +#include +#include "os/linux/os_linux.h" +#endif + struct gk20a; -int nvgpu_cic_mon_report_err_safety_services(struct gk20a *g, - u32 err_id) +int nvgpu_cic_mon_report_err_safety_services(struct gk20a *g, u32 err_id) { + int ret = 0U; + +#ifdef CONFIG_NVGPU_ENABLE_MISC_EC + struct device *dev = dev_from_gk20a(g); + /** - * ToDo: Add MISC_EC API to report error. + * MISC_EC_SW_ERR_CODE_0 register has been allocated for NvGPU + * to report GPU HW errors to Safety_Services via MISC_EC interface. */ - return 0; + ret = epl_report_misc_ec_error(dev, MISC_EC_SW_ERR_CODE_0, err_id); + if (ret != 0) { + nvgpu_err(g, "Error reporting to Safety_Services failed"); + nvgpu_err(g, "ret (%d). err (0x%x)", ret, err_id); + } else { + nvgpu_err(g, "Reported err (0x%x) to Safety_Services", + err_id); + } +#endif + + return ret; }