Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MdeModulePkg/Variable: Init var policy after SMM variable is ready (#…
…1269) ## Description On a MM system, the main UEFI variable logic resides in MMRAM. In that case, the variable policy logic in `VarCheckPolicyLib`, such as `VarCheckPolicyLibStandaloneMm` is linked against the MM driver also in that case `VariableStandaloneMm`. 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()` in `VariableSmmRuntimeInitialize()`. In turn, this installs `gEdkiiVariablePolicyProtocolGuid`. Functions in `gEdkiiVariablePolicyProtocolGuid` 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()` to `SmmVariableReady()` which is called on installation of `gEfiSmmVariableProtocolGuid` indicating variable MM services are ready. `gEdkiiVariablePolicyProtocolGuid` is still installed prior to the variable architectural protocol being installed. - [x] Impacts functionality? - [ ] Impacts security? - [ ] Breaking change? - [ ] Includes tests? - [ ] Includes documentation? - [ ] Backport to release branch? ## How This Was Tested - Verify variable policy is initialized as expected on QEMU Q35/SBSA and a physical Intel system. - Check that the variable image handle passed to `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. Signed-off-by: Michael Kubacki <[email protected]>
- Loading branch information