3 The main memory on computer platforms in high security environments contains
4 sensible data. On unexpected reboot the data might persist and could be
5 read by a malicious application in the bootflow or userspace.
7 In order to prevent leaking information from pre-reset, the boot firmware can
8 clear the main system memory on boot, wiping all information.
10 A common API indicates if the main memory has to be cleared. That could be
11 on user request or by a Trusted Execution Environment indicating that secrets
14 As every platform has different bring-up mechanisms and memory-layouts, every
15 The device must indicate support for memory clearing as part of the boot
20 1. The platform must clear all platform memory (DRAM) if requested
21 2. Code that is placed in DRAM might be skipped (as workaround)
22 3. Stack that is placed in DRAM might be skipped (as workaround)
23 4. All DRAM is cleared with zeros
27 A platform that supports memory clearing selects Kconfig
28 ``PLATFORM_HAS_DRAM_CLEAR`` and calls
31 bool security_clear_dram_request(void);
34 to detect if memory should be cleared.
36 The memory is cleared in ramstage as part of `DEV_INIT` stage. It's possible to
37 clear it earlier on some platforms, but on x86 MTRRs needs to be programmed
38 first, which happens in `DEV_INIT`.
40 Without MTRRs (and caches enabled) clearing memory takes multiple seconds.
43 As some platforms place code and stack in DRAM (FSP1.0), the regions can be
46 ## Architecture specific implementations
51 x86 PAE <../arch/x86/pae.md>