mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 01:24:27 +00:00

When a platform decides to use FEAT_RNG_TRAP, every RNDR or RNDRSS read will trap into EL3. The platform can then emulate those instructions, by either executing the real CPU instructions, potentially conditioning the results, or use rate-limiting or filtering to protect the hardware entropy pool. Another possiblitiy would be to use some platform specific TRNG device to get entropy and returning this. To demonstrate platform specific usage, add a demo implementation for the FVP: It will execute the actual CPU instruction and just return the result. This should serve as reference code to implement platform specific policies. We change the definition of read_rndr() and read_rndrrs() to use the alternative sysreg encoding, so that all assemblers can handle that. Add documentation about the new platform specific RNG handler function. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Change-Id: Ibce817b3b06ad20129d15531b81402e3cc3e9a9e
23 lines
517 B
C
23 lines
517 B
C
/*
|
|
* Copyright (c) 2022, ARM Limited. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*
|
|
* Dispatch synchronous system register traps from lower ELs.
|
|
*/
|
|
|
|
#include <bl31/sync_handle.h>
|
|
#include <context.h>
|
|
|
|
int handle_sysreg_trap(uint64_t esr_el3, cpu_context_t *ctx)
|
|
{
|
|
switch (esr_el3 & ISS_SYSREG_OPCODE_MASK) {
|
|
#if ENABLE_FEAT_RNG_TRAP
|
|
case ISS_SYSREG_OPCODE_RNDR:
|
|
case ISS_SYSREG_OPCODE_RNDRRS:
|
|
return plat_handle_rng_trap(esr_el3, ctx);
|
|
#endif
|
|
default:
|
|
return TRAP_RET_UNHANDLED;
|
|
}
|
|
}
|