MdeModulePkg/Variable: Init var policy after SMM variable is ready #1269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This series is going to edk2 but it is being made available in parallel to Project Mu since the edk2 202502 soft freeze began today. The plan is to not backport this Mu series but keep in the "dev" branch. Once the changes are in edk2, we can pull this into the next Mu release branch if we'd like.
On a MM system, the main UEFI variable logic resides in MMRAM. In that case, the variable policy logic in
VarCheckPolicyLib
, such asVarCheckPolicyLibStandaloneMm
is linked against the MM driver also in that caseVariableStandaloneMm
.The MM variable driver indicates its presence to the RT DXE driver via
gEfiSmmVariableProtocolGuid
to indicate variable read support is available from MM. This triggers installation of the variable architectural protocol in DXE.Today, variable policy is initialized by calling
VariablePolicySmmDxeMain()
inVariableSmmRuntimeInitialize()
. In turn, this installsgEdkiiVariablePolicyProtocolGuid
. Functions ingEdkiiVariablePolicyProtocolGuid
may trigger MMIs. However, it is possible that the MM variable driver which is linked against the code with the variable policy MMI handlers (i.e.VarCheckPolicyLib
) is not loaded yet.Therefore, this change moves invocation of
VariablePolicySmmDxeMain()
toSmmVariableReady()
which is called on installation ofgEfiSmmVariableProtocolGuid
indicating variable MM services are ready.gEdkiiVariablePolicyProtocolGuid
is still installed prior to the variable architectural protocol being installed.How This Was Tested
VariablePolicySmmDxeMain()
is correct.Integration Instructions
N/A - Some drivers may dispatch differently if they depend on
gEdkiiVariablePolicyProtocolGuid
. However, this is not considered breaking as that is an inherent expectation in dispatch based on dependency expressions.