summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/CpuHotplugSmm/FirstSmiHandlerContext.h
blob: 6039532fd8a4f8ea28bf764bb9825f0adec08f67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/** @file
  Define the FIRST_SMI_HANDLER_CONTEXT structure, which is an exchange area
  between the SMM Monarch and the hot-added CPU, for relocating the SMBASE of
  the hot-added CPU.

  Copyright (c) 2020, Red Hat, Inc.

  SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef FIRST_SMI_HANDLER_CONTEXT_H_
#define FIRST_SMI_HANDLER_CONTEXT_H_

//
// The following structure is used to communicate between the SMM Monarch
// (running the root MMI handler) and the hot-added CPU (handling its first
// SMI). It is placed at SMM_DEFAULT_SMBASE, which is in SMRAM under QEMU's
// "SMRAM at default SMBASE" feature.
//
#pragma pack (1)
typedef struct {
  //
  // When ApicIdGate is MAX_UINT64, then no hot-added CPU may proceed with
  // SMBASE relocation.
  //
  // Otherwise, the hot-added CPU whose APIC ID equals ApicIdGate may proceed
  // with SMBASE relocation.
  //
  // This field is intentionally wider than APIC_ID (UINT32) because we need a
  // "gate locked" value that is different from all possible APIC_IDs.
  //
  UINT64    ApicIdGate;
  //
  // The new SMBASE value for the hot-added CPU to set in the SMRAM Save State
  // Map, before leaving SMM with the RSM instruction.
  //
  UINT32    NewSmbase;
  //
  // The hot-added CPU sets this field to 1 right before executing the RSM
  // instruction. This tells the SMM Monarch to proceed to polling the last
  // byte of the normal RAM reserved page (Post-SMM Pen).
  //
  UINT8     AboutToLeaveSmm;
} FIRST_SMI_HANDLER_CONTEXT;
#pragma pack ()

#endif // FIRST_SMI_HANDLER_CONTEXT_H_