diff --git a/drivers/gpu/nvgpu/common/linux/pci.c b/drivers/gpu/nvgpu/common/linux/pci.c index 6e3e02e57..92764c215 100644 --- a/drivers/gpu/nvgpu/common/linux/pci.c +++ b/drivers/gpu/nvgpu/common/linux/pci.c @@ -239,6 +239,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { .honors_aperture = true, .vbios_min_version = 0x88001e00, .hardcode_sw_threshold = false, + .run_preos = true, }, { /* DEVICE=PG503 SKU 200 ES */ /* ptimer src frequency in hz */ @@ -272,6 +273,7 @@ static struct gk20a_platform nvgpu_pci_device[] = { .honors_aperture = true, .vbios_min_version = 0x88001e00, .hardcode_sw_threshold = false, + .run_preos = true, } }; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 17ba3ee43..d1ad5992a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -187,8 +187,8 @@ int gk20a_finalize_poweron(struct gk20a *g) nvgpu_flcn_sw_init(g, FALCON_ID_PMU); nvgpu_flcn_sw_init(g, FALCON_ID_SEC2); - if (g->ops.bios_init) - err = g->ops.bios_init(g); + if (g->ops.bios.init) + err = g->ops.bios.init(g); if (err) goto done; diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 97b404742..537d03d8a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -969,7 +969,11 @@ struct gpu_ops { int (*bar1_bind)(struct gk20a *g, struct nvgpu_mem *bar1_inst); } bus; - int (*bios_init)(struct gk20a *g); + struct { + int (*init)(struct gk20a *g); + int (*preos_wait_for_halt)(struct gk20a *g); + void (*preos_reload_check)(struct gk20a *g); + } bios; #if defined(CONFIG_GK20A_CYCLE_STATS) struct { diff --git a/drivers/gpu/nvgpu/gp106/bios_gp106.c b/drivers/gpu/nvgpu/gp106/bios_gp106.c index b7e031c6d..3178ae532 100644 --- a/drivers/gpu/nvgpu/gp106/bios_gp106.c +++ b/drivers/gpu/nvgpu/gp106/bios_gp106.c @@ -135,6 +135,16 @@ out: return err; } +int gp106_bios_preos_wait_for_halt(struct gk20a *g) +{ + int err = 0; + + if (nvgpu_flcn_wait_for_halt(g->pmu.flcn, PMU_BOOT_TIMEOUT_MAX / 1000)) + err = -ETIMEDOUT; + + return err; +} + static int gp106_bios_preos(struct gk20a *g) { int err = 0; @@ -146,6 +156,9 @@ static int gp106_bios_preos(struct gk20a *g) goto out; } + if (g->ops.bios.preos_reload_check) + g->ops.bios.preos_reload_check(g); + upload_code(g, g->bios.preos.bootloader_phys_base, g->bios.preos.bootloader, g->bios.preos.bootloader_size, @@ -161,11 +174,7 @@ static int gp106_bios_preos(struct gk20a *g) nvgpu_flcn_bootstrap(g->pmu.flcn, g->bios.preos.code_entry_point); - if (nvgpu_flcn_wait_for_halt(g->pmu.flcn, - PMU_BOOT_TIMEOUT_MAX / 1000)) { - err = -ETIMEDOUT; - goto out; - } + err = g->ops.bios.preos_wait_for_halt(g); nvgpu_flcn_clear_halt_intr_status(g->pmu.flcn, gk20a_get_gr_idle_timeout(g)); diff --git a/drivers/gpu/nvgpu/gp106/bios_gp106.h b/drivers/gpu/nvgpu/gp106/bios_gp106.h index 0301177e1..a5229fff5 100644 --- a/drivers/gpu/nvgpu/gp106/bios_gp106.h +++ b/drivers/gpu/nvgpu/gp106/bios_gp106.h @@ -27,6 +27,5 @@ struct gk20a; struct gpu_ops; int gp106_bios_init(struct gk20a *g); -void gp106_init_bios_ops(struct gpu_ops *gops); - +int gp106_bios_preos_wait_for_halt(struct gk20a *g); #endif diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index 1c4237857..8523e7d17 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c @@ -216,6 +216,10 @@ static int gp106_init_gpu_characteristics(struct gk20a *g) } static const struct gpu_ops gp106_ops = { + .bios = { + .init = gp106_bios_init, + .preos_wait_for_halt = gp106_bios_preos_wait_for_halt, + }, .ltc = { .determine_L2_size_bytes = gp10b_determine_L2_size_bytes, .set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry, @@ -695,7 +699,6 @@ static const struct gpu_ops gp106_ops = { }, .get_litter_value = gp106_get_litter_value, .chip_init_gpu_characteristics = gp106_init_gpu_characteristics, - .bios_init = gp106_bios_init, }; int gp106_init_hal(struct gk20a *g) @@ -705,6 +708,7 @@ int gp106_init_hal(struct gk20a *g) gk20a_dbg_fn(""); + gops->bios = gp106_ops.bios; gops->ltc = gp106_ops.ltc; gops->ce2 = gp106_ops.ce2; gops->gr = gp106_ops.gr; @@ -747,7 +751,6 @@ int gp106_init_hal(struct gk20a *g) gops->get_litter_value = gp106_ops.get_litter_value; gops->chip_init_gpu_characteristics = gp106_ops.chip_init_gpu_characteristics; - gops->bios_init = gp106_ops.bios_init; __nvgpu_set_enabled(g, NVGPU_GR_USE_DMA_FOR_FW_BOOTSTRAP, true); __nvgpu_set_enabled(g, NVGPU_SEC_PRIVSECURITY, true);