Fedora-ninjaAArch64

RAS Architecture AArch64

The Wiki page is just for logging the development of RAS architecture, and syncing with others developer of RAS function.

Resources

AArch64StandaloneMm on QEMU

Steps to build MM Standalone images

QEMU

* REPO and branch: https://git.linaro.org/people/fu.wei/qemu.git/log/?h=aarch64standalonemm

cd qemu
./configure --target-list=aarch64-softmmu --prefix=../qemu_install
make install

Firmware

REPO and branch

* ARM Trusted Firmware https://git.linaro.org/people/fu.wei/arm-trusted-firmware.git/log/?h=AArch64StandaloneMm_rfc_v2_qemu_del_mmd

* EDK2 https://git.linaro.org/people/fu.wei/uefi.git/log/?h=AArch64StandaloneMm_add_qemu_support

* uefi-tools https://git.linaro.org/people/fu.wei/uefi-tools.git/log/?h=AArch64StandaloneMm

tree -L 1
.
├── arm-trusted-firmware
├── qemu
├── qemu_install
├── uefi
├── uefi-tools
└── test

---

cd uefi
../uefi-tools/uefi-build.sh -b DEBUG qemu64_mm_standalone
../uefi-tools/uefi-build.sh -a ../arm-trusted-firmware -b DEBUG qemu64_kernel_mm_normal

BL1=arm-trusted-firmware/build/qemu/debug/bl1.bin
BL2=arm-trusted-firmware/build/qemu/debug/bl2.bin
BL31=arm-trusted-firmware/build/qemu/debug/bl31.bin
BL32=uefi/Build/StandaloneSmmPkg/DEBUG_GCC5/FV/STANDALONESMM.fd
BL33=uefi/Build/ArmVirtQemuKernel-AARCH64/DEBUG_GCC5/FV/QEMU_EFI.fd
UEFIINFO_EFI=uefi/Build/ArmVirtQemuKernel-AARCH64/DEBUG_GCC5/AARCH64/UefiInfo.efi

cd -
mv $BL1 $BL2 $BL31 test/
mv $BL32  test/bl32.bin
mv $BL33  test/bl33.bin

* Please get a image file which can boot qemu like vexpress64-leg-sd.img * cp $UEFIINFO_EFI into the EFI partition of vexpress64-leg-sd.img

Run the test

cd test 
../qemu_install/bin/qemu-system-aarch64 \
-cpu cortex-a57  -smp 2  -m 2048  \
-machine virt,secure=on,virtualization=on \
-nographic  -bios ./bl1.bin \
-drive if=none,file=./vexpress64-leg-sd.img,id=vda,cache=writeback \
-device virtio-blk-device,drive=vda \
-serial telnet:localhost:7000,server \
-serial telnet:localhost:7001,server \
-serial telnet:localhost:7002,server  \
-d unimp -semihosting-config enable,target=native             

* main console telnet localhost 7000

* Secure UART 1 telnet localhost 7001

* Secure UART 2 telnet localhost 7002

* main console

Shell> FS0: 
FS0:\> UefiInfo.efi
FSOpen: Open '\UefiInfo.efi'
FSOpen: Open '\UefiInfo.efi'
FSOpen: Open '\UefiInfo.efi'
[Security] 3rd party image[0] can be loaded after EndOfDxe: VenHw(837DCA9E-E874-4D82-B29A-23FE0E23D1E2,003E000A00000000)/HD(1,MBR,0x00000000,0x3F,0x21FC0)/\UefiInfo.efi.
InstallProtocolInterface: 5B1B31A1-9562-11D2-8E3F-00A0C969723B B9336040
add-symbol-file /home/tekkamanninja/development/Tekkaman_SDK/build/tmpfs/uefi/Build/ArmVirtQemuKernel-AARCH64/DEBUG_GCC5/AARCH64/MdeModulePkg/Application/UefiInfoApp/UefiInfo/DEBUG/UefiInfo.dll  0xB8B50000 
Loading driver at 0x000B8B4F000 EntryPoint=0x000B8B50000 UefiInfo.efi
InstallProtocolInterface: BC62157E-3E33-4FEC-9920-2D3B36D750DF B9336E98
ProtectUefiImageCommon - 0xB9336040
   - 0x00000000B8B4F000 - 0x0000000000009000
