From b252653ac5f2b12a9a84476f9dde6a844a77a602 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 28 Sep 2017 10:34:27 -0700 Subject: gpu: nvgpu: Move rest of CDE structures to Linux Move rest of CDE structures to common/linux. This includes moving the per-chip firmware file interpretation functions, and removing CDE ops from HAL and adding it to nvgpu_os_linux. JIRA NVGPU-259 Change-Id: I59d8f44bddadecef81ad3c455b363a14034c5e13 Signed-off-by: Terje Bergstrom Reviewed-on: https://git-master.nvidia.com/r/1570403 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/linux/module.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'drivers/gpu/nvgpu/common/linux/module.c') diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c index fe3e4e6f..b7d13f05 100644 --- a/drivers/gpu/nvgpu/common/linux/module.c +++ b/drivers/gpu/nvgpu/common/linux/module.c @@ -49,6 +49,8 @@ #endif #endif #include "os_linux.h" +#include "cde_gm20b.h" +#include "cde_gp10b.h" #define CLASS_NAME "nvidia-gpu" /* TODO: Change to e.g. "nvidia-gpu%s" once we have symlinks in place. */ @@ -154,6 +156,26 @@ static int gk20a_restore_registers(struct gk20a *g) return 0; } +static int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) { + struct gk20a *g = &l->g; + u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; + + switch (ver) { + case GK20A_GPUID_GM20B: + case GK20A_GPUID_GM20B_B: + l->ops.cde = gm20b_cde_ops.cde; + break; + case NVGPU_GPUID_GP10B: + l->ops.cde = gp10b_cde_ops.cde; + break; + default: + /* CDE is optional, so today ignoring unknown chip is fine */ + break; + } + + return 0; +} + int gk20a_pm_finalize_poweron(struct device *dev) { struct gk20a *g = get_gk20a(dev); @@ -198,6 +220,10 @@ int gk20a_pm_finalize_poweron(struct device *dev) trace_gk20a_finalize_poweron_done(dev_name(dev)); + err = nvgpu_init_os_linux_ops(l); + if (err) + goto done; + enable_irq(g->irq_stall); if (g->irq_stall != g->irq_nonstall) enable_irq(g->irq_nonstall); -- cgit v1.2.2