FirstSmiHandlerContext.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /** @file
  2. Define the FIRST_SMI_HANDLER_CONTEXT structure, which is an exchange area
  3. between the SMM Monarch and the hot-added CPU, for relocating the SMBASE of
  4. the hot-added CPU.
  5. Copyright (c) 2020, Red Hat, Inc.
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #ifndef FIRST_SMI_HANDLER_CONTEXT_H_
  9. #define FIRST_SMI_HANDLER_CONTEXT_H_
  10. //
  11. // The following structure is used to communicate between the SMM Monarch
  12. // (running the root MMI handler) and the hot-added CPU (handling its first
  13. // SMI). It is placed at SMM_DEFAULT_SMBASE, which is in SMRAM under QEMU's
  14. // "SMRAM at default SMBASE" feature.
  15. //
  16. #pragma pack (1)
  17. typedef struct {
  18. //
  19. // When ApicIdGate is MAX_UINT64, then no hot-added CPU may proceed with
  20. // SMBASE relocation.
  21. //
  22. // Otherwise, the hot-added CPU whose APIC ID equals ApicIdGate may proceed
  23. // with SMBASE relocation.
  24. //
  25. // This field is intentionally wider than APIC_ID (UINT32) because we need a
  26. // "gate locked" value that is different from all possible APIC_IDs.
  27. //
  28. UINT64 ApicIdGate;
  29. //
  30. // The new SMBASE value for the hot-added CPU to set in the SMRAM Save State
  31. // Map, before leaving SMM with the RSM instruction.
  32. //
  33. UINT32 NewSmbase;
  34. //
  35. // The hot-added CPU sets this field to 1 right before executing the RSM
  36. // instruction. This tells the SMM Monarch to proceed to polling the last
  37. // byte of the normal RAM reserved page (Post-SMM Pen).
  38. //
  39. UINT8 AboutToLeaveSmm;
  40. } FIRST_SMI_HANDLER_CONTEXT;
  41. #pragma pack ()
  42. #endif // FIRST_SMI_HANDLER_CONTEXT_H_