Skip to content
Merged

ECC #56

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ Then perform a reboot.
<tr>
<td>PCIe Gen 2 speeds</td>
<td>Working ✓</td>
</tr>
<tr>
<td>Error-Correcting Code (ECC) DRAM and SRAM </td>
<td>Working ✓</td>
</tr>
<tr>
<td>Full BAR1 Size (64GB)</td>
Expand Down
16 changes: 16 additions & 0 deletions common/constants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,19 @@ unlocks:
cmp-sku-mask:
patch: cmp-sku-mask.patch
registers: {}


ecc:
patch: ecc-enable.patch
registers:
feature_override_ecc: { addr: "0x0082380c", value: "0x00898888" }
ecc_control: { addr: "0x009a0470", value: "0x00000041" }
ltcg_dstcfg0: { addr: "0x0017e318", value: "0x00000001" }

ecc-fbpa-static:
patch: ecc-fbpa-static.patch
registers: {}

ecc-reporting:
patch: ecc-reporting.patch
registers: {}
3 changes: 3 additions & 0 deletions driver/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ PATCH_ORDER=(
name-string.patch
bar1-resize-unlock.patch
cmp-sku-mask.patch
ecc-enable.patch
ecc-fbpa-static.patch
ecc-reporting.patch
)
PATCH_FILES=()
for name in "${PATCH_ORDER[@]}"; do
Expand Down
39 changes: 39 additions & 0 deletions driver/patches/ecc-enable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
--- a/src/nvidia/src/kernel/gpu/gsp/kernel_gsp.c
+++ b/src/nvidia/src/kernel/gpu/gsp/kernel_gsp.c
@@ -5869,6 +5869,36 @@
PCIE_LINK_SPEED_OF(statAfter));
}

+ {
+ static const struct { NvU32 addr; NvU32 val; NvU32 isOr; } eccRcp[] = {
+ { 0x001fa7ccU, 0xffffffffU, 0U },
+ { 0x001fa7c8U, 0xffffffffU, 0U },
+ { 0x001fa7c0U, 0xffffffffU, 0U },
+ { 0x001fa7d0U, 0xffffffffU, 0U },
+ { 0x0082380cU, 0x00898888U, 0U },
+ { 0x009a0470U, 0x00000041U, 1U },
+ { 0x009a1004U, 0x00000200U, 1U },
+ { 0x009a033cU, 0x00000003U, 1U },
+ { 0x009a0084U, 0x00000001U, 1U },
+ { 0x0017e318U, 0x00000001U, 1U },
+ { 0x0017e21cU, 0x00000001U, 1U },
+ };
+ NvU32 eccI, eccV;
+ for (eccI = 0; eccI < NV_ARRAY_ELEMENTS(eccRcp); eccI++)
+ {
+ GPU_REG_WR32(pGpu, 0x001fa824U, 0xffffffffU);
+ GPU_REG_WR32(pGpu, 0x001fa828U, 0x00000000U);
+ eccV = eccRcp[eccI].isOr ? (GPU_REG_RD32(pGpu, eccRcp[eccI].addr) | eccRcp[eccI].val) : eccRcp[eccI].val;
+ (void) kgspSec2PostblTimingRefillPayload(pGpu, pKernelGsp, eccRcp[eccI].addr, eccV);
+ (void) kgspExecuteBooterLoad_HAL(pGpu, pKernelGsp,
+ memdescGetPhysAddr(SEC2_POSTBL_TIMING_WPR_META_DESC(pKernelGsp), AT_GPU, 0));
+ }
+ GPU_REG_WR32(pGpu, 0x001fa81cU, 0xffffffffU); GPU_REG_WR32(pGpu, 0x001fa820U, 0x00000000U);
+ GPU_REG_WR32(pGpu, 0x001fa824U, 0xffffffffU); GPU_REG_WR32(pGpu, 0x001fa828U, 0x00000000U);
+ GPU_REG_WR32(pGpu, 0x001fa804U, 0xffffffffU); GPU_REG_WR32(pGpu, 0x001fa808U, 0x00000000U);
+ GPU_REG_WR32(pGpu, 0x001fa82cU, 0xffffffffU); GPU_REG_WR32(pGpu, 0x001fa830U, 0x00000000U);
+ GPU_REG_WR32(pGpu, 0x001fa80cU, GPU_REG_RD32(pGpu, 0x001fa80cU) & ~0x10U);
+ }
plmStatus = kgspSec2PostblTimingRebuildStockSignature(pGpu, pKernelGsp);
if (plmStatus != NV_OK)
{
11 changes: 11 additions & 0 deletions driver/patches/ecc-fbpa-static.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/src/nvidia/src/kernel/gpu/mem_sys/kern_mem_sys.c
+++ b/src/nvidia/src/kernel/gpu/mem_sys/kern_mem_sys.c
@@ -131,6 +131,8 @@
pGpu, pKernelMemorySystem, pStaticConfig),
exit);