SetUefiImageMemoryAttributes - 0x00000000B8B4F000 - 0x0000000000001000 (0x0000000000004008) 
SetUefiImageMemoryAttributes - 0x00000000B8B50000 - 0x0000000000006000 (0x0000000000020008)
SetUefiImageMemoryAttributes - 0x00000000B8B56000 - 0x0000000000002000 (0x0000000000004008) 
InstallProtocolInterface: 752F3136-4E16-4FDC-A22A-E5F46812F4CA BFFFF700
SmmIplNotifyUefiInfo 
MmCommunicationCommunicate Communicate Enter - 0xBFFFF590
0x40010000 - 0xBFFFF590 - 0x20
ARM_SMC_ID_MM_COMMUNICATE_AARCH64 0xC4000041 - 0x40010000 - 0x0 
SetUefiImageMemoryAttributes - 0x00000000B8B4F000 - 0x0000000000009000 (0x0000000000000008) 
remove-symbol-file /home/tekkamanninja/development/Tekkaman_SDK/build/tmpfs/uefi_AArch64StandaloneMm_ras/Build/ArmVirtQemuKernel-AARCH64/DEBUG_GCC5/AARCH64/MdeModulePkg/Application/UefiInfoApp/UefiInfo/DEBUG/UefiInfo.dll 0xB8B50000

* Secure UART 2

