Implement the First SMI Handler for hot-added CPUs, in NASM. Add the interfacing C-language function that the SMM Monarch calls. This function launches and coordinates SMBASE relocation for a hot-added CPU. Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Igor Mammedov <imammedo@redhat.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Michael Kinney <michael.d.kinney@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1512 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20200226221156.29589-13-lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /** @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_
 |