On 07/08/14 22:57, Peter Maydell wrote: > On 8 July 2014 21:13, Laszlo Ersek <[email protected]> wrote: >> It's not immediately obvious which "branch" of your porting guide (ie. >> "edk2 from cold boot" vs. "edk2 as 2nd stage boot loader") to pick, >> because the design of the virtual board (== qemu-system-aarch64 -M virt) >> is not final yet (as I understand). >> >> Currently two flash chips appear to be preferred (one for the variable >> store, the other one for the firmware binary). In addition, I think at >> this point it would be best to minimize the "moving parts" (ie. the >> number of independent projects one has to rely on). >> >> I would opt for Case 1, ie. "EDK2 from cold boot". > > That initially made sense to me, because you're not going to have > any other bootloader starting in front of you. However, ArmPlatformPkg.txt > says: > > # When to use PrePi or PrePeiCore ? > - PrePi: when the memory has already been initialized by the first > stage boot loader > - PrePeiCore: when the firmware is started from XIP memory and > in Secure world. The PeiCore shadows the firmware itself in > System Memory (DRAM) > > and for QEMU we have an odd mix between the two cases: > * there's no action needed to initialize DRAM [like PrePi] > * we don't start in Secure World [like PrePi] > * we are the first thing started at boot [like PrePeiCore] > * we start from XIP ROM, not DRAM [like PrePeiCore] > > Both the diagrams on the wiki assume the CPU has TrustZone > support -- for running under QEMU/KVM you should effectively > assume you do not have TrustZone, because KVM only supports > virtualizing Normal World code. (There is a use case for a UEFI > blob that does start in TrustZone, for use under TCG emulation, > where you want to emulate a system with a complete trusted > execution environment, but that can come later, especially > since TCG doesn't yet actually emulate TZ...) > > Maybe PrePeiCore is more configurable than the wiki > diagram and FAQ imply?
Initializing DRAM by "doing nothing" should work I guess, but indeed the other difference, Secure World, is worrying (especially for /me who only guesses that Secure World is just a distinguished address range with special access restrictions for code that is running from it?...) > >> Looking at the porting steps for Case 1: >> >> - How should we set PcdTrustzoneSupport? > > False, I would suggest. Right, that's what I thought, but the Case 1 diagram didn't seem to allow that, as you said too. Also PcdTrustzoneSupport is not mentioned in the porting steps. >> - Re 4. "Define the Secure / Monitor / Normal Stacks positions": >> >> I think we could hardcode those the Secure and Normal stack >> positions (QEMU would always provide RAM at those addresses). >> We'd let the Monitor stack alias the Secure stack (although that only >> seems to matter if PcdTrustzoneSupport is TRUE). > > Yeah, you don't have a secure stack or a monitor stack If that's the case then it's great. I couldn't derive this from the edk2 code. I tried to see if PcdTrustzoneSupport==FALSE implied that the secure & monitor stack PCDs are *never* accessed, but it got too complex. (Grepping for "PcdTrustzoneSupport" is simple, but eg. "PcdCPUCoresSecStackBase" seems to be contained in TrustZone-independent library code too (ArmPlatformPkg/Library/ArmPlatformGlobalVariableLib).) > (though I imagine that if you had TZ support then having them > aliased would be a bad idea, since otherwise you'd trash the > secure stack as soon as you took an exception to monitor mode.) The aliasing is not my idea, I just suggested it for simplicity, based on what I saw in CEntryPoint() in ArmPlatformPkg/Sec/Sec.c: https://github.com/tianocore/edk2/blob/4d4deaac/ArmPlatformPkg/Sec/Sec.c#L96 Anyway hopefully it won't matter. Olivier, can you please help with further hints? Thanks, Laszlo ------------------------------------------------------------------------------ Open source business process management suite built on Java and Eclipse Turn processes into business applications with Bonita BPM Community Edition Quickly connect people, data, and systems into organized workflows Winner of BOSSIE, CODIE, OW2 and Gartner awards http://p.sf.net/sfu/Bonitasoft _______________________________________________ edk2-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/edk2-devel