Trying ::1...
Connected to localhost.
Escape character is '^]'.
NumSpMemRegions - 0x6
SpMemBase       - 0xE100000
SpMemLimit      - 0xF000000
SpImageBase     - 0xE100000
SpStackBase     - 0xE500000
SpHeapBase      - 0xE510000
SpNsCommBufBase - 0x40010000
SpSharedBufBase - 0xE400000
SpImageSize     - 0x300000
SpPcpuStackSize - 0x2000
SpHeapSize      - 0xAF0000
SpNsCommBufSize - 0x10000
SpPcpuSharedBufSize - 0x20000
NumCpus         - 0x8
CpuInfo         - 0xE400680
Mpidr           - 0x80000000
LinearId        - 0x0
Flags           - 0x1
Mpidr           - 0x80000001
LinearId        - 0x1
Flags           - 0x0
Mpidr           - 0x80000002
LinearId        - 0x2
Flags           - 0x0
Mpidr           - 0x80000003
LinearId        - 0x3
Flags           - 0x0
Mpidr           - 0x80000100
LinearId        - 0x4
Flags           - 0x0
Mpidr           - 0x80000101
LinearId        - 0x5
Flags           - 0x0
Mpidr           - 0x80000102
LinearId        - 0x6
Flags           - 0x0
Mpidr           - 0x80000103
LinearId        - 0x7
Flags           - 0x0
Found Standalone MM PE data - 0xE101000
Found Standalone MM PE data - 0xE101000
Standalone MM Core PE-COFF SectionHeaderOffset - 0xF60, NumberOfSections - 3
UpdateMmFoundationPeCoffPermissions: Section 0 of image at 0xE101000 has 0x60000020 permissions
UpdateMmFoundationPeCoffPermissions: Section 0 of image at 0xE101000 has .et name
UpdateMmFoundationPeCoffPermissions: Section 0 of image at 0xE101000 has 0xE102000 address
UpdateMmFoundationPeCoffPermissions: Section 0 of image at 0xE101000 has 0x1000 data
UpdateMmFoundationPeCoffPermissions: Ignoring section 0 of image at 0xE101000 with 0x60000020 permissions
UpdateMmFoundationPeCoffPermissions: Section 1 of image at 0xE101000 has 0xC0000040 permissions
UpdateMmFoundationPeCoffPermissions: Section 1 of image at 0xE101000 has .aa name
UpdateMmFoundationPeCoffPermissions: Section 1 of image at 0xE101000 has 0xE119000 address
UpdateMmFoundationPeCoffPermissions: Section 1 of image at 0xE101000 has 0x18000 data
UpdateMmFoundationPeCoffPermissions: Mapping section 1 of image at 0xE101000 with RW-XN permissions
UpdateMmFoundationPeCoffPermissions: Section 2 of image at 0xE101000 has 0x42000040 permissions
UpdateMmFoundationPeCoffPermissions: Section 2 of image at 0xE101000 has .eo name
UpdateMmFoundationPeCoffPermissions: Section 2 of image at 0xE101000 has 0xE11A000 address
UpdateMmFoundationPeCoffPermissions: Section 2 of image at 0xE101000 has 0x19000 data
UpdateMmFoundationPeCoffPermissions: Mapping section 2 of image at 0xE101000 with RO-XN permissions
StandaloneSmmCoreMemoryAllocationLibConstructor - 0xE510000
SmramRangeCount - 0x6
SmramRanges[0]: 0x000000000E100000 - 0x0000000000300000
SmramRanges[1]: 0x000000000E400000 - 0x0000000000100000
SmramRanges[2]: 0x0000000040010000 - 0x0000000000010000
SmramRanges[3]: 0x000000000E500000 - 0x0000000000010000
SmramRanges[4]: 0x000000000E510000 - 0x00000000000002C8
SmramRanges[5]: 0x000000000E5102C8 - 0x0000000000AEFD38
SmmInitializeMemoryServices
SmmAddMemoryRegion 0 : 0x000000000E100000 - 0x0000000000300000
SmmAddMemoryRegion 1 : 0x000000000E400000 - 0x0000000000100000
SmmAddMemoryRegion 2 : 0x0000000040010000 - 0x0000000000010000
SmmAddMemoryRegion 3 : 0x000000000E500000 - 0x0000000000010000
SmmAddMemoryRegion 4 : 0x000000000E510000 - 0x00000000000002C8
SmmAddMemoryRegion 5 : 0x000000000E5102C8 - 0x0000000000AEFD38
mSmmMemLibInternalMaximumSupportAddress = 0xFFFFFFFFF
SmmMain - 0xE510000
SmramRangeCount - 0x6
SmramRanges[0]: 0x000000000E100000 - 0x300000
SmramRanges[1]: 0x000000000E400000 - 0x100000
SmramRanges[2]: 0x0000000040010000 - 0x10000
SmramRanges[3]: 0x000000000E500000 - 0x10000
SmramRanges[4]: 0x000000000E510000 - 0x2C8
SmramRanges[5]: 0x000000000E5102C8 - 0xAEFD38
mSmramRangeCount - 0x6
mSmramRanges - 0xEFFEE10
BFV address - 0xE100000
BFV size    - 0x300000
SmmInstallConfigurationTable For HobList
HobSize - 0x2C8
SmmHobStart - 0xEFFE810
SmmInstallProtocolInterface - gEfiMmHandlerStateNotificationProtocolGuid
SmmInstallProtocolInterface: 30C8340F-4C30-41D9-BFAE-444ACB2C1F76 E119218
SmmRegisterProtocolNotify - SmmConfigurationSmmProtocol
MmRegisterProtocolNotify - MmConfigurationMmProtocol
Smm Dispatch StandaloneBfvAddress - 0x0E100000
SmmCoreFfsFindSmmDriver - 0xE100000
FvIsBeingProcesssed - 0x0E100000
Check SmmFileTypes - 0xA
Check SmmFileTypes - 0xE
Find PE data - 0xE11B024
SmmAddToDriverList - 58F7A62B-6280-42A7-BC38-10535A64A92C (0x0E11B024)
SmmDispatcher
  Drain the Scheduled Queue
  Search DriverList for items to place on Scheduled Queue
  DriverEntry (Discovered) - 58F7A62B-6280-42A7-BC38-10535A64A92C
