mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: tu104: implement l2 sector promotion
Introduce new HAL gops_ltc.set_l2_sector_promotion to configure L2 sector promotion policy. The follow three promotion settings are support: - NVGPU_GPU_IOCTL_TSG_L2_SECTOR_PROMOTE_FLAG_NONE - NVGPU_GPU_IOCTL_TSG_L2_SECTOR_PROMOTE_FLAG_64B - NVGPU_GPU_IOCTL_TSG_L2_SECTOR_PROMOTE_FLAG_128B Add ioctl "NVGPU_TSG_IOCTL_SET_L2_SECTOR_PROMOTION" to the gpu tsg node to support l2 sector promotion. On chips which do not support sector promotion, the ioctl returns 0. Bug 200656177 Change-Id: Iad835a5c954d3b10da436cfafb388aaaa04f44c7 Signed-off-by: Antony Clince Alex <aalex@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2460553 Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
5517e14e57
commit
95bfa039f5
@@ -330,6 +330,7 @@ static const struct gops_ltc tu104_ops_ltc = {
|
||||
.split_lts_broadcast_addr = gm20b_ltc_split_lts_broadcast_addr,
|
||||
.split_ltc_broadcast_addr = gm20b_ltc_split_ltc_broadcast_addr,
|
||||
.pri_is_lts_tstg_addr = tu104_ltc_pri_is_lts_tstg_addr,
|
||||
.set_l2_sector_promotion = tu104_set_l2_sector_promotion,
|
||||
#endif /* CONFIG_NVGPU_DEBUGGER */
|
||||
};
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
#include <nvgpu/timers.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/trace.h>
|
||||
#include "ltc_tu104.h"
|
||||
#include <nvgpu/regops.h>
|
||||
|
||||
#include "hal/gr/gr/gr_gk20a.h"
|
||||
#include "ltc_tu104.h"
|
||||
#include "ltc_gv11b.h"
|
||||
|
||||
#include <nvgpu/hw/tu104/hw_ltc_tu104.h>
|
||||
@@ -69,4 +71,105 @@ u32 tu104_ltc_pri_is_lts_tstg_addr(struct gk20a *g, u32 addr)
|
||||
return (lts_addr >= LTS_TSTG_BASE && lts_addr <= LTS_TSTG_EXTENT) ?
|
||||
true : false;
|
||||
}
|
||||
|
||||
int tu104_set_l2_sector_promotion(struct gk20a *g, struct nvgpu_tsg *tsg,
|
||||
u32 policy)
|
||||
{
|
||||
int err = 0;
|
||||
struct nvgpu_dbg_reg_op cfg_ops[2] = {
|
||||
{
|
||||
.op = REGOP(READ_32),
|
||||
.type = REGOP(TYPE_GR_CTX),
|
||||
.offset = ltc_ltcs_ltss_tstg_cfg2_r()
|
||||
},
|
||||
{
|
||||
.op = REGOP(READ_32),
|
||||
.type = REGOP(TYPE_GR_CTX),
|
||||
.offset = ltc_ltcs_ltss_tstg_cfg3_r()
|
||||
},
|
||||
};
|
||||
u32 flags = NVGPU_REG_OP_FLAG_MODE_ALL_OR_NONE;
|
||||
u32 num_ops = 2U;
|
||||
u32 cfg2_vidmem = 0U, cfg3_sysmem = 0U;
|
||||
|
||||
/*
|
||||
* Read current value for ltc_ltcs_ltss_tstg_cfg(2,3)_r
|
||||
*/
|
||||
err = gr_gk20a_exec_ctx_ops(tsg, cfg_ops, num_ops, 0, num_ops, &flags);
|
||||
if (err != 0) {
|
||||
nvgpu_err(g, "failed to read ltcs_ltss_tstg_cfg(2,3)_r");
|
||||
goto fail;
|
||||
}
|
||||
cfg2_vidmem = cfg_ops[0].value_lo;
|
||||
cfg3_sysmem = cfg_ops[1].value_lo;
|
||||
|
||||
#define APPLY_SECTOR_PROMOTION_POLICY(cfg, unit, policy) \
|
||||
do { \
|
||||
switch (policy) { \
|
||||
case NVGPU_L2_SECTOR_PROMOTE_FLAG_NONE: \
|
||||
cfg = set_field(cfg, \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_m(), \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_f( \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_none_v() \
|
||||
)); \
|
||||
break; \
|
||||
case NVGPU_L2_SECTOR_PROMOTE_FLAG_64B: \
|
||||
cfg = set_field(cfg, \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_m(), \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_f( \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_64b_v() \
|
||||
)); \
|
||||
break; \
|
||||
case NVGPU_L2_SECTOR_PROMOTE_FLAG_128B: \
|
||||
cfg = set_field(cfg, \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_m(), \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_f( \
|
||||
ltc_ltcs_ltss_tstg_##cfg##_##unit##_promote_128b_v() \
|
||||
)); \
|
||||
break; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Update T1_PROMOTE and L1_PROMOTE fields of cfg2_vidmem and
|
||||
* cfg3_sysmem.
|
||||
*/
|
||||
APPLY_SECTOR_PROMOTION_POLICY(cfg2_vidmem, t1, policy);
|
||||
APPLY_SECTOR_PROMOTION_POLICY(cfg2_vidmem, l1, policy);
|
||||
APPLY_SECTOR_PROMOTION_POLICY(cfg3_sysmem, t1, policy);
|
||||
APPLY_SECTOR_PROMOTION_POLICY(cfg3_sysmem, l1, policy);
|
||||
|
||||
#undef APPLY_SECTOR_PROMOTION_POLICY
|
||||
|
||||
cfg_ops[0].op = REGOP(WRITE_32);
|
||||
cfg_ops[0].value_lo = cfg2_vidmem;
|
||||
cfg_ops[1].op = REGOP(WRITE_32);
|
||||
cfg_ops[1].value_lo = cfg3_sysmem;
|
||||
err = gr_gk20a_exec_ctx_ops(tsg, cfg_ops, num_ops, num_ops, 0, &flags);
|
||||
if (err != 0) {
|
||||
nvgpu_err(g, "failed to update ltcs_ltss_tstg_cfg(2,3)_r");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Readback and verify the write */
|
||||
cfg_ops[0].op = REGOP(READ_32);
|
||||
cfg_ops[0].value_lo = 0U;
|
||||
cfg_ops[1].op = REGOP(READ_32);
|
||||
cfg_ops[1].value_lo = 0U;
|
||||
err = gr_gk20a_exec_ctx_ops(tsg, cfg_ops, num_ops, 0, num_ops, &flags);
|
||||
if (err != 0) {
|
||||
nvgpu_err(g, "failed to read ltcs_ltss_tstg_cfg(2,3)_r");
|
||||
goto fail;
|
||||
}
|
||||
if (cfg2_vidmem != cfg_ops[0].value_lo || cfg3_sysmem != cfg_ops[1].value_lo) {
|
||||
nvgpu_err(g, "mismatch: cfg2: wrote(0x%x) read(0x%x)",
|
||||
cfg_ops[0].value_lo, cfg2_vidmem);
|
||||
nvgpu_err(g, " cfg3: wrote(0x%x) read(0x%x)",
|
||||
cfg_ops[1].value_lo, cfg3_sysmem);
|
||||
err = -EINVAL;
|
||||
}
|
||||
|
||||
fail:
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,6 +41,8 @@ struct gk20a;
|
||||
void ltc_tu104_init_fs_state(struct gk20a *g);
|
||||
#ifdef CONFIG_NVGPU_DEBUGGER
|
||||
u32 tu104_ltc_pri_is_lts_tstg_addr(struct gk20a *g, u32 addr);
|
||||
int tu104_set_l2_sector_promotion(struct gk20a *g, struct nvgpu_tsg *tsg,
|
||||
u32 policy);
|
||||
#endif
|
||||
|
||||
#endif /* LTC_TU104_H */
|
||||
|
||||
Reference in New Issue
Block a user