mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-16 09:34:18 +00:00

Combining the EL2 and EL3 enablement code necessitates that it must be called at el3_exit, which is the only place with enough context to make the decision of what needs to be set. Decouple them to allow them to be called from elsewhere. Signed-off-by: Boyan Karatotev <boyan.karatotev@arm.com> Change-Id: I147764c42771e7d4100699ec8fae98dac0a505c0
36 lines
703 B
C
36 lines
703 B
C
/*
|
|
* Copyright (c) 2018-2023, Arm Limited and Contributors. All rights reserved.
|
|
*
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
*/
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <arch.h>
|
|
#include <arch_features.h>
|
|
#include <arch_helpers.h>
|
|
#include <lib/extensions/mpam.h>
|
|
|
|
void mpam_init_el3(void)
|
|
{
|
|
/*
|
|
* Enable MPAM, and disable trapping to EL3 when lower ELs access their
|
|
* own MPAM registers.
|
|
*/
|
|
write_mpam3_el3(MPAM3_EL3_MPAMEN_BIT);
|
|
|
|
}
|
|
|
|
/*
|
|
* If EL2 is implemented but unused, disable trapping to EL2 when lower ELs
|
|
* access their own MPAM registers.
|
|
*/
|
|
void mpam_init_el2_unused(void)
|
|
{
|
|
write_mpam2_el2(0ULL);
|
|
|
|
if ((read_mpamidr_el1() & MPAMIDR_HAS_HCR_BIT) != 0U) {
|
|
write_mpamhcr_el2(0ULL);
|
|
}
|
|
|
|
}
|