Skip to content

Commit

Permalink
Skip SKU limit check if needed PCD data is missing. SKU limit remains…
Browse files Browse the repository at this point in the history
… enforced by UEFI FW.

Signed-off-by: Sydney Young <[email protected]>
  • Loading branch information
Sydney Young authored and gldiviney committed Jun 28, 2019
1 parent 67172c5 commit 9afba64
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions DcpmPkg/driver/Core/Region.c
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ VerifyCreatingSupportedRegionConfigs(
}
}
}

NVDIMM_DBG("Configured dimms count: %d, Unconfigured dimms count: %d", SpecifiedConfiguredDimmsNum, SpecifiedUnconfiguredDimmsNum);
/**
If any DIMM is specified for a given socket then:
- all unconfigured DIMMs have to be specified
Expand Down Expand Up @@ -2835,7 +2835,7 @@ ReduceCapacityForSocketSKU(
{
EFI_STATUS ReturnCode = EFI_INVALID_PARAMETER;
BOOLEAN WholeSocket = FALSE;
UINT64 TotalRequestedMemoryOnSocket = 0;
UINT64 TotalRequestedMemoryOnSocket = 0;
SOCKET_SKU_INFO_TABLE *pSocketSkuInfoTable;
BOOLEAN CurrentConfigurationMemoryMode = FALSE;
BOOLEAN NewConfigurationMemoryMode = FALSE;
Expand Down Expand Up @@ -2879,14 +2879,20 @@ ReduceCapacityForSocketSKU(
goto Finish;
}

// Determine if socket has any MemoryMode mapped currently from CCUR tables
LIST_FOR_EACH(pDimmNode, &gNvmDimmData->PMEMDev.Dimms) {
pDimm = DIMM_FROM_NODE(pDimmNode);

// Determine if socket has any MemoryMode mapped currently from CCUR tables
if (Socket == pDimm->SocketId && IsDimmManageable(pDimm) && pDimm->MappedVolatileCapacity > 0) {
CurrentConfigurationMemoryMode = TRUE;
break;
}

// If any DIMM config is undefined, SKU limiting calculations cannot be executed. Skip SKU limitation
if (DIMM_CONFIG_UNDEFINED == pDimm->ConfigStatus) {
ReturnCode = EFI_SUCCESS;
goto Finish;
}
}

// MemoryMode only exists on symmetrical dimms objects
Expand Down Expand Up @@ -2930,16 +2936,14 @@ ReduceCapacityForSocketSKU(

// Add in what is currently mapped and take out old AD to get the amount of 1LM VM
TotalRequestedMemoryOnSocket += pSocketSkuInfoTable->TotalMemorySizeMappedToSpa;

for (Index = 0; Index < NumDimmsOnSocket; Index++) {
if (TRUE == pDimmsOnSocket[Index]->Configured) {
if (TotalRequestedMemoryOnSocket < pDimmsOnSocket[Index]->MappedPersistentCapacity) {
NVDIMM_DBG("Mapping negative capacity");
ResetCmdStatus(pCommandStatus, NVM_ERR_OPERATION_FAILED);
ReturnCode = EFI_UNSUPPORTED;
goto Finish;
NVDIMM_DBG("Mapping negative capacity");
ResetCmdStatus(pCommandStatus, NVM_ERR_OPERATION_FAILED);
ReturnCode = EFI_UNSUPPORTED;
goto Finish;
}

TotalRequestedMemoryOnSocket -= pDimmsOnSocket[Index]->MappedPersistentCapacity;
}
}
Expand Down Expand Up @@ -2973,15 +2977,17 @@ ReduceCapacityForSocketSKU(
pDimm = DIMM_FROM_NODE(pDimmNode);

if (Socket == pDimm->SocketId && pDimm->Configured && IsDimmManageable(pDimm)) {
NVDIMM_DBG("TotalRequestedMemoryOnSocket: %X", TotalRequestedMemoryOnSocket);
TotalRequestedMemoryOnSocket += pDimm->MappedPersistentCapacity;
TotalRequestedMemoryOnSocket += pDimm->MappedVolatileCapacity;
}
}
}

NVDIMM_DBG("TotalRequestedMemoryOnSocket: %llX", TotalRequestedMemoryOnSocket);
NVDIMM_DBG("Memory Size Limit: %llX", pSocketSkuInfoTable->MappedMemorySizeLimit);
// Reduce capacity on socket if larger than the amount we can map.
if (TotalRequestedMemoryOnSocket > pSocketSkuInfoTable->MappedMemorySizeLimit) {

NVDIMM_DBG("TotalRequestedMemoryOnSocket: %llX", TotalRequestedMemoryOnSocket);
SetObjStatus(pCommandStatus, Socket, NULL, 0, NVM_WARN_MAPPED_MEM_REDUCED_DUE_TO_CPU_SKU);

ReduceCapacity = TotalRequestedMemoryOnSocket - pSocketSkuInfoTable->MappedMemorySizeLimit;
Expand Down

0 comments on commit 9afba64

Please sign in to comment.