Evaluate SMM DEPEX for FFS(58F7A62B-6280-42A7-BC38-10535A64A92C)
  TRUE
  END
  RESULT = TRUE
  Drain the Scheduled Queue
  DriverEntry (Scheduled) - 58F7A62B-6280-42A7-BC38-10535A64A92C
SmmLoadImage - 58F7A62B-6280-42A7-BC38-10535A64A92C
UpdatePeCoffPermissions: Mapping section 0 of image at 0xEFE7000 with RO-XN permissions and size 0x7000
UpdatePeCoffPermissions: Mapping section 0 of image at 0xEFE7000 with RO-X permissions and size 0x7000
UpdatePeCoffPermissions: Mapping section 1 of image at 0xEFEE000 with RW-XN permissions and size 0x1000
UpdatePeCoffPermissions: Mapping section 2 of image at 0xEFEF000 with RO-XN permissions and size 0x1000
Loading SMM driver at 0x0000EFE6000 EntryPoint=0x0000EFE7000 PiMmStandloneArmTfCpuDriver.efi
StartImage - 0xEFE7000 (Standalone Mode)
SmmInstallProtocolInterface: 0C109319-C149-450E-A3E3-B9BADD9DC3A4 EFEE008
MmConfigurationMmNotify(0C109319-C149-450E-A3E3-B9BADD9DC3A4) - EFEE008
MM Core registered MM Entry Point address E104D90
SmmInstallProtocolInterface: EB346B97-975F-4A9F-8B22-F8E92BB3D569 EFEE010
Sharing Cpu Driver EP *0xE1192C0 = 0xEFE7A84
mNsCommBuffer.PhysicalStart - 0x40010000
mNsCommBuffer.PhysicalSize - 0x10000
mNsCommBuffer: 0x0000000040010000 - 0x10000
mMpInformationHobData: 0x0000000000000008 - 0x8
mMpInformationHobData[0x80000000]: 0, 0, 0
mMpInformationHobData[0x80000001]: 0, 1, 1
mMpInformationHobData[0x80000002]: 0, 2, 2
mMpInformationHobData[0x80000003]: 0, 3, 3
mMpInformationHobData[0x80000100]: 1, 0, 0
mMpInformationHobData[0x80000101]: 1, 1, 1
mMpInformationHobData[0x80000102]: 1, 2, 2
mMpInformationHobData[0x80000103]: 1, 3, 3
SmiHandlerRegister - GUID A37721E4-8C0B-4BCA-B5E8-E902A025514E - Status 0
SmiHandlerRegister - GUID B65694CC-09E3-4C3B-B5CD-05F44D3CDBFF - Status 0
SmiHandlerRegister - GUID 7081E22F-CAC6-4053-9468-675782CF88E5 - Status 0
SmiHandlerRegister - GUID 60FF8964-E906-41D0-AFED-F241E974E08E - Status 0
SmiHandlerRegister - GUID 02CE967A-DD7E-4FFC-9EE7-810CF0470880 - Status 0
SmiHandlerRegister - GUID 2A571201-4966-47F6-8B86-F31E41F32F10 - Status 0
SmiHandlerRegister - GUID 27ABF055-B1B8-4C26-8048-748F37BAA2DF - Status 0
SmiHandlerRegister - GUID 7CE88FB3-4BD7-4679-87A8-A8D8DEE50D2B - Status 0
SmmMain Done!
Shared Cpu Driver EP 0xEFE7A84
Received delegated event
X0 :  0xC4000041
X1 :  0x40010000
X2 :  0x0
X3 :  0x0
Received event - 0xC4000041 on cpu 0
SmmEntryPoint ...
CommBuffer - 0xEFFBA50, CommBufferSize - 0x20
SmmUefiInfoHandler
  SystemTable - 0x00000000BBFD0018
SmmInstallProtocolInterface: A37721E4-8C0B-4BCA-B5E8-E902A025514E BBFD0018
SmmEntryPoint Done

RAS architecture

LEG/ServerArchitecture/RAS (last modified 2017-08-27 00:32:26)