From 79304047402eab26cd50c6a356d15c51f2e46850 Mon Sep 17 00:00:00 2001 From: Antony Clince Alex Date: Wed, 9 Dec 2020 21:58:42 +0530 Subject: [PATCH] gpu: nvgpu: update hwmp map to account for checksum entries Starting with nvgpu-next, the ctxsw ucode computes the checksum for each ctxsw'ed register list, this checksum is saved at the end of the same list; This entry will be given a special placeholder address 0x00ffffff, which can be used to distinguish it from other entries in the register list. There is only one checksum per list, even if it has multiple subunits. Hence, update "add_ctxsw_buffer_map_entries_subunits" to avoid adding checksum entires for each subunit within a list. Bug 2916121 Change-Id: Ia7abedc7467ae8158ce3e791a67765fb52889915 Signed-off-by: Antony Clince Alex Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2457579 Tested-by: mobile promotions Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Seshendra Gadagottu Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/common/gr/hwpm_map.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/common/gr/hwpm_map.c b/drivers/gpu/nvgpu/common/gr/hwpm_map.c index f6af4bbb3..aeb34d4d0 100644 --- a/drivers/gpu/nvgpu/common/gr/hwpm_map.c +++ b/drivers/gpu/nvgpu/common/gr/hwpm_map.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2019-2020, 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"), @@ -38,6 +38,9 @@ #define NV_PERF_PMMGPCROUTER_STRIDE 0x0200U #define NV_XBAR_MXBAR_PRI_GPC_GNIC_STRIDE 0x0020U +/* Dummy address for ctxsw'ed pri reg checksum. */ +#define CTXSW_PRI_CHECKSUM_DUMMY_REG 0x00ffffffU + int nvgpu_gr_hwpm_map_init(struct gk20a *g, struct nvgpu_gr_hwpm_map **hwpm_map, u32 size) { @@ -216,6 +219,22 @@ static int add_ctxsw_buffer_map_entries_subunits( (unit * stride); map[cnt++].offset = off; off += 4U; + + /* + * The ucode computes and saves the checksum of + * all ctxsw'ed register values within a list. + * Entries with addr=0x00ffffff are placeholder + * for these checksums. + * + * There is only one checksum for a list + * even if it contains multiple subunits. Hence, + * skip iterating over all subunits for this + * entry. + */ + if (regs->l[idx].addr == + CTXSW_PRI_CHECKSUM_DUMMY_REG) { + break; + } } } }