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