xref: /rk3399_ARM-atf/lib/extensions/cpa2/cpa2.c (revision a1032beb656d78d1cffc97fa64c961d098b23b48)
1 /*
2  * Copyright (c) 2025, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch.h>
8 #include <arch_features.h>
9 
10 /*
11  * Check that the platform virtual address is less than or equal to 54 bits, if
12  * not then CPA will corrupt the addresses.
13  */
14 #if PLAT_VIRT_ADDR_SPACE_SIZE >= (1 << 54)
15 #error "FEAT_CPA2 can only be enabled with VA <= 54 bits! See Arm ARM rule IQDPCR."
16 #endif
17 
18 void cpa2_enable_el3(void)
19 {
20 	write_sctlr2_el3(read_sctlr2_el3() | SCTLR2_CPTA_BIT |
21 			 SCTLR2_CPTM_BIT);
22 }
23