Changeset 105670 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Sec
- Timestamp:
- Aug 14, 2024 1:16:30 PM (6 months ago)
- svn:sync-xref-src-repo-rev:
- 164367
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-159268 /vendor/edk2/current 103735-103757,103769-103776,129194-164365
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Sec/AmdSev.c
r99404 r105670 9 9 10 10 #include <Library/BaseLib.h> 11 #include <Library/CpuLib.h> 12 #include <Library/CpuPageTableLib.h> 11 13 #include <Library/DebugLib.h> 14 #include <Library/LocalApicLib.h> 12 15 #include <Library/MemEncryptSevLib.h> 13 16 #include <Library/BaseMemoryLib.h> … … 302 305 } 303 306 } 307 308 /** 309 Map known MMIO regions unencrypted if SEV-ES is active. 310 311 During early booting, page table entries default to having the encryption bit 312 set for SEV-ES/SEV-SNP guests. In cases where there is MMIO to an address, the 313 encryption bit should be cleared. Clear it here for any known MMIO accesses 314 during SEC, which is currently just the APIC base address. 315 316 **/ 317 VOID 318 SecMapApicBaseUnencrypted ( 319 VOID 320 ) 321 { 322 PHYSICAL_ADDRESS Cr3; 323 UINT64 ApicAddress; 324 VOID *Buffer; 325 UINTN BufferSize; 326 IA32_MAP_ATTRIBUTE MapAttribute; 327 IA32_MAP_ATTRIBUTE MapMask; 328 RETURN_STATUS Status; 329 330 if (!SevEsIsEnabled ()) { 331 return; 332 } 333 334 ApicAddress = (UINT64)GetLocalApicBaseAddress (); 335 Buffer = (VOID *)(UINTN)FixedPcdGet32 (PcdOvmfSecApicPageTableBase); 336 Cr3 = AsmReadCr3 (); 337 338 MapAttribute.Uint64 = ApicAddress; 339 MapAttribute.Bits.Present = 1; 340 MapAttribute.Bits.ReadWrite = 1; 341 MapMask.Uint64 = MAX_UINT64; 342 BufferSize = SIZE_4KB; 343 344 Status = PageTableMap ( 345 (UINTN *)&Cr3, 346 Paging4Level, 347 Buffer, 348 &BufferSize, 349 ApicAddress, 350 SIZE_4KB, 351 &MapAttribute, 352 &MapMask, 353 NULL 354 ); 355 if (RETURN_ERROR (Status)) { 356 DEBUG ((DEBUG_ERROR, "Failed to map APIC MMIO region as unencrypted: %d\n", Status)); 357 ASSERT (FALSE); 358 } 359 360 CpuFlushTlb (); 361 } -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Sec/AmdSev.h
r99404 r105670 92 92 ); 93 93 94 /** 95 Map MMIO regions unencrypted if SEV-ES is active. 96 97 During early booting, page table entries default to having the encryption bit 98 set for SEV-ES/SEV-SNP guests. In cases where there is MMIO to an address, the 99 encryption bit should be cleared. Clear it here for any known MMIO accesses 100 during SEC, which is currently just the APIC base address. 101 102 **/ 103 VOID 104 SecMapApicBaseUnencrypted ( 105 VOID 106 ); 107 94 108 #endif -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Sec/SecMain.c
r101291 r105670 12 12 #include <PiPei.h> 13 13 14 #include <Library/PeimEntryPoint.h>15 14 #include <Library/BaseLib.h> 16 15 #include <Library/DebugLib.h> … … 845 844 } 846 845 847 ProcessLibraryConstructorList ( NULL, NULL);846 ProcessLibraryConstructorList (); 848 847 849 848 if (!SevEsIsEnabled ()) { … … 940 939 // enabled. 941 940 // 941 SecMapApicBaseUnencrypted (); 942 942 InitializeApicTimer (0, MAX_UINT32, TRUE, 5); 943 943 DisableApicTimerInterrupt (); -
trunk/src/VBox/Devices/EFI/FirmwareNew/OvmfPkg/Sec/SecMain.inf
r101291 r105670 9 9 10 10 [Defines] 11 INF_VERSION = 0x0001000511 INF_VERSION = 1.30 12 12 BASE_NAME = SecMain 13 13 FILE_GUID = df1ccef6-f301-4a63-9661-fc6030dcc880 … … 56 56 CpuExceptionHandlerLib 57 57 CcProbeLib 58 CpuPageTableLib 58 59 59 60 [Ppis] … … 84 85 gUefiOvmfPkgTokenSpaceGuid.PcdTdxAcceptPageSize 85 86 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfWorkAreaBase 87 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecApicPageTableBase 88 gUefiOvmfPkgTokenSpaceGuid.PcdOvmfSecApicPageTableSize 86 89 87 90 [FeaturePcd]
Note:
See TracChangeset
for help on using the changeset viewer.