Manish V Badarkhe | 589a112 | 2021-12-31 15:20:08 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2022, Arm Limited. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <test_helpers.h> |
| 8 | |
Manish V Badarkhe | 589a112 | 2021-12-31 15:20:08 +0000 | [diff] [blame] | 9 | test_result_t test_spe_support(void) |
| 10 | { |
| 11 | /* SPE is an AArch64-only feature.*/ |
| 12 | SKIP_TEST_IF_AARCH32(); |
| 13 | |
| 14 | #ifdef __aarch64__ |
Manish V Badarkhe | 41bce21 | 2022-11-17 12:34:40 +0000 | [diff] [blame] | 15 | unsigned int spe_ver = spe_get_version(); |
Manish V Badarkhe | 589a112 | 2021-12-31 15:20:08 +0000 | [diff] [blame] | 16 | |
Manish V Badarkhe | 41bce21 | 2022-11-17 12:34:40 +0000 | [diff] [blame] | 17 | assert(spe_ver <= ID_AA64DFR0_SPE_V1P4); |
Manish V Badarkhe | 589a112 | 2021-12-31 15:20:08 +0000 | [diff] [blame] | 18 | |
| 19 | if (spe_ver == ID_AA64DFR0_SPE_NOT_SUPPORTED) { |
| 20 | return TEST_RESULT_SKIPPED; |
| 21 | } |
| 22 | |
| 23 | /* |
| 24 | * If runtime-EL3 does not enable access to SPE system |
| 25 | * registers from NS-EL2/NS-EL1 then read of these |
| 26 | * registers traps in EL3 |
| 27 | */ |
| 28 | read_pmscr_el1(); |
| 29 | read_pmsfcr_el1(); |
| 30 | read_pmsicr_el1(); |
| 31 | read_pmsidr_el1(); |
| 32 | read_pmsirr_el1(); |
| 33 | read_pmslatfr_el1(); |
| 34 | read_pmblimitr_el1(); |
| 35 | read_pmbptr_el1(); |
| 36 | read_pmbsr_el1(); |
| 37 | read_pmsevfr_el1(); |
| 38 | if (IS_IN_EL2()) { |
| 39 | read_pmscr_el2(); |
| 40 | } |
| 41 | if (spe_ver == ID_AA64DFR0_SPE_V1P2) { |
| 42 | read_pmsnevfr_el1(); |
| 43 | } |
| 44 | |
| 45 | return TEST_RESULT_SUCCESS; |
| 46 | #endif /* __aarch64__ */ |
| 47 | } |