Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 1 | /* |
Rohit Mathew | 960a77e | 2023-12-15 12:40:41 +0000 | [diff] [blame] | 2 | * Copyright (c) 2022-2024, Arm Limited. All rights reserved. |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <arch.h> |
| 8 | #include <asm_macros.S> |
| 9 | #include <common/bl_common.h> |
| 10 | #include <neoverse_poseidon.h> |
| 11 | #include <cpu_macros.S> |
| 12 | #include <plat_macros.S> |
Bipin Ravi | 32464ba | 2022-05-06 16:02:30 -0500 | [diff] [blame] | 13 | #include "wa_cve_2022_23960_bhb_vector.S" |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 14 | |
| 15 | /* Hardware handled coherency */ |
| 16 | #if HW_ASSISTED_COHERENCY == 0 |
| 17 | #error "Neoverse Poseidon must be compiled with HW_ASSISTED_COHERENCY enabled" |
| 18 | #endif |
| 19 | |
| 20 | /* 64-bit only core */ |
| 21 | #if CTX_INCLUDE_AARCH32_REGS == 1 |
| 22 | #error "Neoverse Poseidon supports only AArch64. Compile with CTX_INCLUDE_AARCH32_REGS=0" |
| 23 | #endif |
| 24 | |
Bipin Ravi | 32464ba | 2022-05-06 16:02:30 -0500 | [diff] [blame] | 25 | #if WORKAROUND_CVE_2022_23960 |
| 26 | wa_cve_2022_23960_bhb_vector_table NEOVERSE_POSEIDON_BHB_LOOP_COUNT, neoverse_poseidon |
| 27 | #endif /* WORKAROUND_CVE_2022_23960 */ |
| 28 | |
Arvind Ram Prakash | 5a03ddf | 2023-07-25 14:33:12 -0500 | [diff] [blame] | 29 | workaround_reset_start neoverse_poseidon, CVE(2022,23960), WORKAROUND_CVE_2022_23960 |
| 30 | #if IMAGE_BL31 |
| 31 | /* |
| 32 | * The Neoverse-poseidon generic vectors are overridden to apply errata |
| 33 | * mitigation on exception entry from lower ELs. |
| 34 | */ |
Arvind Ram Prakash | 34092e9 | 2023-07-25 14:42:46 -0500 | [diff] [blame] | 35 | override_vector_table wa_cve_vbar_neoverse_poseidon |
| 36 | |
Arvind Ram Prakash | 5a03ddf | 2023-07-25 14:33:12 -0500 | [diff] [blame] | 37 | #endif /* IMAGE_BL31 */ |
| 38 | workaround_reset_end neoverse_poseidon, CVE(2022,23960) |
| 39 | |
| 40 | check_erratum_chosen neoverse_poseidon, CVE(2022, 23960), WORKAROUND_CVE_2022_23960 |
| 41 | |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 42 | /* --------------------------------------------- |
| 43 | * HW will do the cache maintenance while powering down |
| 44 | * --------------------------------------------- |
| 45 | */ |
| 46 | func neoverse_poseidon_core_pwr_dwn |
| 47 | /* --------------------------------------------- |
| 48 | * Enable CPU power down bit in power control register |
| 49 | * --------------------------------------------- |
| 50 | */ |
Arvind Ram Prakash | 34092e9 | 2023-07-25 14:42:46 -0500 | [diff] [blame] | 51 | sysreg_bit_set NEOVERSE_POSEIDON_CPUPWRCTLR_EL1, \ |
| 52 | NEOVERSE_POSEIDON_CPUPWRCTLR_EL1_CORE_PWRDN_BIT |
| 53 | |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 54 | isb |
| 55 | ret |
| 56 | endfunc neoverse_poseidon_core_pwr_dwn |
| 57 | |
Arvind Ram Prakash | 5a03ddf | 2023-07-25 14:33:12 -0500 | [diff] [blame] | 58 | cpu_reset_func_start neoverse_poseidon |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 59 | /* Disable speculative loads */ |
| 60 | msr SSBS, xzr |
Arvind Ram Prakash | 5a03ddf | 2023-07-25 14:33:12 -0500 | [diff] [blame] | 61 | cpu_reset_func_end neoverse_poseidon |
Bipin Ravi | 32464ba | 2022-05-06 16:02:30 -0500 | [diff] [blame] | 62 | |
Arvind Ram Prakash | 5a03ddf | 2023-07-25 14:33:12 -0500 | [diff] [blame] | 63 | errata_report_shim neoverse_poseidon |
Bipin Ravi | 32464ba | 2022-05-06 16:02:30 -0500 | [diff] [blame] | 64 | |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 65 | /* --------------------------------------------- |
| 66 | * This function provides Neoverse-Poseidon specific |
| 67 | * register information for crash reporting. |
| 68 | * It needs to return with x6 pointing to |
| 69 | * a list of register names in ascii and |
| 70 | * x8 - x15 having values of registers to be |
| 71 | * reported. |
| 72 | * --------------------------------------------- |
| 73 | */ |
| 74 | .section .rodata.neoverse_poseidon_regs, "aS" |
| 75 | neoverse_poseidon_regs: /* The ascii list of register names to be reported */ |
| 76 | .asciz "cpuectlr_el1", "" |
| 77 | |
| 78 | func neoverse_poseidon_cpu_reg_dump |
| 79 | adr x6, neoverse_poseidon_regs |
| 80 | mrs x8, NEOVERSE_POSEIDON_CPUECTLR_EL1 |
| 81 | ret |
| 82 | endfunc neoverse_poseidon_cpu_reg_dump |
| 83 | |
Rohit Mathew | 960a77e | 2023-12-15 12:40:41 +0000 | [diff] [blame] | 84 | declare_cpu_ops neoverse_poseidon, NEOVERSE_POSEIDON_VNAE_MIDR, \ |
Jayanth Dodderi Chidanand | 37de916 | 2021-12-07 17:20:10 +0000 | [diff] [blame] | 85 | neoverse_poseidon_reset_func, \ |
| 86 | neoverse_poseidon_core_pwr_dwn |
Rohit Mathew | 22d2277 | 2023-12-15 12:50:58 +0000 | [diff] [blame] | 87 | |
| 88 | declare_cpu_ops neoverse_poseidon, NEOVERSE_POSEIDON_V_MIDR, \ |
| 89 | neoverse_poseidon_reset_func, \ |
| 90 | neoverse_poseidon_core_pwr_dwn |