From d4eb7f691ef14263377c0f33777b104e2b1a0c53 Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Fri, 17 Jun 2016 14:09:34 +0530 Subject: gpu: nvgpu: select FW based on ARCH JIRA DNVGPU-34 Change-Id: Iea1964c7d12536591659188c8e969fc7fb632d12 Signed-off-by: Mahantesh Kumbar Reviewed-on: http://git-master/r/1166785 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp106/acr_gp106.c | 31 +++++++++++++++++++++++++++---- drivers/gpu/nvgpu/gp106/acr_gp106.h | 5 +++++ drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c | 19 +++++++++++++++++-- drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h | 1 + drivers/gpu/nvgpu/gp106/hal_gp106.c | 13 +------------ drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c | 2 +- 6 files changed, 52 insertions(+), 19 deletions(-) (limited to 'drivers/gpu') diff --git a/drivers/gpu/nvgpu/gp106/acr_gp106.c b/drivers/gpu/nvgpu/gp106/acr_gp106.c index 0e49214e..a578c4a0 100644 --- a/drivers/gpu/nvgpu/gp106/acr_gp106.c +++ b/drivers/gpu/nvgpu/gp106/acr_gp106.c @@ -27,6 +27,7 @@ #include "gm20b/acr_gm20b.h" #include "gm206/pmu_gm206.h" #include "sec2_gp106.h" +#include "nvgpu_gpuid_t18x.h" /*Defines*/ #define gp106_dbg_pmu(fmt, arg...) \ @@ -185,11 +186,22 @@ release_img_fw: int fecs_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img) { + u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; struct lsf_ucode_desc_v1 *lsf_desc; - const struct firmware *fecs_sig; + const struct firmware *fecs_sig = NULL; int err; - fecs_sig = gk20a_request_firmware(g, GM20B_FECS_UCODE_SIG); + switch (ver) { + case NVGPU_GPUID_GP104: + fecs_sig = gk20a_request_firmware(g, GP104_FECS_UCODE_SIG); + break; + case NVGPU_GPUID_GP106: + fecs_sig = gk20a_request_firmware(g, GP106_FECS_UCODE_SIG); + break; + default: + gk20a_err(g->dev, "no support for GPUID %x", ver); + } + if (!fecs_sig) { gk20a_err(dev_from_gk20a(g), "failed to load fecs sig"); return -ENOENT; @@ -252,14 +264,25 @@ rel_sig: } int gpccs_ucode_details(struct gk20a *g, struct flcn_ucode_img_v1 *p_img) { + u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; struct lsf_ucode_desc_v1 *lsf_desc; - const struct firmware *gpccs_sig; + const struct firmware *gpccs_sig = NULL; int err; if (g->ops.securegpccs == false) return -ENOENT; - gpccs_sig = gk20a_request_firmware(g, T18x_GPCCS_UCODE_SIG); + switch (ver) { + case NVGPU_GPUID_GP104: + gpccs_sig = gk20a_request_firmware(g, GP104_GPCCS_UCODE_SIG); + break; + case NVGPU_GPUID_GP106: + gpccs_sig = gk20a_request_firmware(g, GP106_GPCCS_UCODE_SIG); + break; + default: + gk20a_err(g->dev, "no support for GPUID %x", ver); + } + if (!gpccs_sig) { gk20a_err(dev_from_gk20a(g), "failed to load gpccs sig"); return -ENOENT; diff --git a/drivers/gpu/nvgpu/gp106/acr_gp106.h b/drivers/gpu/nvgpu/gp106/acr_gp106.h index 9afec529..cd555eb8 100644 --- a/drivers/gpu/nvgpu/gp106/acr_gp106.h +++ b/drivers/gpu/nvgpu/gp106/acr_gp106.h @@ -17,6 +17,11 @@ #include "gm20b/acr_gm20b.h" #include "gm206/acr_gm206.h" +#define GP106_FECS_UCODE_SIG "gp106/fecs_sig.bin" +#define GP106_GPCCS_UCODE_SIG "gp106/gpccs_sig.bin" +#define GP104_FECS_UCODE_SIG "gp104/fecs_sig.bin" +#define GP104_GPCCS_UCODE_SIG "gp104/gpccs_sig.bin" + struct lsf_ucode_desc_v1 { u8 prd_keys[2][16]; u8 dbg_keys[2][16]; diff --git a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c index 34e1f859..1f47cc5a 100644 --- a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c +++ b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.c @@ -15,10 +15,25 @@ #include "gk20a/gk20a.h" #include "gr_ctx_gp106.h" +#include "nvgpu_gpuid_t18x.h" -static int gr_gp106_get_netlist_name(int index, char *name) +static int gr_gp106_get_netlist_name(struct gk20a *g, int index, char *name) { - sprintf(name, GP106_NETLIST_IMAGE_FW_NAME); + u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; + + switch (ver) { + case NVGPU_GPUID_GP104: + sprintf(name, "%s/%s", "gp104", + GP104_NETLIST_IMAGE_FW_NAME); + break; + case NVGPU_GPUID_GP106: + sprintf(name, "%s/%s", "gp106", + GP106_NETLIST_IMAGE_FW_NAME); + break; + default: + gk20a_err(g->dev, "no support for GPUID %x", ver); + } + return 0; } diff --git a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h index d14a9126..fef80abb 100644 --- a/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h +++ b/drivers/gpu/nvgpu/gp106/gr_ctx_gp106.h @@ -20,6 +20,7 @@ /* production netlist, one and only one from below */ #define GP106_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_C +#define GP104_NETLIST_IMAGE_FW_NAME GK20A_NETLIST_IMAGE_D void gp106_init_gr_ctx(struct gpu_ops *gops); diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index f9cd2e07..a47fa0fd 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -180,7 +180,6 @@ int gp106_init_hal(struct gk20a *g) { struct gpu_ops *gops = &g->ops; struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; - u32 ver = g->gpu_characteristics.arch + g->gpu_characteristics.impl; gk20a_dbg_fn(""); @@ -203,17 +202,7 @@ int gp106_init_hal(struct gk20a *g) gp10b_init_cde_ops(gops); gp10b_init_therm_ops(gops); gm206_init_bios(gops); - switch(ver){ - case NVGPU_GPUID_GP106: - gops->name = "gp106"; - break; - case NVGPU_GPUID_GP104: - gops->name = "gp104"; - break; - default: - gk20a_err(g->dev, "no support for %x", ver); - BUG(); - } + gops->name = "gp10x"; gops->get_litter_value = gp106_get_litter_value; gops->chip_init_gpu_characteristics = gk20a_init_gpu_characteristics; gops->gr_ctx.use_dma_for_fw_bootstrap = true; diff --git a/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c b/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c index b2956257..2bb4a313 100644 --- a/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/gr_ctx_gp10b.c @@ -22,7 +22,7 @@ #include "gk20a/gk20a.h" #include "gr_ctx_gp10b.h" -static int gr_gp10b_get_netlist_name(int index, char *name) +static int gr_gp10b_get_netlist_name(struct gk20a *g, int index, char *name) { switch (index) { #ifdef GP10B_NETLIST_IMAGE_FW_NAME -- cgit v1.2.2