gpu: nvgpu: remove unused code from common.nvgpu on safety build

- remove unused code from common.nvgpu unit on safety build. Also,
remove the code which uses them in other places.
- document use of compiler intrinsics as mandated in code inspection
  checklist.

Jira NVGPU-6876

Change-Id: Ifd16dd197d297f56a517ca155da4ed145015204c
Signed-off-by: Shashank Singh <shashsingh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2561584
(cherry picked from commit 900391071e9a7d0448cbc1bb6ed57677459712a4)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2561583
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Shashank Singh
2021-07-20 07:02:39 +00:00
committed by mobile promotions
parent 94255220f7
commit 19a3b86f06
28 changed files with 294 additions and 129 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -419,6 +419,7 @@ struct nvgpu_falcon *nvgpu_falcon_get_instance(struct gk20a *g, u32 flcn_id)
case FALCON_ID_GSPLITE: case FALCON_ID_GSPLITE:
flcn = &g->gsp_flcn; flcn = &g->gsp_flcn;
break; break;
#ifdef CONFIG_NVGPU_DGPU
case FALCON_ID_NVDEC: case FALCON_ID_NVDEC:
flcn = &g->nvdec_flcn; flcn = &g->nvdec_flcn;
break; break;
@@ -428,6 +429,7 @@ struct nvgpu_falcon *nvgpu_falcon_get_instance(struct gk20a *g, u32 flcn_id)
case FALCON_ID_MINION: case FALCON_ID_MINION:
flcn = &g->minion_flcn; flcn = &g->minion_flcn;
break; break;
#endif
default: default:
nvgpu_err(g, "Invalid/Unsupported falcon ID %x", flcn_id); nvgpu_err(g, "Invalid/Unsupported falcon ID %x", flcn_id);
break; break;

View File

