gpu: nvgpu: move gr.init_preemption_state HAL to hal.gr.init unit

Move GR HAL operation g->ops.gr.init_preemption_state() to hal.gr.init
unit as g->ops.gr.init.preemption_state()

Create hal.gr.init unit files for gp10b and gv11b and copy over
corresponding functions to new files

This API now takes gfxp_wfi_timeout_unit and gfxp_wfi_timeout_count as
parameter

Define gfxp_wfi_timeout_unit in struct gr_gk20a as a boolean flag named
gfxp_wfi_timeout_unit_usec
Remove GFXP_WFI_TIMEOUT_UNIT_SYSCLK/USEC macros

Jira NVGPU-2961

Change-Id: I4347b1e30c86c231e44cf274adccd8c70addcdab
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2072549
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2019-03-13 19:01:45 +05:30
committed by mobile promotions
parent 09e2e8c838
commit 15d8941341
19 changed files with 217 additions and 78 deletions

View File

@@ -1002,13 +1002,15 @@ static ssize_t gfxp_wfi_timeout_count_store(struct device *dev,
gr->gfxp_wfi_timeout_count = val;
if (g->ops.gr.init_preemption_state && g->power_on) {
if (g->ops.gr.init.preemption_state && g->power_on) {
err = gk20a_busy(g);
if (err)
return err;
err = nvgpu_pg_elpg_protected_call(g,
g->ops.gr.init_preemption_state(g));
g->ops.gr.init.preemption_state(g,
gr->gfxp_wfi_timeout_count,
gr->gfxp_wfi_timeout_unit_usec));
gk20a_idle(g);
@@ -1027,18 +1029,20 @@ static ssize_t gfxp_wfi_timeout_unit_store(struct device *dev,
if (count > 0 && buf[0] == 's')
/* sysclk */
gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_SYSCLK;
gr->gfxp_wfi_timeout_unit_usec = false;
else
/* usec */
gr->gfxp_wfi_timeout_unit = GFXP_WFI_TIMEOUT_UNIT_USEC;
gr->gfxp_wfi_timeout_unit_usec = true;
if (g->ops.gr.init_preemption_state && g->power_on) {
if (g->ops.gr.init.preemption_state && g->power_on) {
err = gk20a_busy(g);
if (err)
return err;
err = nvgpu_pg_elpg_protected_call(g,
g->ops.gr.init_preemption_state(g));
g->ops.gr.init.preemption_state(g,
gr->gfxp_wfi_timeout_count,
gr->gfxp_wfi_timeout_unit_usec));
gk20a_idle(g);
@@ -1065,7 +1069,7 @@ static ssize_t gfxp_wfi_timeout_unit_read(struct device *dev,
struct gk20a *g = get_gk20a(dev);
struct gr_gk20a *gr = &g->gr;
if (gr->gfxp_wfi_timeout_unit == GFXP_WFI_TIMEOUT_UNIT_USEC)
if (gr->gfxp_wfi_timeout_unit_usec)
return snprintf(buf, PAGE_SIZE, "usec\n");
else
return snprintf(buf, PAGE_SIZE, "sysclk\n");