From 31b2738f6a74b927da1052a56fa13d36014e61b9 Mon Sep 17 00:00:00 2001 From: Tejal Kudav Date: Sun, 27 Nov 2022 18:49:27 +0000 Subject: [PATCH] gpu: nvgpu: Add Epl Init EPL lib constructor is replaced by NvEplInit() by safety services. NvGPU, being an EPL user, needs to call NvEplInit before using EPL API to report errors. NvEplInit() usage is limited to user space in Linux, so NvGPU is not expected to call NvEplInit on Linux. Bug 3863536 Change-Id: I7fc9b33d3443bd39a6367a0c691bddb80b9edb68 Signed-off-by: Tejal Kudav Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2817245 Tested-by: mobile promotions Reviewed-by: mobile promotions --- drivers/gpu/nvgpu/Makefile.linux.configs | 2 ++ drivers/gpu/nvgpu/Makefile.shared.configs | 9 +++++++++ drivers/gpu/nvgpu/common/cic/mon/mon_init.c | 8 ++++++++ drivers/gpu/nvgpu/include/nvgpu/cic_mon.h | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/drivers/gpu/nvgpu/Makefile.linux.configs b/drivers/gpu/nvgpu/Makefile.linux.configs index 1e0e2e8c9..87875dd3e 100644 --- a/drivers/gpu/nvgpu/Makefile.linux.configs +++ b/drivers/gpu/nvgpu/Makefile.linux.configs @@ -208,6 +208,8 @@ endif CONFIG_NVGPU_TSG_SHARING := y +CONFIG_NVGPU_EPL_INIT := n + ifeq ($(CONFIG_GK20A_PMU),y) ccflags-y += -DCONFIG_GK20A_PMU endif diff --git a/drivers/gpu/nvgpu/Makefile.shared.configs b/drivers/gpu/nvgpu/Makefile.shared.configs index ed02feb3e..b402af66b 100644 --- a/drivers/gpu/nvgpu/Makefile.shared.configs +++ b/drivers/gpu/nvgpu/Makefile.shared.configs @@ -202,6 +202,15 @@ NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_FALCON_DEBUG # ifneq ($(profile),safety_debug) +ifneq ($(NVGPU_HVRTOS),1) +ifeq ($(CONFIG_NVGPU_ENABLE_MISC_EC),1) +ifneq ($(CONFIG_NVGPU_MON_PRESENT),1) +CONFIG_NVGPU_EPL_INIT := 1 +NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_EPL_INIT +endif +endif +endif + ifneq ($(NVGPU_HVRTOS),1) CONFIG_NVGPU_SYSFS := 1 NVGPU_COMMON_CFLAGS += -DCONFIG_NVGPU_SYSFS diff --git a/drivers/gpu/nvgpu/common/cic/mon/mon_init.c b/drivers/gpu/nvgpu/common/cic/mon/mon_init.c index af5ac3ae9..9132efcde 100644 --- a/drivers/gpu/nvgpu/common/cic/mon/mon_init.c +++ b/drivers/gpu/nvgpu/common/cic/mon/mon_init.c @@ -60,6 +60,14 @@ int nvgpu_cic_mon_init(struct gk20a *g) return -EINVAL; } +#ifdef CONFIG_NVGPU_EPL_INIT + err = nvgpu_cic_mon_init_epl(g); + if (err != 0) { + nvgpu_err(g, "NvEpl init failed: %d", err); + return -EINVAL; + } +#endif + #ifdef CONFIG_NVGPU_FSI_ERR_INJECTION if (g->ops.cic_mon.reg_errinj_cb != NULL) { err = g->ops.cic_mon.reg_errinj_cb(g); diff --git a/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h b/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h index cea989145..1bc6ec417 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h +++ b/drivers/gpu/nvgpu/include/nvgpu/cic_mon.h @@ -663,4 +663,9 @@ void nvgpu_cic_mon_intr_enable(struct gk20a *g); int nvgpu_cic_mon_reg_errinj_cb(struct gk20a *g); int nvgpu_cic_mon_dereg_errinj_cb(void); #endif + +#ifdef CONFIG_NVGPU_EPL_INIT +int nvgpu_cic_mon_init_epl(struct gk20a *g); +#endif + #endif /* NVGPU_CIC_MON_H */