From 0bdffbed34df2e35f1df305173cd19eeb5582305 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Wed, 10 Jul 2019 15:22:21 +0530 Subject: gpu: nvgpu: set CE prod values Add g->ops.ce.init_prod_values() hal for gv11b to initialize PROD values of CE unit Bug 2526212 Chery-pick/manual port from dev-main Change-Id: I8e516b292622e09c537feb7830392648116baa7c Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/2150874 (cherry picked from commit 0e6a305c6af3ea6d9a0cad7b4071f68028a1aebe) Reviewed-on: https://git-master.nvidia.com/r/2224709 Reviewed-by: Seshendra Gadagottu GVS: Gerrit_Virtual_Submit Tested-by: Peter Daifuku Reviewed-by: Luis Dib Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/ce2_gk20a.c | 7 ++++++- drivers/gpu/nvgpu/gv11b/ce_gv11b.c | 16 +++++++++++++++- drivers/gpu/nvgpu/gv11b/ce_gv11b.h | 3 ++- drivers/gpu/nvgpu/gv11b/hal_gv11b.c | 1 + drivers/gpu/nvgpu/include/nvgpu/gk20a.h | 1 + drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_ce_gv11b.h | 10 +++++++++- 6 files changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c index 9dcba25a..2a40b089 100644 --- a/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ce2_gk20a.c @@ -1,7 +1,7 @@ /* * GK20A Graphics Copy Engine (gr host) * - * Copyright (c) 2011-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -366,6 +366,11 @@ int gk20a_init_ce_support(struct gk20a *g) ce_app->app_state = NVGPU_CE_ACTIVE; nvgpu_mutex_release(&ce_app->app_mutex); + + if (g->ops.ce2.init_prod_values != NULL) { + g->ops.ce2.init_prod_values(g); + } + nvgpu_log(g, gpu_dbg_cde_ctx, "ce: init finished"); return 0; diff --git a/drivers/gpu/nvgpu/gv11b/ce_gv11b.c b/drivers/gpu/nvgpu/gv11b/ce_gv11b.c index 2eea11df..035f2ef9 100644 --- a/drivers/gpu/nvgpu/gv11b/ce_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/ce_gv11b.c @@ -1,7 +1,7 @@ /* * Volta GPU series Copy Engine. * - * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -108,3 +108,17 @@ void gv11b_ce_mthd_buffer_fault_in_bar2_fault(struct gk20a *g) } } } + +void gv11b_ce_init_prod_values(struct gk20a *g) +{ + u32 reg_val; + u32 num_lce, lce; + + num_lce = gv11b_ce_get_num_lce(g); + + for (lce = 0U; lce < num_lce; lce++) { + reg_val = nvgpu_readl(g, ce_lce_opt_r(lce)); + reg_val |= ce_lce_opt_force_barriers_npl__prod_f(); + nvgpu_writel(g, ce_lce_opt_r(lce), reg_val); + } +} diff --git a/drivers/gpu/nvgpu/gv11b/ce_gv11b.h b/drivers/gpu/nvgpu/gv11b/ce_gv11b.h index 43a891e6..985117f4 100644 --- a/drivers/gpu/nvgpu/gv11b/ce_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/ce_gv11b.h @@ -2,7 +2,7 @@ * * Volta GPU series copy engine * - * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -31,5 +31,6 @@ void gv11b_ce_mthd_buffer_fault_in_bar2_fault(struct gk20a *g); u32 gv11b_ce_get_num_lce(struct gk20a *g); u32 gv11b_ce_get_num_pce(struct gk20a *g); void gv11b_ce_isr(struct gk20a *g, u32 inst_id, u32 pri_base); +void gv11b_ce_init_prod_values(struct gk20a *g); #endif /* NVGPU_CE_GV11B_H */ diff --git a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c index 38f21bff..4f298133 100644 --- a/drivers/gpu/nvgpu/gv11b/hal_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/hal_gv11b.c @@ -278,6 +278,7 @@ static const struct gpu_ops gv11b_ops = { .isr_stall = gv11b_ce_isr, .isr_nonstall = gp10b_ce_nonstall_isr, .get_num_pce = gv11b_ce_get_num_pce, + .init_prod_values = gv11b_ce_init_prod_values, }, .gr = { .get_patch_slots = gr_gv100_get_patch_slots, diff --git a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h index af8a868e..238329be 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/gk20a.h +++ b/drivers/gpu/nvgpu/include/nvgpu/gk20a.h @@ -225,6 +225,7 @@ struct gpu_ops { void (*isr_stall)(struct gk20a *g, u32 inst_id, u32 pri_base); u32 (*isr_nonstall)(struct gk20a *g, u32 inst_id, u32 pri_base); u32 (*get_num_pce)(struct gk20a *g); + void (*init_prod_values)(struct gk20a *g); } ce2; struct { u32 (*get_patch_slots)(struct gk20a *g); diff --git a/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_ce_gv11b.h b/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_ce_gv11b.h index efc14d00..57a76e68 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_ce_gv11b.h +++ b/drivers/gpu/nvgpu/include/nvgpu/hw/gv11b/hw_ce_gv11b.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -104,4 +104,12 @@ static inline u32 ce_pce_map_r(void) { return 0x00104028U; } +static inline u32 ce_lce_opt_r(u32 i) +{ + return 0x00104414U + i*128U; +} +static inline u32 ce_lce_opt_force_barriers_npl__prod_f(void) +{ + return 0x8U; +} #endif -- cgit v1.2.2