@@ -83,7 +83,9 @@ static int channel_setup_ramfc(struct nvgpu_channel *c,
static struct nvgpu_channel *allocate_channel(struct nvgpu_fifo *f) static struct nvgpu_channel *allocate_channel(struct nvgpu_fifo *f)
{ {
struct nvgpu_channel *ch = NULL; struct nvgpu_channel *ch = NULL;
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
struct gk20a *g = f->g; struct gk20a *g = f->g;
#endif
nvgpu_mutex_acquire(&f->free_chs_mutex); nvgpu_mutex_acquire(&f->free_chs_mutex);
if (!nvgpu_list_empty(&f->free_chs)) { if (!nvgpu_list_empty(&f->free_chs)) {
@@ -102,11 +104,13 @@ NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 15_6))
} }
nvgpu_mutex_release(&f->free_chs_mutex); nvgpu_mutex_release(&f->free_chs_mutex);
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
if ((g->aggressive_sync_destroy_thresh != 0U) && if ((g->aggressive_sync_destroy_thresh != 0U) &&
(f->used_channels > (f->used_channels >
g->aggressive_sync_destroy_thresh)) { g->aggressive_sync_destroy_thresh)) {
g->aggressive_sync_destroy = true; g->aggressive_sync_destroy = true;
} }
#endif
return ch; return ch;
} }
@@ -114,7 +118,9 @@ NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 15_6))
static void free_channel(struct nvgpu_fifo *f, static void free_channel(struct nvgpu_fifo *f,
struct nvgpu_channel *ch) struct nvgpu_channel *ch)
{ {
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
struct gk20a *g = f->g; struct gk20a *g = f->g;
#endif
#ifdef CONFIG_NVGPU_TRACE #ifdef CONFIG_NVGPU_TRACE
trace_gk20a_release_used_channel(ch->chid); trace_gk20a_release_used_channel(ch->chid);
@@ -130,6 +136,7 @@ static void free_channel(struct nvgpu_fifo *f,
* On teardown it is not possible to dereference platform, but ignoring * On teardown it is not possible to dereference platform, but ignoring
* this is fine then because no new channels would be created. * this is fine then because no new channels would be created.
*/ */
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
if (!nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) { if (!nvgpu_is_enabled(g, NVGPU_DRIVER_IS_DYING)) {
if ((g->aggressive_sync_destroy_thresh != 0U) && if ((g->aggressive_sync_destroy_thresh != 0U) &&
(f->used_channels < (f->used_channels <
@@ -137,6 +144,7 @@ static void free_channel(struct nvgpu_fifo *f,
g->aggressive_sync_destroy = false; g->aggressive_sync_destroy = false;
} }
} }
#endif
} }
void nvgpu_channel_commit_va(struct nvgpu_channel *c) void nvgpu_channel_commit_va(struct nvgpu_channel *c)
@@ -1909,10 +1917,12 @@ int nvgpu_channel_suspend_all_serviceable_ch(struct gk20a *g)
if (err != 0) { if (err != 0) {
nvgpu_err(g, "failed to preempt channel/TSG"); nvgpu_err(g, "failed to preempt channel/TSG");
} }
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
/* wait for channel update notifiers */ /* wait for channel update notifiers */
if (g->os_channel.work_completion_cancel_sync != NULL) { if (g->os_channel.work_completion_cancel_sync != NULL) {
g->os_channel.work_completion_cancel_sync(ch); g->os_channel.work_completion_cancel_sync(ch);
} }
#endif
g->ops.channel.unbind(ch); g->ops.channel.unbind(ch);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -27,11 +27,13 @@
void nvgpu_channel_worker_enqueue(struct nvgpu_channel *ch); void nvgpu_channel_worker_enqueue(struct nvgpu_channel *ch);
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
static inline struct nvgpu_channel_worker * static inline struct nvgpu_channel_worker *
nvgpu_channel_worker_from_worker(struct nvgpu_worker *worker) nvgpu_channel_worker_from_worker(struct nvgpu_worker *worker)
{ {
return (struct nvgpu_channel_worker *) return (struct nvgpu_channel_worker *)
((uintptr_t)worker - offsetof(struct nvgpu_channel_worker, worker)); ((uintptr_t)worker - offsetof(struct nvgpu_channel_worker, worker));
}; };
#endif
#endif /* NVGPU_COMMON_FIFO_CHANNEL_WORKER_H */ #endif /* NVGPU_COMMON_FIFO_CHANNEL_WORKER_H */

View File

@@ -376,10 +376,12 @@ int nvgpu_prepare_poweroff(struct gk20a *g)
} }
#endif #endif
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
/* Disable GPCPLL */ /* Disable GPCPLL */
if (g->ops.clk.suspend_clk_support != NULL) { if (g->ops.clk.suspend_clk_support != NULL) {
g->ops.clk.suspend_clk_support(g); g->ops.clk.suspend_clk_support(g);
} }
#endif
#ifdef CONFIG_NVGPU_CLK_ARB #ifdef CONFIG_NVGPU_CLK_ARB
if (g->ops.clk_arb.stop_clk_arb_threads != NULL) { if (g->ops.clk_arb.stop_clk_arb_threads != NULL) {
g->ops.clk_arb.stop_clk_arb_threads(g); g->ops.clk_arb.stop_clk_arb_threads(g);
@@ -742,7 +744,9 @@ static int nvgpu_early_init(struct gk20a *g)
* SOB after graphics power saving features (blcg/slcg) are * SOB after graphics power saving features (blcg/slcg) are
* enabled. For now, do it here. * enabled. For now, do it here.
*/ */
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
NVGPU_INIT_TABLE_ENTRY(g->ops.clk.init_clk_support, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(g->ops.clk.init_clk_support, NO_FLAG),
#endif
#ifdef CONFIG_NVGPU_DGPU #ifdef CONFIG_NVGPU_DGPU
NVGPU_INIT_TABLE_ENTRY(&nvgpu_init_fbpa_ecc, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(&nvgpu_init_fbpa_ecc, NO_FLAG),
NVGPU_INIT_TABLE_ENTRY(g->ops.fb.init_fbpa, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(g->ops.fb.init_fbpa, NO_FLAG),
@@ -864,8 +868,10 @@ int nvgpu_finalize_poweron(struct gk20a *g)
NVGPU_INIT_TABLE_ENTRY(g->ops.acr.acr_init, NVGPU_INIT_TABLE_ENTRY(g->ops.acr.acr_init,
NVGPU_SEC_PRIVSECURITY), NVGPU_SEC_PRIVSECURITY),
NVGPU_INIT_TABLE_ENTRY(&nvgpu_sw_quiesce_init_support, NO_FLAG), NVGPU_INIT_TABLE_ENTRY(&nvgpu_sw_quiesce_init_support, NO_FLAG),
#ifdef CONFIG_NVGPU_NVLINK
NVGPU_INIT_TABLE_ENTRY(g->ops.nvlink.init, NVGPU_INIT_TABLE_ENTRY(g->ops.nvlink.init,
NVGPU_SUPPORT_NVLINK), NVGPU_SUPPORT_NVLINK),
#endif
#ifdef CONFIG_NVGPU_DEBUGGER #ifdef CONFIG_NVGPU_DEBUGGER
NVGPU_INIT_TABLE_ENTRY(g->ops.ptimer.config_gr_tick_freq, NVGPU_INIT_TABLE_ENTRY(g->ops.ptimer.config_gr_tick_freq,
@@ -1064,8 +1070,12 @@ int nvgpu_init_gpu_characteristics(struct gk20a *g)
* (even if kernel-mode submits aren't enabled where full deterministic * (even if kernel-mode submits aren't enabled where full deterministic
* features matter). * features matter).
*/ */
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
if (nvgpu_has_syncpoints(g) && if (nvgpu_has_syncpoints(g) &&
g->aggressive_sync_destroy_thresh == 0U) { g->aggressive_sync_destroy_thresh == 0U) {
#else
if (nvgpu_has_syncpoints(g)) {
#endif
nvgpu_set_enabled(g, nvgpu_set_enabled(g,
NVGPU_SUPPORT_DETERMINISTIC_SUBMIT_FULL, NVGPU_SUPPORT_DETERMINISTIC_SUBMIT_FULL,
true); true);
@@ -1147,9 +1157,11 @@ static void gk20a_free_cb(struct nvgpu_ref *refcount)
g->ops.ecc.ecc_remove_support(g); g->ops.ecc.ecc_remove_support(g);
} }
#ifdef CONFIG_NVGPU_NON_FUSA
if (g->remove_support != NULL) { if (g->remove_support != NULL) {
g->remove_support(g); g->remove_support(g);
} }
#endif
if (g->ops.ltc.ltc_remove_support != NULL) { if (g->ops.ltc.ltc_remove_support != NULL) {
g->ops.ltc.ltc_remove_support(g); g->ops.ltc.ltc_remove_support(g);

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2017-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -164,9 +164,11 @@ static void nvgpu_remove_mm_support(struct mm_gk20a *mm)
nvgpu_vm_put(mm->gsp.vm); nvgpu_vm_put(mm->gsp.vm);
} }
#ifdef CONFIG_NVGPU_NON_FUSA
if (g->has_cde) { if (g->has_cde) {
nvgpu_vm_put(mm->cde.vm); nvgpu_vm_put(mm->cde.vm);
} }
#endif
nvgpu_free_sysmem_flush(g); nvgpu_free_sysmem_flush(g);
@@ -250,6 +252,7 @@ static int nvgpu_init_hwpm(struct mm_gk20a *mm)
return 0; return 0;
} }
#ifdef CONFIG_NVGPU_NON_FUSA
static int nvgpu_init_cde_vm(struct mm_gk20a *mm) static int nvgpu_init_cde_vm(struct mm_gk20a *mm)
{ {
struct gk20a *g = gk20a_from_mm(mm); struct gk20a *g = gk20a_from_mm(mm);
@@ -270,6 +273,7 @@ static int nvgpu_init_cde_vm(struct mm_gk20a *mm)
} }
return 0; return 0;
} }
#endif
static int nvgpu_init_ce_vm(struct mm_gk20a *mm) static int nvgpu_init_ce_vm(struct mm_gk20a *mm)
{ {
@@ -454,12 +458,14 @@ static int nvgpu_init_mm_setup_vm(struct gk20a *g)
} }
} }
#ifdef CONFIG_NVGPU_NON_FUSA
if (g->has_cde) { if (g->has_cde) {
err = nvgpu_init_cde_vm(mm); err = nvgpu_init_cde_vm(mm);
if (err != 0) { if (err != 0) {
return err; return err;
} }
} }
#endif
err = nvgpu_init_ce_vm(mm); err = nvgpu_init_ce_vm(mm);
if (err != 0) { if (err != 0) {

View File

@@ -209,10 +209,12 @@ int nvgpu_pmu_early_init(struct gk20a *g)
g->support_ls_pmu = false; g->support_ls_pmu = false;
/* Disable LS PMU global checkers */ /* Disable LS PMU global checkers */
#ifdef CONFIG_NVGPU_NON_FUSA
g->can_elpg = false; g->can_elpg = false;
g->elpg_enabled = false; g->elpg_enabled = false;
g->aelpg_enabled = false; g->aelpg_enabled = false;
g->elpg_ms_enabled = false; g->elpg_ms_enabled = false;
#endif
nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, false); nvgpu_set_enabled(g, NVGPU_PMU_PERFMON, false);
nvgpu_set_enabled(g, NVGPU_ELPG_MS_ENABLED, false); nvgpu_set_enabled(g, NVGPU_ELPG_MS_ENABLED, false);
#ifdef CONFIG_NVGPU_DGPU #ifdef CONFIG_NVGPU_DGPU

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -165,6 +165,7 @@ u32 ga100_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_GPC_PRIV_STRIDE: case GPU_LIT_GPC_PRIV_STRIDE:
ret = proj_gpc_priv_stride_v(); ret = proj_gpc_priv_stride_v();
break; break;
#ifdef CONFIG_NVGPU_DEBUGGER
case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START: case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START:
ret = 2; ret = 2;
break; break;
@@ -186,6 +187,7 @@ u32 ga100_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT: case GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT:
ret = 2; ret = 2;
break; break;
#endif
case GPU_LIT_MAX_RUNLISTS_SUPPORTED: case GPU_LIT_MAX_RUNLISTS_SUPPORTED:
ret = 24U; ret = 24U;
break; break;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -167,6 +167,7 @@ u32 ga10b_get_litter_value(struct gk20a *g, int value)
* The perfmon start, count for various chiplets are taken * The perfmon start, count for various chiplets are taken
* from the PM programming guide. * from the PM programming guide.
*/ */
#ifdef CONFIG_NVGPU_DEBUGGER
case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START: case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START:
ret = 2; ret = 2;
break; break;
@@ -188,6 +189,7 @@ u32 ga10b_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_COUNT: case GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_COUNT:
ret = 2; ret = 2;
break; break;
#endif
case GPU_LIT_ROP_IN_GPC_BASE: case GPU_LIT_ROP_IN_GPC_BASE:
ret = proj_rop_in_gpc_base_v(); ret = proj_rop_in_gpc_base_v();
break; break;

View File

@@ -980,8 +980,8 @@ static const struct gops_runlist gv11b_ops_runlist = {
.get_max_channels_per_tsg = gv11b_runlist_get_max_channels_per_tsg, .get_max_channels_per_tsg = gv11b_runlist_get_max_channels_per_tsg,
}; };
static const struct gops_userd gv11b_ops_userd = {
#ifdef CONFIG_NVGPU_USERD #ifdef CONFIG_NVGPU_USERD
static const struct gops_userd gv11b_ops_userd = {
.setup_sw = nvgpu_userd_setup_sw, .setup_sw = nvgpu_userd_setup_sw,
.cleanup_sw = nvgpu_userd_cleanup_sw, .cleanup_sw = nvgpu_userd_cleanup_sw,
.init_mem = gk20a_userd_init_mem, .init_mem = gk20a_userd_init_mem,
@@ -990,9 +990,9 @@ static const struct gops_userd gv11b_ops_userd = {
.gp_put = gv11b_userd_gp_put, .gp_put = gv11b_userd_gp_put,
.pb_get = gv11b_userd_pb_get, .pb_get = gv11b_userd_pb_get,
#endif #endif
#endif /* CONFIG_NVGPU_USERD */
.entry_size = gk20a_userd_entry_size, .entry_size = gk20a_userd_entry_size,
}; };
#endif /* CONFIG_NVGPU_USERD */
static const struct gops_channel gv11b_ops_channel = { static const struct gops_channel gv11b_ops_channel = {
.alloc_inst = nvgpu_channel_alloc_inst, .alloc_inst = nvgpu_channel_alloc_inst,
@@ -1263,9 +1263,11 @@ static const struct gops_mc gv11b_ops_mc = {
.is_mmu_fault_pending = gv11b_mc_is_mmu_fault_pending, .is_mmu_fault_pending = gv11b_mc_is_mmu_fault_pending,
}; };
#ifdef CONFIG_NVGPU_DEBUGGER
static const struct gops_debug gv11b_ops_debug = { static const struct gops_debug gv11b_ops_debug = {
.show_dump = gk20a_debug_show_dump, .show_dump = gk20a_debug_show_dump,
}; };
#endif
#ifdef CONFIG_NVGPU_DEBUGGER #ifdef CONFIG_NVGPU_DEBUGGER
static const struct gops_debugger gv11b_ops_debugger = { static const struct gops_debugger gv11b_ops_debugger = {
@@ -1524,7 +1526,9 @@ int gv11b_init_hal(struct gk20a *g)
gops->ramfc = gv11b_ops_ramfc; gops->ramfc = gv11b_ops_ramfc;
gops->ramin = gv11b_ops_ramin; gops->ramin = gv11b_ops_ramin;
gops->runlist = gv11b_ops_runlist; gops->runlist = gv11b_ops_runlist;
#ifdef CONFIG_NVGPU_USERD
gops->userd = gv11b_ops_userd; gops->userd = gv11b_ops_userd;
#endif
gops->channel = gv11b_ops_channel; gops->channel = gv11b_ops_channel;
gops->tsg = gv11b_ops_tsg; gops->tsg = gv11b_ops_tsg;
gops->usermode = gv11b_ops_usermode; gops->usermode = gv11b_ops_usermode;
@@ -1542,8 +1546,8 @@ int gv11b_init_hal(struct gk20a *g)
gops->regops = gv11b_ops_regops; gops->regops = gv11b_ops_regops;
#endif #endif
gops->mc = gv11b_ops_mc; gops->mc = gv11b_ops_mc;
gops->debug = gv11b_ops_debug;
#ifdef CONFIG_NVGPU_DEBUGGER #ifdef CONFIG_NVGPU_DEBUGGER
gops->debug = gv11b_ops_debug;
gops->debugger = gv11b_ops_debugger; gops->debugger = gv11b_ops_debugger;
gops->perf = gv11b_ops_perf; gops->perf = gv11b_ops_perf;
gops->perfbuf = gv11b_ops_perfbuf; gops->perfbuf = gv11b_ops_perfbuf;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -167,6 +167,7 @@ u32 gv11b_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_GPC_PRIV_STRIDE: case GPU_LIT_GPC_PRIV_STRIDE:
ret = proj_gpc_priv_stride_v(); ret = proj_gpc_priv_stride_v();
break; break;
#ifdef CONFIG_NVGPU_DEBUGGER
case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START: case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START:
ret = 2; ret = 2;
break; break;
@@ -188,6 +189,7 @@ u32 gv11b_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT: case GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT:
ret = 2; ret = 2;
break; break;
#endif
default: default:
nvgpu_err(g, "Missing definition %d", value); nvgpu_err(g, "Missing definition %d", value);
BUG(); BUG();

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -170,6 +170,7 @@ u32 tu104_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_GPC_PRIV_STRIDE: case GPU_LIT_GPC_PRIV_STRIDE:
ret = proj_gpc_priv_stride_v(); ret = proj_gpc_priv_stride_v();
break; break;
#ifdef CONFIG_NVGPU_DEBUGGER
case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START: case GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START:
ret = 2; ret = 2;
break; break;
@@ -191,6 +192,7 @@ u32 tu104_get_litter_value(struct gk20a *g, int value)
case GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT: case GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT:
ret = 2; ret = 2;
break; break;
#endif
default: default:
nvgpu_err(g, "Missing definition %d", value); nvgpu_err(g, "Missing definition %d", value);
BUG(); BUG();

View File

@@ -1,7 +1,7 @@
/* /*
* GM20B Master Control * GM20B Master Control
* *
* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2014-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -144,9 +144,11 @@ static u32 gm20b_mc_unit_reset_mask(struct gk20a *g, u32 unit)
mask = mc_enable_pwr_enabled_f(); mask = mc_enable_pwr_enabled_f();
break; break;
#endif #endif
#ifdef CONFIG_NVGPU_NVLINK
case NVGPU_UNIT_NVLINK: case NVGPU_UNIT_NVLINK:
mask = BIT32(g->nvlink.ioctrl_table[0].reset_enum); mask = BIT32(g->nvlink.ioctrl_table[0].reset_enum);
break; break;
#endif
case NVGPU_UNIT_CE2: case NVGPU_UNIT_CE2:
mask = mc_enable_ce2_enabled_f(); mask = mc_enable_ce2_enabled_f();
break; break;

View File

@@ -74,39 +74,51 @@ struct nvgpu_fifo;
struct nvgpu_channel; struct nvgpu_channel;
struct nvgpu_gr; struct nvgpu_gr;
struct nvgpu_fbp; struct nvgpu_fbp;
#ifdef CONFIG_NVGPU_SIM
struct sim_nvgpu; struct sim_nvgpu;
#endif
#ifdef CONFIG_NVGPU_DGPU
struct nvgpu_ce_app; struct nvgpu_ce_app;
#endif
#ifdef CONFIG_NVGPU_FECS_TRACE
struct gk20a_ctxsw_trace; struct gk20a_ctxsw_trace;
#endif
#ifdef CONFIG_NVGPU_TRACK_MEM_USAGE
struct nvgpu_mem_alloc_tracker; struct nvgpu_mem_alloc_tracker;
#endif
struct nvgpu_profiler_object; struct nvgpu_profiler_object;
#ifdef CONFIG_NVGPU_DEBUGGER
struct dbg_profiler_object_data;
struct nvgpu_debug_context; struct nvgpu_debug_context;
#endif
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
struct nvgpu_clk_pll_debug_data; struct nvgpu_clk_pll_debug_data;
#endif
struct nvgpu_nvhost_dev; struct nvgpu_nvhost_dev;
struct nvgpu_netlist_vars; struct nvgpu_netlist_vars;
struct netlist_av64_list;
#ifdef CONFIG_NVGPU_FECS_TRACE #ifdef CONFIG_NVGPU_FECS_TRACE
struct nvgpu_gr_fecs_trace; struct nvgpu_gr_fecs_trace;
#endif #endif
struct nvgpu_cpu_time_correlation_sample;
#ifdef CONFIG_NVGPU_CLK_ARB #ifdef CONFIG_NVGPU_CLK_ARB
struct nvgpu_clk_arb; struct nvgpu_clk_arb;
#endif #endif
struct nvgpu_setup_bind_args; struct nvgpu_setup_bind_args;
struct boardobjgrp;
struct boardobjgrp_pmu_cmd;
struct boardobjgrpmask;
struct nvgpu_sgt;
struct nvgpu_channel_hw_state;
struct nvgpu_mem; struct nvgpu_mem;
#ifdef CONFIG_NVGPU_CYCLESTATS
struct gk20a_cs_snapshot_client; struct gk20a_cs_snapshot_client;
struct gk20a_cs_snapshot;
#endif
#ifdef CONFIG_NVGPU_DEBUGGER
struct dbg_session_gk20a; struct dbg_session_gk20a;
struct nvgpu_dbg_reg_op; struct nvgpu_dbg_reg_op;
struct gk20a_cs_snapshot; #endif
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
struct _resmgr_context; struct _resmgr_context;
struct nvgpu_gpfifo_entry; struct nvgpu_gpfifo_entry;
struct vm_gk20a_mapping_batch; #endif
struct pmu_pg_stats_data; #ifdef CONFIG_NVGPU_HAL_NON_FUSA
struct clk_domains_mon_status_params; struct clk_domains_mon_status_params;
#endif
struct nvgpu_cic_mon; struct nvgpu_cic_mon;
struct nvgpu_cic_rm; struct nvgpu_cic_rm;
#ifdef CONFIG_NVGPU_GSP_SCHEDULER #ifdef CONFIG_NVGPU_GSP_SCHEDULER
@@ -116,9 +128,9 @@ struct nvgpu_gsp_sched;
struct nvgpu_gsp_test; struct nvgpu_gsp_test;
#endif #endif
enum nvgpu_flush_op; #ifdef CONFIG_NVGPU_DGPU
enum gk20a_mem_rw_flag;
enum nvgpu_nvlink_minion_dlcmd; enum nvgpu_nvlink_minion_dlcmd;
#endif
enum nvgpu_profiler_pm_resource_type; enum nvgpu_profiler_pm_resource_type;
enum nvgpu_profiler_pm_reservation_scope; enum nvgpu_profiler_pm_reservation_scope;
@@ -134,8 +146,10 @@ enum nvgpu_profiler_pm_reservation_scope;
#include <nvgpu/atomic.h> #include <nvgpu/atomic.h>
#include <nvgpu/barrier.h> #include <nvgpu/barrier.h>
#include <nvgpu/rwsem.h> #include <nvgpu/rwsem.h>
#ifdef CONFIG_NVGPU_DGPU
#include <nvgpu/nvlink.h> #include <nvgpu/nvlink.h>
#include <nvgpu/nvlink_link_mode_transitions.h> #include <nvgpu/nvlink_link_mode_transitions.h>
#endif
#include <nvgpu/ecc.h> #include <nvgpu/ecc.h>
#include <nvgpu/channel.h> #include <nvgpu/channel.h>
#include <nvgpu/tsg.h> #include <nvgpu/tsg.h>
@@ -260,7 +274,7 @@ struct railgate_stats {
#define GPU_LIT_DMA_COPY_CLASS 36 #define GPU_LIT_DMA_COPY_CLASS 36
/** Gpc priv stride. */ /** Gpc priv stride. */
#define GPU_LIT_GPC_PRIV_STRIDE 37 #define GPU_LIT_GPC_PRIV_STRIDE 37
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_DEBUGGER
#define GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START 38 #define GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START 38
#define GPU_LIT_PERFMON_PMMGPCTPCB_DOMAIN_START 39 #define GPU_LIT_PERFMON_PMMGPCTPCB_DOMAIN_START 39
#define GPU_LIT_PERFMON_PMMGPCTPC_DOMAIN_COUNT 40 #define GPU_LIT_PERFMON_PMMGPCTPC_DOMAIN_COUNT 40
@@ -268,6 +282,7 @@ struct railgate_stats {
#define GPU_LIT_PERFMON_PMMFBP_LTC_DOMAIN_COUNT 42 #define GPU_LIT_PERFMON_PMMFBP_LTC_DOMAIN_COUNT 42
#define GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_START 43 #define GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_START 43
#define GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT 44 #define GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT 44
#endif
#define GPU_LIT_SM_UNIQUE_BASE 45 #define GPU_LIT_SM_UNIQUE_BASE 45
#define GPU_LIT_SM_SHARED_BASE 46 #define GPU_LIT_SM_SHARED_BASE 46
#define GPU_LIT_GPC_ADDR_WIDTH 47 #define GPU_LIT_GPC_ADDR_WIDTH 47
@@ -282,8 +297,6 @@ struct railgate_stats {
#define GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_START 56 #define GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_START 56
#define GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_COUNT 57 #define GPU_LIT_PERFMON_PMMGPC_ROP_DOMAIN_COUNT 57
/** @endcond */
/** Macro to get litter values corresponding to the litter defines. */ /** Macro to get litter values corresponding to the litter defines. */
#define nvgpu_get_litter_value(g, v) ((g)->ops.get_litter_value((g), v)) #define nvgpu_get_litter_value(g, v) ((g)->ops.get_litter_value((g), v))
@@ -309,11 +322,14 @@ struct railgate_stats {
#endif #endif
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
struct nvgpu_gpfifo_userdata { struct nvgpu_gpfifo_userdata {
struct nvgpu_gpfifo_entry nvgpu_user *entries; struct nvgpu_gpfifo_entry nvgpu_user *entries;
struct _resmgr_context *context; struct _resmgr_context *context;
}; };
#endif
#ifdef CONFIG_NVGPU_CHANNEL_TSG_CONTROL
enum nvgpu_event_id_type { enum nvgpu_event_id_type {
NVGPU_EVENT_ID_BPT_INT = 0, NVGPU_EVENT_ID_BPT_INT = 0,
NVGPU_EVENT_ID_BPT_PAUSE = 1, NVGPU_EVENT_ID_BPT_PAUSE = 1,
@@ -323,7 +339,7 @@ enum nvgpu_event_id_type {
NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN = 5, NVGPU_EVENT_ID_GR_SEMAPHORE_WRITE_AWAKEN = 5,
NVGPU_EVENT_ID_MAX = 6, NVGPU_EVENT_ID_MAX = 6,
}; };
/** @endcond */ #endif
/** /**
* @brief HW version info read from the HW. * @brief HW version info read from the HW.
@@ -397,10 +413,10 @@ struct gk20a {
*/ */
unsigned long *enabled_flags; unsigned long *enabled_flags;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
/** Used by Linux module to keep track of driver usage */ /** Used by Linux module to keep track of driver usage */
nvgpu_atomic_t usage_count; nvgpu_atomic_t usage_count;
/** @endcond */ #endif
/** Used by common.init unit to track users of the driver */ /** Used by common.init unit to track users of the driver */
struct nvgpu_ref refcount; struct nvgpu_ref refcount;
@@ -420,9 +436,9 @@ struct gk20a {
#ifdef CONFIG_PM #ifdef CONFIG_PM
bool suspended; bool suspended;
#endif #endif
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
bool sw_ready; bool sw_ready;
/** @endcond */ #endif
/** Flag to indicate that quiesce framework is initialized. */ /** Flag to indicate that quiesce framework is initialized. */
bool sw_quiesce_init_done; bool sw_quiesce_init_done;
@@ -443,11 +459,13 @@ struct gk20a {
/** Controls which messages are logged */ /** Controls which messages are logged */
u64 log_mask; u64 log_mask;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
u32 log_trace; u32 log_trace;
#endif
#ifdef CONFIG_NVGPU_STATIC_POWERGATE
struct nvgpu_mutex static_pg_lock; struct nvgpu_mutex static_pg_lock;
/** @endcond */ #endif
/** Stored HW version info */ /** Stored HW version info */
struct nvgpu_gpu_params params; struct nvgpu_gpu_params params;
@@ -471,17 +489,17 @@ struct gk20a {
struct nvgpu_falcon fecs_flcn; struct nvgpu_falcon fecs_flcn;
/** Struct holding the gpccs falcon software state. */ /** Struct holding the gpccs falcon software state. */
struct nvgpu_falcon gpccs_flcn; struct nvgpu_falcon gpccs_flcn;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_DGPU
struct nvgpu_falcon nvdec_flcn; struct nvgpu_falcon nvdec_flcn;
struct nvgpu_falcon minion_flcn; struct nvgpu_falcon minion_flcn;
struct nvgpu_falcon gsp_flcn;
struct clk_gk20a clk; struct clk_gk20a clk;
/** @endcond */ #endif
struct nvgpu_falcon gsp_flcn;
/** Top level struct maintaining fifo unit's software state. */ /** Top level struct maintaining fifo unit's software state. */
struct nvgpu_fifo fifo; struct nvgpu_fifo fifo;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_DGPU
struct nvgpu_nvlink_dev nvlink; struct nvgpu_nvlink_dev nvlink;
/** @endcond */ #endif
/** Pointer to struct maintaining multiple GR instance's software state. */ /** Pointer to struct maintaining multiple GR instance's software state. */
struct nvgpu_gr *gr; struct nvgpu_gr *gr;
u32 num_gr_instances; u32 num_gr_instances;
@@ -506,10 +524,10 @@ struct gk20a {
#endif #endif
/** Top level struct maintaining ECC unit's software state. */ /** Top level struct maintaining ECC unit's software state. */
struct nvgpu_ecc ecc; struct nvgpu_ecc ecc;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_DGPU
struct pmgr_pmupstate *pmgr_pmu; struct pmgr_pmupstate *pmgr_pmu;
struct nvgpu_sec2 sec2; struct nvgpu_sec2 sec2;
/** @endcond */ #endif
#ifdef CONFIG_NVGPU_CHANNEL_TSG_SCHEDULING #ifdef CONFIG_NVGPU_CHANNEL_TSG_SCHEDULING
struct nvgpu_sched_ctrl sched_ctrl; struct nvgpu_sched_ctrl sched_ctrl;
#endif #endif
@@ -522,33 +540,37 @@ struct gk20a {
/** User disabled timeouts */ /** User disabled timeouts */
bool timeouts_disabled_by_user; bool timeouts_disabled_by_user;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_CHANNEL_WDT
unsigned int ch_wdt_init_limit_ms; unsigned int ch_wdt_init_limit_ms;
/** @endcond */ u32 ctxsw_wdt_period_us;
#endif
/** /**
* Timeout after which ctxsw timeout interrupt (if enabled by s/w) will * Timeout after which ctxsw timeout interrupt (if enabled by s/w) will
* be triggered by h/w if context fails to context switch. * be triggered by h/w if context fails to context switch.
*/ */
u32 ctxsw_timeout_period_ms; u32 ctxsw_timeout_period_ms;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */
u32 ctxsw_wdt_period_us;
#ifdef CONFIG_NVGPU_NON_FUSA
struct nvgpu_mutex power_lock; struct nvgpu_mutex power_lock;
/** @endcond */ #endif
/** Lock to protect accessing \a power_on_state. */ /** Lock to protect accessing \a power_on_state. */
struct nvgpu_spinlock power_spinlock; struct nvgpu_spinlock power_spinlock;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_CHANNEL_TSG_SCHEDULING
/** Channel priorities */ /** Channel priorities */
u32 tsg_timeslice_low_priority_us; u32 tsg_timeslice_low_priority_us;
u32 tsg_timeslice_medium_priority_us; u32 tsg_timeslice_medium_priority_us;
u32 tsg_timeslice_high_priority_us; u32 tsg_timeslice_high_priority_us;
u32 tsg_timeslice_min_us; u32 tsg_timeslice_min_us;
u32 tsg_timeslice_max_us; u32 tsg_timeslice_max_us;
#endif
u32 tsg_dbg_timeslice_max_us; u32 tsg_dbg_timeslice_max_us;
/**
* Flag to indicate if runlist interleaving is supported or not. Set to
* true for safety.
*/
bool runlist_interleave; bool runlist_interleave;
/** @endcond */
/** Lock serializing CG an PG programming for various units */ /** Lock serializing CG an PG programming for various units */
struct nvgpu_mutex cg_pg_lock; struct nvgpu_mutex cg_pg_lock;
@@ -558,25 +580,31 @@ struct gk20a {
bool blcg_enabled; bool blcg_enabled;
/** ELCG setting read from the platform data */ /** ELCG setting read from the platform data */
bool elcg_enabled; bool elcg_enabled;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_LS_PMU
bool elpg_enabled; bool elpg_enabled;
bool elpg_ms_enabled; bool elpg_ms_enabled;
bool aelpg_enabled; bool aelpg_enabled;
bool can_elpg; bool can_elpg;
#endif
#ifdef CONFIG_NVGPU_NON_FUSA
bool mscg_enabled; bool mscg_enabled;
bool forced_idle; bool forced_idle;
bool forced_reset;
#endif
/** Allow priv register access to all. */
bool allow_all; bool allow_all;
/** @endcond */
/** Ptimer source frequency. */ /** Ptimer source frequency. */
u32 ptimer_src_freq; u32 ptimer_src_freq;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
int railgate_delay; int railgate_delay;
u8 ldiv_slowdown_factor; u8 ldiv_slowdown_factor;
#endif
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
unsigned int aggressive_sync_destroy_thresh; unsigned int aggressive_sync_destroy_thresh;
bool aggressive_sync_destroy; bool aggressive_sync_destroy;
/** @endcond */ #endif
/** Is LS PMU supported? */ /** Is LS PMU supported? */
bool support_ls_pmu; bool support_ls_pmu;
@@ -584,11 +612,12 @@ struct gk20a {
/** Is this a virtual GPU? */ /** Is this a virtual GPU? */
bool is_virtual; bool is_virtual;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
/* Whether cde engine is supported or not. */
bool has_cde; bool has_cde;
u32 emc3d_ratio; u32 emc3d_ratio;
/** @endcond */ #endif
/** /**
* A group of semaphore pools. One for each channel. * A group of semaphore pools. One for each channel.
@@ -637,53 +666,49 @@ struct gk20a {
struct gk20a_cs_snapshot *cs_data; struct gk20a_cs_snapshot *cs_data;
#endif #endif
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
/* Called after all references to driver are gone. Unused in safety */ /* Called after all references to driver are gone. Unused in safety */
void (*remove_support)(struct gk20a *g); void (*remove_support)(struct gk20a *g);
#endif
#ifdef CONFIG_NVGPU_POWER_PG
u64 pg_ingating_time_us; u64 pg_ingating_time_us;
u64 pg_ungating_time_us; u64 pg_ungating_time_us;
u32 pg_gating_cnt; u32 pg_gating_cnt;
u32 pg_ms_gating_cnt; u32 pg_ms_gating_cnt;
/** @endcond */ #endif
/** GPU address-space identifier. */ /** GPU address-space identifier. */
struct gk20a_as as; struct gk20a_as as;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */
struct nvgpu_mutex client_lock;
int client_refcount; /* open channels and ctrl nodes */
/** @endcond */
/** The HAL function pointers */ /** The HAL function pointers */
struct gpu_ops ops; struct gpu_ops ops;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_LS_PMU
/*used for change of enum zbc update cmd id from ver 0 to ver1*/ /*used for change of enum zbc update cmd id from ver 0 to ver1*/
u8 pmu_ver_cmd_id_zbc_table_update; u8 pmu_ver_cmd_id_zbc_table_update;
/** @endcond */ #endif
/** Top level struct managing interrupt handling. */ /** Top level struct managing interrupt handling. */
struct nvgpu_mc mc; struct nvgpu_mc mc;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_COMPRESSION
/* /*
* The deductible memory size for max_comptag_mem (in MBytes) * The deductible memory size for max_comptag_mem (in MBytes)
* Usually close to memory size that running system is taking * Usually close to memory size that running system is taking
*/ */
u32 comptag_mem_deduct; u32 comptag_mem_deduct;
#ifdef CONFIG_NVGPU_COMPRESSION
u32 max_comptag_mem; /* max memory size (MB) for comptag */ u32 max_comptag_mem; /* max memory size (MB) for comptag */
struct nvgpu_cbc *cbc;
#endif #endif
#ifdef CONFIG_NVGPU_NON_FUSA
u32 ltc_streamid; u32 ltc_streamid;
#endif
struct nvgpu_cbc *cbc; /** ltc unit's meta data handle. */
struct nvgpu_ltc *ltc; struct nvgpu_ltc *ltc;
/** @endcond */
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
struct nvgpu_channel_worker { struct nvgpu_channel_worker {
struct nvgpu_worker worker; struct nvgpu_worker worker;
@@ -692,19 +717,21 @@ struct gk20a {
struct nvgpu_timeout timeout; struct nvgpu_timeout timeout;
#endif #endif
} channel_worker; } channel_worker;
#endif
#ifdef CONFIG_NVGPU_CLK_ARB
struct nvgpu_clk_arb_worker { struct nvgpu_clk_arb_worker {
struct nvgpu_worker worker; struct nvgpu_worker worker;
} clk_arb_worker; } clk_arb_worker;
/** @endcond */ #endif
struct { struct {
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
void (*open)(struct nvgpu_channel *ch); void (*open)(struct nvgpu_channel *ch);
/** @endcond */ #endif
/** Os specific callback called at channel closure. */ /** Os specific callback called at channel closure. */
void (*close)(struct nvgpu_channel *ch, bool force); void (*close)(struct nvgpu_channel *ch, bool force);
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
void (*work_completion_signal)(struct nvgpu_channel *ch); void (*work_completion_signal)(struct nvgpu_channel *ch);
void (*work_completion_cancel_sync)(struct nvgpu_channel *ch); void (*work_completion_cancel_sync)(struct nvgpu_channel *ch);
bool (*os_fence_framework_inst_exists)(struct nvgpu_channel *ch); bool (*os_fence_framework_inst_exists)(struct nvgpu_channel *ch);
@@ -716,7 +743,7 @@ struct gk20a {
int (*copy_user_gpfifo)(struct nvgpu_gpfifo_entry *dest, int (*copy_user_gpfifo)(struct nvgpu_gpfifo_entry *dest,
struct nvgpu_gpfifo_userdata userdata, struct nvgpu_gpfifo_userdata userdata,
u32 start, u32 length); u32 start, u32 length);
/** @endcond */ #endif
/** Os specific callback to allocate usermode buffers. */ /** Os specific callback to allocate usermode buffers. */
int (*alloc_usermode_buffers)(struct nvgpu_channel *c, int (*alloc_usermode_buffers)(struct nvgpu_channel *c,
struct nvgpu_setup_bind_args *args); struct nvgpu_setup_bind_args *args);
@@ -724,13 +751,11 @@ struct gk20a {
void (*free_usermode_buffers)(struct nvgpu_channel *c); void (*free_usermode_buffers)(struct nvgpu_channel *c);
} os_channel; } os_channel;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_NON_FUSA
/* Used by Linux OS Layer */ /* Used by Linux OS Layer */
struct gk20a_scale_profile *scale_profile; struct gk20a_scale_profile *scale_profile;
unsigned long last_freq; unsigned long last_freq;
/** @endcond */
#ifdef CONFIG_NVGPU_NON_FUSA
u32 tpc_fs_mask_user; u32 tpc_fs_mask_user;
u32 fecs_feature_override_ecc_val; u32 fecs_feature_override_ecc_val;
@@ -758,39 +783,39 @@ struct gk20a {
u32 valid_tpc_pg_mask[MAX_PG_TPC_CONFIGS]; u32 valid_tpc_pg_mask[MAX_PG_TPC_CONFIGS];
u32 valid_gpc_fbp_pg_mask[MAX_PG_GPC_FBP_CONFIGS]; u32 valid_gpc_fbp_pg_mask[MAX_PG_GPC_FBP_CONFIGS];
#endif #endif
#ifdef CONFIG_NVGPU_DGPU
struct nvgpu_bios *bios; struct nvgpu_bios *bios;
bool bios_is_init; bool bios_is_init;
#endif
#ifdef CONFIG_NVGPU_CLK_ARB
struct nvgpu_clk_arb *clk_arb; struct nvgpu_clk_arb *clk_arb;
struct nvgpu_mutex clk_arb_enable_lock; struct nvgpu_mutex clk_arb_enable_lock;
nvgpu_atomic_t clk_arb_global_nr; nvgpu_atomic_t clk_arb_global_nr;
#endif
#ifdef CONFIG_NVGPU_DGPU
struct nvgpu_ce_app *ce_app; struct nvgpu_ce_app *ce_app;
#endif
#ifdef CONFIG_NVGPU_NON_FUSA #ifdef CONFIG_NVGPU_NON_FUSA
/** Flag to control enabling/disabling of illegal compstat intr. */ /** Flag to control enabling/disabling of illegal compstat intr. */
bool ltc_intr_en_illegal_compstat; bool ltc_intr_en_illegal_compstat;
#endif #endif
/** @endcond */
/** Are we currently running on a FUSA device configuration? */ /** Are we currently running on a FUSA device configuration? */
bool is_fusa_sku; bool is_fusa_sku;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ u16 pci_class;
#ifdef CONFIG_NVGPU_DGPU
/* PCI device identifier */ /* PCI device identifier */
u16 pci_vendor_id, pci_device_id; u16 pci_vendor_id, pci_device_id;
u16 pci_subsystem_vendor_id, pci_subsystem_device_id; u16 pci_subsystem_vendor_id, pci_subsystem_device_id;
u16 pci_class;
u8 pci_revision; u8 pci_revision;
/**
* The per-device identifier. The iGPUs without a PDI will use
* the SoC PDI if one exists. Zero if neither exists.
*/
u64 per_device_identifier;
/* /*
* PCI power management: i2c device index, port and address for * PCI power management: i2c device index, port and address for
* INA3221. * INA3221.
@@ -803,9 +828,13 @@ struct gk20a {
/* PCIe power states. */ /* PCIe power states. */
bool xve_l0s; bool xve_l0s;
bool xve_l1; bool xve_l1;
#endif
/* Current warning temp in sfxp24.8 */ /**
s32 curr_warn_temp; * The per-device identifier. The iGPUs without a PDI will use
* the SoC PDI if one exists. Zero if neither exists.
*/
u64 per_device_identifier;
#if defined(CONFIG_PCI_MSI) #if defined(CONFIG_PCI_MSI)
/* Check if msi is enabled */ /* Check if msi is enabled */
@@ -816,11 +845,9 @@ struct gk20a {
struct nvgpu_mem_alloc_tracker *kmallocs; struct nvgpu_mem_alloc_tracker *kmallocs;
#endif #endif
/* memory training sequence and mclk switch scripts */ #ifdef CONFIG_NVGPU_NON_FUSA
u32 mem_config_idx;
u64 dma_memory_used; u64 dma_memory_used;
/** @endcond */ #endif
#if defined(CONFIG_TEGRA_GK20A_NVHOST) #if defined(CONFIG_TEGRA_GK20A_NVHOST)
/** Full syncpoint aperture base memory address. */ /** Full syncpoint aperture base memory address. */
@@ -833,14 +860,14 @@ struct gk20a {
/** Full syncpoint aperture. */ /** Full syncpoint aperture. */
struct nvgpu_mem syncpt_mem; struct nvgpu_mem syncpt_mem;
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_LS_PMU
struct nvgpu_list_node boardobj_head; struct nvgpu_list_node boardobj_head;
struct nvgpu_list_node boardobjgrp_head; struct nvgpu_list_node boardobjgrp_head;
#endif
struct nvgpu_mem pdb_cache_errata_mem;
/** @endcond */
#ifdef CONFIG_NVGPU_DGPU #ifdef CONFIG_NVGPU_DGPU
struct nvgpu_mem pdb_cache_errata_mem;
u16 dgpu_max_clk; u16 dgpu_max_clk;
#endif #endif

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -27,6 +27,9 @@
struct gk20a; struct gk20a;
struct namemap_cfg; struct namemap_cfg;
struct clk_gk20a; struct clk_gk20a;
#ifdef CONFIG_NVGPU_CLK_ARB
struct nvgpu_clk_pll_debug_data;
#endif
/** /**
* @brief clk gops. * @brief clk gops.
@@ -36,7 +39,7 @@ struct clk_gk20a;
* func pointers. * func pointers.
*/ */
struct gops_clk { struct gops_clk {
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_CLK_ARB
int (*init_debugfs)(struct gk20a *g); int (*init_debugfs)(struct gk20a *g);
int (*init_clk_support)(struct gk20a *g); int (*init_clk_support)(struct gk20a *g);
void (*suspend_clk_support)(struct gk20a *g); void (*suspend_clk_support)(struct gk20a *g);
@@ -58,7 +61,7 @@ struct gops_clk {
u32 (*get_ref_clock_rate)(struct gk20a *g); u32 (*get_ref_clock_rate)(struct gk20a *g);
int (*predict_mv_at_hz_cur_tfloor)(struct clk_gk20a *clk, int (*predict_mv_at_hz_cur_tfloor)(struct clk_gk20a *clk,
unsigned long rate); unsigned long rate);
/** @endcond */ #endif
/** /**
* @brief Get max rate of gpu clock. * @brief Get max rate of gpu clock.
* *
@@ -72,7 +75,7 @@ struct gops_clk {
* @return 0 in case of failure and > 0 in case of success * @return 0 in case of failure and > 0 in case of success
*/ */
unsigned long (*get_maxrate)(struct gk20a *g, u32 api_domain); unsigned long (*get_maxrate)(struct gk20a *g, u32 api_domain);
/** @cond DOXYGEN_SHOULD_SKIP_THIS */ #ifdef CONFIG_NVGPU_CLK_ARB
int (*prepare_enable)(struct clk_gk20a *clk); int (*prepare_enable)(struct clk_gk20a *clk);
void (*disable_unprepare)(struct clk_gk20a *clk); void (*disable_unprepare)(struct clk_gk20a *clk);
int (*get_voltage)(struct clk_gk20a *clk, u64 *val); int (*get_voltage)(struct clk_gk20a *clk, u64 *val);
@@ -92,7 +95,7 @@ struct gops_clk {
int (*perf_pmu_vfe_load)(struct gk20a *g); int (*perf_pmu_vfe_load)(struct gk20a *g);
bool support_vf_point; bool support_vf_point;
u8 lut_num_entries; u8 lut_num_entries;
/** @endcond */ #endif
}; };
struct gops_clk_mon { struct gops_clk_mon {

View File

@@ -74,6 +74,7 @@ struct ctxsw_buf_offset_map_entry;
enum ctxsw_addr_type; enum ctxsw_addr_type;
enum nvgpu_event_id_type; enum nvgpu_event_id_type;
#endif #endif
struct netlist_av64_list;
/** /**
* This structure stores the GR engine ecc subunit hal pointers. * This structure stores the GR engine ecc subunit hal pointers.

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -22,6 +22,7 @@
#ifndef NVGPU_GOPS_NVLINK_H #ifndef NVGPU_GOPS_NVLINK_H
#define NVGPU_GOPS_NVLINK_H #define NVGPU_GOPS_NVLINK_H
#ifdef CONFIG_NVGPU_DGPU
/* API */ /* API */
struct gops_nvlink_link_mode_transitions { struct gops_nvlink_link_mode_transitions {
int (*setup_pll)(struct gk20a *g, int (*setup_pll)(struct gk20a *g,
@@ -90,5 +91,6 @@ struct gops_nvlink {
struct gops_nvlink_minion minion; struct gops_nvlink_minion minion;
struct gops_nvlink_intr intr; struct gops_nvlink_intr intr;
}; };
#endif
#endif /* NVGPU_GOPS_NVLINK_H */ #endif /* NVGPU_GOPS_NVLINK_H */

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2020-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -214,7 +214,9 @@ struct gpu_ops {
void (**fn)(struct gk20a *g, struct nvgpu_mem *mem)); void (**fn)(struct gk20a *g, struct nvgpu_mem *mem));
struct gops_pmu_perf pmu_perf; struct gops_pmu_perf pmu_perf;
struct gops_debug debug; struct gops_debug debug;
#ifdef CONFIG_NVGPU_DGPU
struct gops_nvlink nvlink; struct gops_nvlink nvlink;
#endif
struct gops_sec2 sec2; struct gops_sec2 sec2;
struct gops_gsp gsp; struct gops_gsp gsp;
/** @endcond */ /** @endcond */

View File

@@ -769,6 +769,11 @@ static inline s32 nvgpu_safe_cast_s64_to_s32(s64 sl_a)
* *
* @param v [in] Value to determine precision for. * @param v [in] Value to determine precision for.
* *
* Returns number of 1-bits (set bits). Compiler intrinsics are used for this
* purpose. __builtin_popcount for unsigned int, __builtin_popcountl for
* unsigned long and __builtin_popcountll for unsigned long long data type is
* used.
*
* @return s32 representation of the precision in bits of the value passed in. * @return s32 representation of the precision in bits of the value passed in.
*/ */
#define NVGPU_PRECISION(v) _Generic(v, \ #define NVGPU_PRECISION(v) _Generic(v, \

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2016-2022, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -88,7 +88,6 @@ static void nvgpu_init_vars(struct gk20a *g)
nvgpu_mutex_init(&platform->railgate_lock); nvgpu_mutex_init(&platform->railgate_lock);
nvgpu_mutex_init(&g->dbg_sessions_lock); nvgpu_mutex_init(&g->dbg_sessions_lock);
nvgpu_mutex_init(&g->client_lock);
nvgpu_mutex_init(&g->power_lock); nvgpu_mutex_init(&g->power_lock);
nvgpu_mutex_init(&g->static_pg_lock); nvgpu_mutex_init(&g->static_pg_lock);
nvgpu_mutex_init(&g->clk_arb_enable_lock); nvgpu_mutex_init(&g->clk_arb_enable_lock);

View File

@@ -1,7 +1,7 @@
/* /*
* Virtualized GPU for Linux * Virtualized GPU for Linux
* *
* Copyright (c) 2018-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -145,7 +145,6 @@ static int vgpu_init_support(struct platform_device *pdev)
} }
nvgpu_mutex_init(&g->dbg_sessions_lock); nvgpu_mutex_init(&g->dbg_sessions_lock);
nvgpu_mutex_init(&g->client_lock);
#if defined(CONFIG_NVGPU_CYCLESTATS) #if defined(CONFIG_NVGPU_CYCLESTATS)
nvgpu_mutex_init(&g->cs_lock); nvgpu_mutex_init(&g->cs_lock);
#endif #endif

View File

@@ -132,14 +132,22 @@ int gk20a_busy(struct gk20a *g)
return -ENODEV; return -ENODEV;
} }
#endif #endif
#ifdef CONFIG_NVGPU_NON_FUSA
nvgpu_atomic_inc(&g->usage_count); nvgpu_atomic_inc(&g->usage_count);
#else
(void)g;
#endif
return 0; return 0;
} }
void gk20a_idle(struct gk20a *g) void gk20a_idle(struct gk20a *g)
{ {
#ifdef CONFIG_NVGPU_NON_FUSA
nvgpu_atomic_dec(&g->usage_count); nvgpu_atomic_dec(&g->usage_count);
#else
(void)g;
#endif
} }
static void nvgpu_posix_load_regs(struct gk20a *g) static void nvgpu_posix_load_regs(struct gk20a *g)

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -340,7 +340,9 @@ static int prepare_gr_hw_sw(struct unit_module *m, struct gk20a *g)
err = nvgpu_gr_enable_hw(g); err = nvgpu_gr_enable_hw(g);
if (err != 0) { if (err != 0) {
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_release(&g->static_pg_lock); nvgpu_mutex_release(&g->static_pg_lock);
#endif
unit_return_fail(m, "failed to enable gr"); unit_return_fail(m, "failed to enable gr");
} }
@@ -399,7 +401,9 @@ int test_acr_bootstrap_hs_acr(struct unit_module *m,
return -ENOMEM; return -ENOMEM;
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_acquire(&g->static_pg_lock); nvgpu_mutex_acquire(&g->static_pg_lock);
#endif
/* /*
* Prepare HW and SW setup needed * Prepare HW and SW setup needed
@@ -598,7 +602,9 @@ int test_acr_bootstrap_hs_acr(struct unit_module *m,
as expected\n"); as expected\n");
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_release(&g->static_pg_lock); nvgpu_mutex_release(&g->static_pg_lock);
#endif
return UNIT_SUCCESS; return UNIT_SUCCESS;
} }
@@ -619,7 +625,9 @@ int test_acr_construct_execute(struct unit_module *m,
unit_return_fail(m, "Test env init failed\n"); unit_return_fail(m, "Test env init failed\n");
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_acquire(&g->static_pg_lock); nvgpu_mutex_acquire(&g->static_pg_lock);
#endif
/* /*
* Prepare HW and SW setup needed for the test * Prepare HW and SW setup needed for the test
@@ -693,7 +701,9 @@ int test_acr_construct_execute(struct unit_module *m,
unit_return_fail(m, "Bootstrap HS ACR didn't failed as \ unit_return_fail(m, "Bootstrap HS ACR didn't failed as \
expected\n"); expected\n");
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_release(&g->static_pg_lock); nvgpu_mutex_release(&g->static_pg_lock);
#endif
return UNIT_SUCCESS; return UNIT_SUCCESS;
} }
@@ -712,7 +722,9 @@ int test_acr_is_lsf_lazy_bootstrap(struct unit_module *m,
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_acquire(&g->static_pg_lock); nvgpu_mutex_acquire(&g->static_pg_lock);
#endif
/* /*
* Prepare HW and SW setup needed for the test * Prepare HW and SW setup needed for the test
@@ -762,7 +774,9 @@ int test_acr_is_lsf_lazy_bootstrap(struct unit_module *m,
expected\n"); expected\n");
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_release(&g->static_pg_lock); nvgpu_mutex_release(&g->static_pg_lock);
#endif
return UNIT_SUCCESS; return UNIT_SUCCESS;
} }
@@ -782,7 +796,9 @@ int test_acr_prepare_ucode_blob(struct unit_module *m,
unit_return_fail(m, "Test env init failed\n"); unit_return_fail(m, "Test env init failed\n");
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_acquire(&g->static_pg_lock); nvgpu_mutex_acquire(&g->static_pg_lock);
#endif
/* /*
* Prepare HW and SW setup needed for the test * Prepare HW and SW setup needed for the test
@@ -882,7 +898,9 @@ int test_acr_prepare_ucode_blob(struct unit_module *m,
unit_return_fail(m, "prepare_ucode_blob test failed\n"); unit_return_fail(m, "prepare_ucode_blob test failed\n");
} }
#ifdef CONFIG_NVGPU_TPC_POWERGATE
nvgpu_mutex_release(&g->static_pg_lock); nvgpu_mutex_release(&g->static_pg_lock);
#endif
return UNIT_SUCCESS; return UNIT_SUCCESS;
} }

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -381,6 +381,7 @@ int test_falcon_sw_init_free(struct unit_module *m, struct gk20a *g,
unit_return_fail(m, "FECS falcon sw not initialized\n"); unit_return_fail(m, "FECS falcon sw not initialized\n");
} }
#ifdef CONFIG_NVGPU_DGPU
err = verify_valid_falcon_sw_init(m, g, FALCON_ID_GSPLITE); err = verify_valid_falcon_sw_init(m, g, FALCON_ID_GSPLITE);
if (err != 0) { if (err != 0) {
unit_return_fail(m, "GSPLITE falcon sw not initialized\n"); unit_return_fail(m, "GSPLITE falcon sw not initialized\n");
@@ -400,6 +401,7 @@ int test_falcon_sw_init_free(struct unit_module *m, struct gk20a *g,
if (err != 0) { if (err != 0) {
unit_return_fail(m, "MINION falcon sw not initialized\n"); unit_return_fail(m, "MINION falcon sw not initialized\n");
} }
#endif
return UNIT_SUCCESS; return UNIT_SUCCESS;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -158,12 +158,20 @@ done:
#define F_CHANNEL_OPEN_ALLOC_CH_FAIL BIT(2) #define F_CHANNEL_OPEN_ALLOC_CH_FAIL BIT(2)
#define F_CHANNEL_OPEN_ALLOC_CH_WARN0 BIT(3) #define F_CHANNEL_OPEN_ALLOC_CH_WARN0 BIT(3)
#define F_CHANNEL_OPEN_ALLOC_CH_WARN1 BIT(4) #define F_CHANNEL_OPEN_ALLOC_CH_WARN1 BIT(4)
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
#define F_CHANNEL_OPEN_ALLOC_CH_AGGRESSIVE BIT(5) #define F_CHANNEL_OPEN_ALLOC_CH_AGGRESSIVE BIT(5)
#define F_CHANNEL_OPEN_BUG_ON BIT(6) #define F_CHANNEL_OPEN_BUG_ON BIT(6)
#define F_CHANNEL_OPEN_ALLOC_INST_FAIL BIT(7) #define F_CHANNEL_OPEN_ALLOC_INST_FAIL BIT(7)
#define F_CHANNEL_OPEN_NOTIFIER_WQ_INIT_FAIL BIT(8) #define F_CHANNEL_OPEN_NOTIFIER_WQ_INIT_FAIL BIT(8)
#define F_CHANNEL_OPEN_SEMAPHORE_WQ_INIT_FAIL BIT(9) #define F_CHANNEL_OPEN_SEMAPHORE_WQ_INIT_FAIL BIT(9)
#define F_CHANNEL_OPEN_LAST BIT(10) #define F_CHANNEL_OPEN_LAST BIT(10)
#else
#define F_CHANNEL_OPEN_BUG_ON BIT(5)
#define F_CHANNEL_OPEN_ALLOC_INST_FAIL BIT(6)
#define F_CHANNEL_OPEN_NOTIFIER_WQ_INIT_FAIL BIT(7)
#define F_CHANNEL_OPEN_SEMAPHORE_WQ_INIT_FAIL BIT(8)
#define F_CHANNEL_OPEN_LAST BIT(9)
#endif
static const char *f_channel_open[] = { static const char *f_channel_open[] = {
@@ -278,8 +286,10 @@ int test_channel_open(struct unit_module *m, struct gk20a *g, void *vargs)
u32 runlist_id; u32 runlist_id;
bool privileged; bool privileged;
int err; int err;
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
void (*os_channel_open)(struct nvgpu_channel *ch) = void (*os_channel_open)(struct nvgpu_channel *ch) =
g->os_channel.open; g->os_channel.open;
#endif
l_cond_fi = nvgpu_cond_get_fault_injection(); l_cond_fi = nvgpu_cond_get_fault_injection();
@@ -320,10 +330,12 @@ int test_channel_open(struct unit_module *m, struct gk20a *g, void *vargs)
next_ch->referenceable = false; next_ch->referenceable = false;
} }
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
if (branches & F_CHANNEL_OPEN_ALLOC_CH_AGGRESSIVE) { if (branches & F_CHANNEL_OPEN_ALLOC_CH_AGGRESSIVE) {
g->aggressive_sync_destroy_thresh += 1U; g->aggressive_sync_destroy_thresh += 1U;
f->used_channels += 2U; f->used_channels += 2U;
} }
#endif
if (branches & F_CHANNEL_OPEN_NOTIFIER_WQ_INIT_FAIL) { if (branches & F_CHANNEL_OPEN_NOTIFIER_WQ_INIT_FAIL) {
nvgpu_posix_enable_fault_injection(l_cond_fi, true, 0); nvgpu_posix_enable_fault_injection(l_cond_fi, true, 0);
@@ -361,12 +373,14 @@ int test_channel_open(struct unit_module *m, struct gk20a *g, void *vargs)
next_ch->referenceable = true; next_ch->referenceable = true;
} }
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
if (branches & F_CHANNEL_OPEN_ALLOC_CH_AGGRESSIVE) { if (branches & F_CHANNEL_OPEN_ALLOC_CH_AGGRESSIVE) {
g->aggressive_sync_destroy_thresh -= 1U; g->aggressive_sync_destroy_thresh -= 1U;
f->used_channels -= 2U; f->used_channels -= 2U;
unit_assert(g->aggressive_sync_destroy, goto done); unit_assert(g->aggressive_sync_destroy, goto done);
g->aggressive_sync_destroy = false; g->aggressive_sync_destroy = false;
} }
#endif
if (branches & fail) { if (branches & fail) {
nvgpu_posix_enable_fault_injection(l_cond_fi, false, 0); nvgpu_posix_enable_fault_injection(l_cond_fi, false, 0);
@@ -402,7 +416,9 @@ done:
nvgpu_channel_close(ch); nvgpu_channel_close(ch);
} }
g->ops = gops; g->ops = gops;
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
g->os_channel.open = os_channel_open; g->os_channel.open = os_channel_open;
#endif
return ret; return ret;
} }
@@ -537,11 +553,13 @@ int test_channel_close(struct unit_module *m, struct gk20a *g, void *vargs)
g->os_channel.close = branches & F_CHANNEL_CLOSE_OS_CLOSE ? g->os_channel.close = branches & F_CHANNEL_CLOSE_OS_CLOSE ?
stub_os_channel_close : NULL; stub_os_channel_close : NULL;
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
g->aggressive_sync_destroy_thresh = g->aggressive_sync_destroy_thresh =
branches & F_CHANNEL_CLOSE_NONZERO_DESTROY_THRESH_64 ? branches & F_CHANNEL_CLOSE_NONZERO_DESTROY_THRESH_64 ?
64U : 64U :
(branches & F_CHANNEL_CLOSE_NONZERO_DESTROY_THRESH_1) ? (branches & F_CHANNEL_CLOSE_NONZERO_DESTROY_THRESH_1) ?
1U : 0U; 1U : 0U;
#endif
if (branches & F_CHANNEL_CLOSE_TSG_BOUND) { if (branches & F_CHANNEL_CLOSE_TSG_BOUND) {
err = nvgpu_tsg_bind_channel(tsg, ch); err = nvgpu_tsg_bind_channel(tsg, ch);
@@ -1508,8 +1526,12 @@ done:
#define F_CHANNEL_SUSPEND_RESUME_UNSERVICEABLE_CH BIT(0) #define F_CHANNEL_SUSPEND_RESUME_UNSERVICEABLE_CH BIT(0)
#define F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID BIT(1) #define F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID BIT(1)
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
#define F_CHANNEL_SUSPEND_RESUME_CH_WRK_CMPL_CNCL_SYNC BIT(2) #define F_CHANNEL_SUSPEND_RESUME_CH_WRK_CMPL_CNCL_SYNC BIT(2)
#define F_CHANNEL_SUSPEND_RESUME_CHS_LAST BIT(3) #define F_CHANNEL_SUSPEND_RESUME_CHS_LAST BIT(3)
#else
#define F_CHANNEL_SUSPEND_RESUME_CHS_LAST BIT(2)
#endif
static const char *f_channel_suspend_resume[] = { static const char *f_channel_suspend_resume[] = {
"suspend_resume_unserviceable_channels", "suspend_resume_unserviceable_channels",
@@ -1536,10 +1558,12 @@ static int stub_runlist_reload(struct gk20a *g, struct nvgpu_runlist *rl,
return 0; return 0;
} }
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
static void stub_channel_work_completion_cancel_sync(struct nvgpu_channel *ch) static void stub_channel_work_completion_cancel_sync(struct nvgpu_channel *ch)
{ {
} }
#endif
int test_channel_suspend_resume_serviceable_chs(struct unit_module *m, int test_channel_suspend_resume_serviceable_chs(struct unit_module *m,
struct gk20a *g, void *vargs) struct gk20a *g, void *vargs)
@@ -1551,9 +1575,14 @@ int test_channel_suspend_resume_serviceable_chs(struct unit_module *m,
bool err; bool err;
u32 orig_ch_tsgid; u32 orig_ch_tsgid;
u32 branches = 0U; u32 branches = 0U;
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
u32 prune = F_CHANNEL_SUSPEND_RESUME_UNSERVICEABLE_CH | u32 prune = F_CHANNEL_SUSPEND_RESUME_UNSERVICEABLE_CH |
F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID | F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID |
F_CHANNEL_SUSPEND_RESUME_CH_WRK_CMPL_CNCL_SYNC; F_CHANNEL_SUSPEND_RESUME_CH_WRK_CMPL_CNCL_SYNC;
#else
u32 prune = F_CHANNEL_SUSPEND_RESUME_UNSERVICEABLE_CH |
F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID;
#endif
int ret = UNIT_FAIL; int ret = UNIT_FAIL;
tsg = nvgpu_tsg_open(g, getpid()); tsg = nvgpu_tsg_open(g, getpid());
@@ -1588,10 +1617,11 @@ int test_channel_suspend_resume_serviceable_chs(struct unit_module *m,
} else { } else {
ch->unserviceable = false; ch->unserviceable = false;
} }
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
g->os_channel.work_completion_cancel_sync = branches & g->os_channel.work_completion_cancel_sync = branches &
F_CHANNEL_SUSPEND_RESUME_CH_WRK_CMPL_CNCL_SYNC ? F_CHANNEL_SUSPEND_RESUME_CH_WRK_CMPL_CNCL_SYNC ?
stub_channel_work_completion_cancel_sync : NULL; stub_channel_work_completion_cancel_sync : NULL;
#endif
ch->tsgid = branches & F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID ? ch->tsgid = branches & F_CHANNEL_SUSPEND_RESUME_INVALID_TSGID ?
NVGPU_INVALID_TSG_ID : orig_ch_tsgid; NVGPU_INVALID_TSG_ID : orig_ch_tsgid;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2020, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -185,6 +185,7 @@ int test_get_litter_value(struct unit_module *m,
VOLTA_DMA_COPY_A); VOLTA_DMA_COPY_A);
assert(gv11b_get_litter_value(g, GPU_LIT_GPC_PRIV_STRIDE) == assert(gv11b_get_litter_value(g, GPU_LIT_GPC_PRIV_STRIDE) ==
proj_gpc_priv_stride_v()); proj_gpc_priv_stride_v());
#ifdef CONFIG_NVGPU_DEBUGGER
assert(gv11b_get_litter_value(g, GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START) == assert(gv11b_get_litter_value(g, GPU_LIT_PERFMON_PMMGPCTPCA_DOMAIN_START) ==
2); 2);
assert(gv11b_get_litter_value(g, GPU_LIT_PERFMON_PMMGPCTPCB_DOMAIN_START) == assert(gv11b_get_litter_value(g, GPU_LIT_PERFMON_PMMGPCTPCB_DOMAIN_START) ==
@@ -199,6 +200,7 @@ int test_get_litter_value(struct unit_module *m,
3); 3);
assert(gv11b_get_litter_value(g, GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT) == assert(gv11b_get_litter_value(g, GPU_LIT_PERFMON_PMMFBP_ROP_DOMAIN_COUNT) ==
2); 2);
#endif
if (!EXPECT_BUG(gv11b_get_litter_value(g, U32_MAX))) { if (!EXPECT_BUG(gv11b_get_litter_value(g, U32_MAX))) {
unit_err(m, "%s: failed to detect INVALID value\n", unit_err(m, "%s: failed to detect INVALID value\n",
@@ -291,7 +293,9 @@ int test_get_put(struct unit_module *m,
nvgpu_ref_init(&g->refcount); nvgpu_ref_init(&g->refcount);
/* to cover the cases where these are set */ /* to cover the cases where these are set */
#ifdef CONFIG_NVGPU_NON_FUSA
g->remove_support = no_return; g->remove_support = no_return;
#endif
g->gfree = no_return; g->gfree = no_return;
g->ops.ecc.ecc_remove_support = no_return; g->ops.ecc.ecc_remove_support = no_return;
g->ops.ltc.ltc_remove_support = no_return; g->ops.ltc.ltc_remove_support = no_return;
@@ -396,8 +400,12 @@ static void set_poweron_funcs_success(struct gk20a *g)
/* these are the simple case of just taking a g param */ /* these are the simple case of just taking a g param */
setup_simple_init_func_success(&g->ops.ecc.ecc_init_support, i++); setup_simple_init_func_success(&g->ops.ecc.ecc_init_support, i++);
setup_simple_init_func_success(&g->ops.mm.pd_cache_init, i++); setup_simple_init_func_success(&g->ops.mm.pd_cache_init, i++);
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
setup_simple_init_func_success(&g->ops.clk.init_clk_support, i++); setup_simple_init_func_success(&g->ops.clk.init_clk_support, i++);
#endif
#ifdef CONFIG_NVGPU_NVLINK
setup_simple_init_func_success(&g->ops.nvlink.init, i++); setup_simple_init_func_success(&g->ops.nvlink.init, i++);
#endif
setup_simple_init_func_success(&g->ops.fifo.reset_enable_hw, i++); setup_simple_init_func_success(&g->ops.fifo.reset_enable_hw, i++);
setup_simple_init_func_success(&g->ops.ltc.init_ltc_support, i++); setup_simple_init_func_success(&g->ops.ltc.init_ltc_support, i++);
setup_simple_init_func_success(&g->ops.mm.init_mm_support, i++); setup_simple_init_func_success(&g->ops.mm.init_mm_support, i++);
@@ -497,7 +505,9 @@ int test_poweron_branches(struct unit_module *m, struct gk20a *g, void *args)
set_poweron_funcs_success(g); set_poweron_funcs_success(g);
/* hit all the NULL pointer checks */ /* hit all the NULL pointer checks */
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
g->ops.clk.init_clk_support = NULL; g->ops.clk.init_clk_support = NULL;
#endif
g->ops.therm.elcg_init_idle_filters = NULL; g->ops.therm.elcg_init_idle_filters = NULL;
g->ops.ecc.ecc_init_support = NULL; g->ops.ecc.ecc_init_support = NULL;
g->ops.channel.resume_all_serviceable_ch = NULL; g->ops.channel.resume_all_serviceable_ch = NULL;
@@ -560,7 +570,9 @@ int test_poweroff(struct unit_module *m, struct gk20a *g, void *args)
setup_simple_init_func_success(&g->ops.fifo.fifo_suspend, i++); setup_simple_init_func_success(&g->ops.fifo.fifo_suspend, i++);
simple_init_func_ptrs_count = i; simple_init_func_ptrs_count = i;
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
g->ops.clk.suspend_clk_support = no_return; g->ops.clk.suspend_clk_support = no_return;
#endif
g->ops.mc.intr_mask = no_return; g->ops.mc.intr_mask = no_return;
g->ops.falcon.falcon_sw_free = no_return_u32_param; g->ops.falcon.falcon_sw_free = no_return_u32_param;
@@ -583,7 +595,9 @@ int test_poweroff(struct unit_module *m, struct gk20a *g, void *args)
/* Cover branches for NULL ptr checks */ /* Cover branches for NULL ptr checks */
g->ops.mc.intr_mask = NULL; g->ops.mc.intr_mask = NULL;
g->ops.channel.suspend_all_serviceable_ch = NULL; g->ops.channel.suspend_all_serviceable_ch = NULL;
#ifdef CONFIG_NVGPU_HAL_NON_FUSA
g->ops.clk.suspend_clk_support = NULL; g->ops.clk.suspend_clk_support = NULL;
#endif
err = nvgpu_prepare_poweroff(g); err = nvgpu_prepare_poweroff(g);
if (err != 0) { if (err != 0) {
unit_return_fail(m, "nvgpu_prepare_poweroff returned fail\n"); unit_return_fail(m, "nvgpu_prepare_poweroff returned fail\n");

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -39,11 +39,7 @@ struct unit_module;
* *
* Test Type: Feature * Test Type: Feature
* *
<<<<<<< HEAD
* Targets: gops_mm.gops_mm_gmmu.get_default_big_page_size, * Targets: gops_mm.gops_mm_gmmu.get_default_big_page_size,
=======
* Targets: gops_mm_gmmu.get_default_big_page_size,
>>>>>>> 2769ccf4e... gpu: nvgpu: userspace: update "Targets" field for mm
* nvgpu_gmmu_default_big_page_size * nvgpu_gmmu_default_big_page_size
* *
* Input: None * Input: None

View File

@@ -668,7 +668,9 @@ int test_handle_mmu_fault_common(struct unit_module *m,
g->ops.channel.free_inst = nvgpu_channel_free_inst; g->ops.channel.free_inst = nvgpu_channel_free_inst;
g->ops.tsg.disable = nvgpu_tsg_disable; g->ops.tsg.disable = nvgpu_tsg_disable;
g->ops.fifo.preempt_tsg = nvgpu_fifo_preempt_tsg; g->ops.fifo.preempt_tsg = nvgpu_fifo_preempt_tsg;
#ifdef CONFIG_NVGPU_KERNEL_MODE_SUBMIT
g->aggressive_sync_destroy_thresh = 0U; g->aggressive_sync_destroy_thresh = 0U;
#endif
g->fifo.g = g; g->fifo.g = g;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2021, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@@ -258,32 +258,36 @@ int test_nvgpu_init_mm(struct unit_module *m, struct gk20a *g, void *args)
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_DMA, 11, errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_DMA, 11,
-ENOMEM, 11); -ENOMEM, 11);
#ifdef CONFIG_NVGPU_NON_FUSA
/* Disable for now. */
/* Making nvgpu_init_cde_vm fail */ /* Making nvgpu_init_cde_vm fail */
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_KMEM, 25, //errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_KMEM, 80,
-ENOMEM, 12); // -ENOMEM, 12);
#endif
/* Making nvgpu_init_ce_vm fail */ /* Making nvgpu_init_ce_vm fail */
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_KMEM, 33, errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_KMEM, 33,
-ENOMEM, 12);
/* Making nvgpu_init_mmu_debug fail on wr_mem DMA alloc */
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_DMA, 13,
-ENOMEM, 13); -ENOMEM, 13);
/* Making nvgpu_init_mmu_debug fail on wr_mem DMA alloc */ /* Making nvgpu_init_mmu_debug fail on rd_mem DMA alloc */
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_DMA, 14, errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_DMA, 14,
-ENOMEM, 14); -ENOMEM, 14);
/* Making nvgpu_init_mmu_debug fail on rd_mem DMA alloc */
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_DMA, 15,
-ENOMEM, 15);
/* Making g->ops.mm.mmu_fault.setup_sw fail */ /* Making g->ops.mm.mmu_fault.setup_sw fail */
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_HAL, 1, errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_HAL, 0,
ARBITRARY_ERROR, 16); ARBITRARY_ERROR, 15);
/* Making g->ops.fb.fb_ecc_init fail */ /* Making g->ops.fb.fb_ecc_init fail */
g->ops.fb.ecc.init = int_empty_hal; g->ops.fb.ecc.init = int_empty_hal;
errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_HAL, 2, errors += nvgpu_init_mm_support_inject_error(m, g, ERROR_TYPE_HAL, 1,
ARBITRARY_ERROR, 17); ARBITRARY_ERROR, 16);
g->ops.fb.ecc.init = NULL; g->ops.fb.ecc.init = NULL;
#ifdef CONFIG_NVGPU_NON_FUSA
/* /*
* Extra cases for branch coverage: change support flags to test * Extra cases for branch coverage: change support flags to test
* other branches * other branches
@@ -300,6 +304,7 @@ int test_nvgpu_init_mm(struct unit_module *m, struct gk20a *g, void *args)
nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, true);
nvgpu_set_errata(g, NVGPU_ERRATA_MM_FORCE_128K_PMU_VM, true); nvgpu_set_errata(g, NVGPU_ERRATA_MM_FORCE_128K_PMU_VM, true);
g->has_cde = true; g->has_cde = true;
#endif
/* /*
* Extra cases for branch coverage: remove some HALs to test branches * Extra cases for branch coverage: remove some HALs to test branches
@@ -452,7 +457,9 @@ int test_mm_init_hal(struct unit_module *m, struct gk20a *g, void *args)
struct nvgpu_os_posix *p = nvgpu_os_posix_from_gk20a(g); struct nvgpu_os_posix *p = nvgpu_os_posix_from_gk20a(g);
p->mm_is_iommuable = true; p->mm_is_iommuable = true;
#ifdef CONFIG_NVGPU_NON_FUSA
g->has_cde = true; g->has_cde = true;
#endif
g->ops.mc.intr_stall_unit_config = mc_gp10b_intr_stall_unit_config; g->ops.mc.intr_stall_unit_config = mc_gp10b_intr_stall_unit_config;
g->ops.mc.intr_nonstall_unit_config = g->ops.mc.intr_nonstall_unit_config =
@@ -594,6 +601,7 @@ int test_mm_remove_mm_support(struct unit_module *m, struct gk20a *g,
/* Reset this to NULL to avoid trying to destroy the mutex again */ /* Reset this to NULL to avoid trying to destroy the mutex again */
g->ops.mm.mmu_fault.info_mem_destroy = NULL; g->ops.mm.mmu_fault.info_mem_destroy = NULL;
#ifdef CONFIG_NVGPU_NON_FUSA
/* Extra cases for branch coverage */ /* Extra cases for branch coverage */
nvgpu_set_enabled(g, NVGPU_SUPPORT_SEC2_VM, false); nvgpu_set_enabled(g, NVGPU_SUPPORT_SEC2_VM, false);
nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, false); nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, false);
@@ -604,6 +612,7 @@ int test_mm_remove_mm_support(struct unit_module *m, struct gk20a *g,
nvgpu_set_enabled(g, NVGPU_SUPPORT_SEC2_VM, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_SEC2_VM, true);
nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, true); nvgpu_set_enabled(g, NVGPU_SUPPORT_GSP_VM, true);
g->has_cde = true; g->has_cde = true;
#endif
return UNIT_SUCCESS; return UNIT_SUCCESS;
} }