+ pStaticConfig->bEnabledEccFBPA = NV_TRUE;
+
exit:
if (status != NV_OK)
{
66 changes: 66 additions & 0 deletions driver/patches/ecc-reporting.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
--- a/src/nvidia/arch/nvalloc/unix/src/escape.c
+++ b/src/nvidia/arch/nvalloc/unix/src/escape.c
@@ -53,6 +53,7 @@
#include <ctrl/ctrl00fd.h>

#include <ctrl/ctrl00e0.h>
+#include <ctrl/ctrl2080/ctrl2080gpu.h>

#define NV_CTL_DEVICE_ONLY(nv) \
{ \
@@ -843,6 +844,55 @@

Nv04ControlWithSecInfo(pApi, secInfo);

+ if (pApi->cmd == 0x20800157U)
+ pApi->status = NV_OK;
+ else if (pApi->cmd == 0x2080014bU &&
+ pApi->paramsSize == sizeof(NV2080_CTRL_GPU_GET_INFOROM_OBJECT_VERSION_PARAMS) &&
+ NvP64_VALUE(pApi->params) != NULL)
+ {
+ NV2080_CTRL_GPU_GET_INFOROM_OBJECT_VERSION_PARAMS iv;
+ if (os_memcpy_from_user(&iv, NvP64_VALUE(pApi->params), sizeof(iv)) == NV_OK &&
+ iv.objectType[0] == 'E' && iv.objectType[1] == 'C' && iv.objectType[2] == 'C')
+ {
+ iv.version = 6; iv.subversion = 16;
+ if (os_memcpy_to_user(NvP64_VALUE(pApi->params), &iv, sizeof(iv)) == NV_OK)
+ pApi->status = NV_OK;
+ }
+ }
+ else if (pApi->cmd == 0x2080012fU &&
+ pApi->paramsSize == sizeof(NV2080_CTRL_GPU_QUERY_ECC_STATUS_PARAMS) &&
+ NvP64_VALUE(pApi->params) != NULL)
+ {
+ NV2080_CTRL_GPU_QUERY_ECC_STATUS_PARAMS *pEcc = portMemAllocNonPaged(sizeof(*pEcc));
+ if (pEcc != NULL)
+ {
+ NvU32 u; portMemSet(pEcc, 0, sizeof(*pEcc));
+ for (u = 0; u < NV2080_CTRL_GPU_ECC_UNIT_COUNT; u++)
+ {
+ pEcc->units[u].enabled = NV_TRUE;
+ pEcc->units[u].supported = NV_TRUE;
+ pEcc->units[u].scrubComplete = NV_TRUE;
+ }
+ if (os_memcpy_to_user(NvP64_VALUE(pApi->params), pEcc, sizeof(*pEcc)) == NV_OK)
+ pApi->status = NV_OK;
+ portMemFree(pEcc);
+ }
+ }
+ else if (pApi->cmd == 0x20800133U && pApi->paramsSize >= 8U &&
+ NvP64_VALUE(pApi->params) != NULL)
+ {
+ NvU32 cfg[2]; cfg[0] = 1U; cfg[1] = 1U;
+ if (os_memcpy_to_user(NvP64_VALUE(pApi->params), cfg, sizeof(cfg)) == NV_OK)
+ pApi->status = NV_OK;
+ }
+ else if (pApi->cmd == 0x20803406U && pApi->paramsSize >= 1U &&
+ NvP64_VALUE(pApi->params) != NULL)
+ {
+ NvU8 z = 0;
+ if (os_memcpy_to_user(NvP64_VALUE(pApi->params), &z, 1) == NV_OK)
+ pApi->status = NV_OK;
+ }
+
if ((pApi->status != NV_OK) && (priv != NULL))
{
//
Loading