xref: /rk3399_ARM-atf/lib/cpus/aarch64/cpu_helpers.S (revision 36eeb59f9eb0c2e966bd41b02c0dc588faffce35)
19b476841SSoby Mathew/*
27791ce21SBoyan Karatotev * Copyright (c) 2014-2025, Arm Limited and Contributors. All rights reserved.
39b476841SSoby Mathew *
482cb2c1aSdp-arm * SPDX-License-Identifier: BSD-3-Clause
59b476841SSoby Mathew */
69b476841SSoby Mathew
79b476841SSoby Mathew#include <arch.h>
89b476841SSoby Mathew#include <asm_macros.S>
99b476841SSoby Mathew#include <assert_macros.S>
10c2ad38ceSVarun Wadekar#include <common/bl_common.h>
1109d40e0eSAntonio Nino Diaz#include <common/debug.h>
1255c70cb7SDavid Cunado#include <cpu_macros.S>
13007433d8SBoyan Karatotev#include <lib/cpus/cpu_ops.h>
146bb96fa6SBoyan Karatotev#include <lib/cpus/errata.h>
1509d40e0eSAntonio Nino Diaz#include <lib/el3_runtime/cpu_data.h>
169b476841SSoby Mathew
179b476841SSoby Mathew /* Reset fn is needed in BL at reset vector */
1842d4d3baSArvind Ram Prakash#if defined(IMAGE_BL1) || defined(IMAGE_BL31) ||	\
1942d4d3baSArvind Ram Prakash	(defined(IMAGE_BL2) && RESET_TO_BL2)
209b476841SSoby Mathew	/*
219b476841SSoby Mathew	 * The reset handler common to all platforms.  After a matching
229b476841SSoby Mathew	 * cpu_ops structure entry is found, the correponding reset_handler
239b476841SSoby Mathew	 * in the cpu_ops is invoked.
24683f788fSSoby Mathew	 * Clobbers: x0 - x19, x30
259b476841SSoby Mathew	 */
269b476841SSoby Mathew	.globl	reset_handler
279b476841SSoby Mathewfunc reset_handler
287395a725SSoby Mathew	mov	x19, x30
299b476841SSoby Mathew
30683f788fSSoby Mathew	/* The plat_reset_handler can clobber x0 - x18, x30 */
3124fb838fSSoby Mathew	bl	plat_reset_handler
3224fb838fSSoby Mathew
339b476841SSoby Mathew	/* Get the matching cpu_ops pointer */
349b476841SSoby Mathew	bl	get_cpu_ops_ptr
359b476841SSoby Mathew
363f721c6eSThaddeus Serna#if ENABLE_ASSERTIONS
373f721c6eSThaddeus Serna	/*
383f721c6eSThaddeus Serna	 * Assert if invalid cpu_ops obtained. If this is not valid, it may
393f721c6eSThaddeus Serna	 * suggest that the proper CPU file hasn't been included.
403f721c6eSThaddeus Serna	 */
413f721c6eSThaddeus Serna	cmp	x0, #0
423f721c6eSThaddeus Serna	ASM_ASSERT(ne)
433f721c6eSThaddeus Serna#endif
443f721c6eSThaddeus Serna
459b476841SSoby Mathew	/* Get the cpu_ops reset handler */
469b476841SSoby Mathew	ldr	x2, [x0, #CPU_RESET_FUNC]
477395a725SSoby Mathew	mov	x30, x19
489b476841SSoby Mathew	cbz	x2, 1f
49683f788fSSoby Mathew
50683f788fSSoby Mathew	/* The cpu_ops reset handler can clobber x0 - x19, x30 */
517395a725SSoby Mathew	br	x2
529b476841SSoby Mathew1:
537395a725SSoby Mathew	ret
548b779620SKévin Petitendfunc reset_handler
5524fb838fSSoby Mathew
56b1d27b48SRoberto Vargas#endif
579b476841SSoby Mathew
583d8256b2SMasahiro Yamada#ifdef IMAGE_BL31 /* The power down core and cluster is needed only in  BL31 */
59add40351SSoby Mathew	/*
605dd9dbb5SJeenu Viswambharan	 * void prepare_cpu_pwr_dwn(unsigned int power_level)
615dd9dbb5SJeenu Viswambharan	 *
625dd9dbb5SJeenu Viswambharan	 * Prepare CPU power down function for all platforms. The function takes
635dd9dbb5SJeenu Viswambharan	 * a domain level to be powered down as its parameter. After the cpu_ops
645dd9dbb5SJeenu Viswambharan	 * pointer is retrieved from cpu_data, the handler for requested power
655dd9dbb5SJeenu Viswambharan	 * level is called.
66add40351SSoby Mathew	 */
675dd9dbb5SJeenu Viswambharan	.globl	prepare_cpu_pwr_dwn
685dd9dbb5SJeenu Viswambharanfunc prepare_cpu_pwr_dwn
69add40351SSoby Mathew	/*
705dd9dbb5SJeenu Viswambharan	 * If the given power level exceeds CPU_MAX_PWR_DWN_OPS, we call the
715dd9dbb5SJeenu Viswambharan	 * power down handler for the last power level
72add40351SSoby Mathew	 */
735dd9dbb5SJeenu Viswambharan	mov_imm	x2, (CPU_MAX_PWR_DWN_OPS - 1)
745dd9dbb5SJeenu Viswambharan	cmp	x0, x2
755dd9dbb5SJeenu Viswambharan	csel	x2, x2, x0, hi
765dd9dbb5SJeenu Viswambharan
77add40351SSoby Mathew	mrs	x1, tpidr_el3
78add40351SSoby Mathew	ldr	x0, [x1, #CPU_DATA_CPU_OPS_PTR]
79044bb2faSAntonio Nino Diaz#if ENABLE_ASSERTIONS
80add40351SSoby Mathew	cmp	x0, #0
81add40351SSoby Mathew	ASM_ASSERT(ne)
82add40351SSoby Mathew#endif
83add40351SSoby Mathew
845dd9dbb5SJeenu Viswambharan	/* Get the appropriate power down handler */
855dd9dbb5SJeenu Viswambharan	mov	x1, #CPU_PWR_DWN_OPS
865dd9dbb5SJeenu Viswambharan	add	x1, x1, x2, lsl #3
875dd9dbb5SJeenu Viswambharan	ldr	x1, [x0, x1]
88601e3ed2SVarun Wadekar#if ENABLE_ASSERTIONS
89601e3ed2SVarun Wadekar	cmp	x1, #0
90601e3ed2SVarun Wadekar	ASM_ASSERT(ne)
91601e3ed2SVarun Wadekar#endif
92add40351SSoby Mathew	br	x1
935dd9dbb5SJeenu Viswambharanendfunc prepare_cpu_pwr_dwn
94add40351SSoby Mathew
95add40351SSoby Mathew
96add40351SSoby Mathew	/*
97add40351SSoby Mathew	 * Initializes the cpu_ops_ptr if not already initialized
9812e7c4abSVikram Kanigiri	 * in cpu_data. This can be called without a runtime stack, but may
9912e7c4abSVikram Kanigiri	 * only be called after the MMU is enabled.
100add40351SSoby Mathew	 * clobbers: x0 - x6, x10
101add40351SSoby Mathew	 */
102add40351SSoby Mathew	.globl	init_cpu_ops
103add40351SSoby Mathewfunc init_cpu_ops
104add40351SSoby Mathew	mrs	x6, tpidr_el3
105add40351SSoby Mathew	ldr	x0, [x6, #CPU_DATA_CPU_OPS_PTR]
106add40351SSoby Mathew	cbnz	x0, 1f
107add40351SSoby Mathew	mov	x10, x30
108add40351SSoby Mathew	bl	get_cpu_ops_ptr
10909997346SSoby Mathew	str	x0, [x6, #CPU_DATA_CPU_OPS_PTR]!
110add40351SSoby Mathew	mov x30, x10
111add40351SSoby Mathew1:
112add40351SSoby Mathew	ret
1138b779620SKévin Petitendfunc init_cpu_ops
114add40351SSoby Mathew#endif /* IMAGE_BL31 */
115add40351SSoby Mathew
1163d8256b2SMasahiro Yamada#if defined(IMAGE_BL31) && CRASH_REPORTING
117d3f70af6SSoby Mathew	/*
118d3f70af6SSoby Mathew	 * The cpu specific registers which need to be reported in a crash
119d3f70af6SSoby Mathew	 * are reported via cpu_ops cpu_reg_dump function. After a matching
120d3f70af6SSoby Mathew	 * cpu_ops structure entry is found, the correponding cpu_reg_dump
121d3f70af6SSoby Mathew	 * in the cpu_ops is invoked.
122d3f70af6SSoby Mathew	 */
123d3f70af6SSoby Mathew	.globl	do_cpu_reg_dump
124d3f70af6SSoby Mathewfunc do_cpu_reg_dump
125d3f70af6SSoby Mathew	mov	x16, x30
126d3f70af6SSoby Mathew
127d3f70af6SSoby Mathew	/* Get the matching cpu_ops pointer */
128d3f70af6SSoby Mathew	bl	get_cpu_ops_ptr
129d3f70af6SSoby Mathew	cbz	x0, 1f
130d3f70af6SSoby Mathew
131d3f70af6SSoby Mathew	/* Get the cpu_ops cpu_reg_dump */
132d3f70af6SSoby Mathew	ldr	x2, [x0, #CPU_REG_DUMP]
133d3f70af6SSoby Mathew	cbz	x2, 1f
134d3f70af6SSoby Mathew	blr	x2
135d3f70af6SSoby Mathew1:
136d3f70af6SSoby Mathew	mov	x30, x16
137d3f70af6SSoby Mathew	ret
1388b779620SKévin Petitendfunc do_cpu_reg_dump
139d3f70af6SSoby Mathew#endif
140d3f70af6SSoby Mathew
1419b476841SSoby Mathew	/*
1429b476841SSoby Mathew	 * The below function returns the cpu_ops structure matching the
1439b476841SSoby Mathew	 * midr of the core. It reads the MIDR_EL1 and finds the matching
1449b476841SSoby Mathew	 * entry in cpu_ops entries. Only the implementation and part number
1459b476841SSoby Mathew	 * are used to match the entries.
1461994e562SJavier Almansa Sobrino	 *
1471994e562SJavier Almansa Sobrino	 * If cpu_ops for the MIDR_EL1 cannot be found and
1481994e562SJavier Almansa Sobrino	 * SUPPORT_UNKNOWN_MPID is enabled, it will try to look for a
1491994e562SJavier Almansa Sobrino	 * default cpu_ops with an MIDR value of 0.
1502e61d687SOlivier Deprez	 * (Implementation number 0x0 should be reserved for software use
1511994e562SJavier Almansa Sobrino	 * and therefore no clashes should happen with that default value).
1521994e562SJavier Almansa Sobrino	 *
1539b476841SSoby Mathew	 * Return :
1549b476841SSoby Mathew	 *     x0 - The matching cpu_ops pointer on Success
1559b476841SSoby Mathew	 *     x0 - 0 on failure.
1569b476841SSoby Mathew	 * Clobbers : x0 - x5
1579b476841SSoby Mathew	 */
1589b476841SSoby Mathew	.globl	get_cpu_ops_ptr
1599b476841SSoby Mathewfunc get_cpu_ops_ptr
1609b476841SSoby Mathew	/* Read the MIDR_EL1 */
1619b476841SSoby Mathew	mrs	x2, midr_el1
1629b476841SSoby Mathew	mov_imm	x3, CPU_IMPL_PN_MASK
1639b476841SSoby Mathew
1649b476841SSoby Mathew	/* Retain only the implementation and part number using mask */
1659b476841SSoby Mathew	and	w2, w2, w3
1661994e562SJavier Almansa Sobrino
1671994e562SJavier Almansa Sobrino	/* Get the cpu_ops end location */
168a5c4212fSHsin-Hsiung Wang	adr_l	x5, (__CPU_OPS_END__ + CPU_MIDR)
1691994e562SJavier Almansa Sobrino
1701994e562SJavier Almansa Sobrino	/* Initialize the return parameter */
1711994e562SJavier Almansa Sobrino	mov	x0, #0
1729b476841SSoby Mathew1:
1731994e562SJavier Almansa Sobrino	/* Get the cpu_ops start location */
174a5c4212fSHsin-Hsiung Wang	adr_l	x4, (__CPU_OPS_START__ + CPU_MIDR)
1751994e562SJavier Almansa Sobrino
1761994e562SJavier Almansa Sobrino2:
1779b476841SSoby Mathew	/* Check if we have reached end of list */
1789b476841SSoby Mathew	cmp	x4, x5
1791994e562SJavier Almansa Sobrino	b.eq	search_def_ptr
1809b476841SSoby Mathew
1819b476841SSoby Mathew	/* load the midr from the cpu_ops */
1829b476841SSoby Mathew	ldr	x1, [x4], #CPU_OPS_SIZE
1839b476841SSoby Mathew	and	w1, w1, w3
1849b476841SSoby Mathew
1859b476841SSoby Mathew	/* Check if midr matches to midr of this core */
1869b476841SSoby Mathew	cmp	w1, w2
1871994e562SJavier Almansa Sobrino	b.ne	2b
1889b476841SSoby Mathew
1899b476841SSoby Mathew	/* Subtract the increment and offset to get the cpu-ops pointer */
1909b476841SSoby Mathew	sub	x0, x4, #(CPU_OPS_SIZE + CPU_MIDR)
191601e3ed2SVarun Wadekar#if ENABLE_ASSERTIONS
192601e3ed2SVarun Wadekar	cmp	x0, #0
193601e3ed2SVarun Wadekar	ASM_ASSERT(ne)
194601e3ed2SVarun Wadekar#endif
1951994e562SJavier Almansa Sobrino#ifdef SUPPORT_UNKNOWN_MPID
1961994e562SJavier Almansa Sobrino	cbnz	x2, exit_mpid_found
1971994e562SJavier Almansa Sobrino	/* Mark the unsupported MPID flag */
1981994e562SJavier Almansa Sobrino	adrp	x1, unsupported_mpid_flag
1991994e562SJavier Almansa Sobrino	add	x1, x1, :lo12:unsupported_mpid_flag
2001994e562SJavier Almansa Sobrino	str	w2, [x1]
2011994e562SJavier Almansa Sobrinoexit_mpid_found:
2021994e562SJavier Almansa Sobrino#endif
2031994e562SJavier Almansa Sobrino	ret
2041994e562SJavier Almansa Sobrino
2051994e562SJavier Almansa Sobrino	/*
2061994e562SJavier Almansa Sobrino	 * Search again for a default pointer (MIDR = 0x0)
2071994e562SJavier Almansa Sobrino	 * or return error if already searched.
2081994e562SJavier Almansa Sobrino	 */
2091994e562SJavier Almansa Sobrinosearch_def_ptr:
2101994e562SJavier Almansa Sobrino#ifdef SUPPORT_UNKNOWN_MPID
2111994e562SJavier Almansa Sobrino	cbz	x2, error_exit
2121994e562SJavier Almansa Sobrino	mov	x2, #0
2131994e562SJavier Almansa Sobrino	b	1b
2149b476841SSoby Mathewerror_exit:
2151994e562SJavier Almansa Sobrino#endif
2169b476841SSoby Mathew	ret
2178b779620SKévin Petitendfunc get_cpu_ops_ptr
2187395a725SSoby Mathew
21910bcd761SJeenu Viswambharan	.globl	cpu_get_rev_var
22010bcd761SJeenu Viswambharanfunc cpu_get_rev_var
221*36eeb59fSBoyan Karatotev	get_rev_var x0, x1
22210bcd761SJeenu Viswambharan	ret
22310bcd761SJeenu Viswambharanendfunc cpu_get_rev_var
2247395a725SSoby Mathew
22510bcd761SJeenu Viswambharan/*
2262c3a1078SDimitris Papastamos * int check_wa_cve_2017_5715(void);
227a205a56eSDimitris Papastamos *
228a205a56eSDimitris Papastamos * This function returns:
229a205a56eSDimitris Papastamos *  - ERRATA_APPLIES when firmware mitigation is required.
230a205a56eSDimitris Papastamos *  - ERRATA_NOT_APPLIES when firmware mitigation is _not_ required.
231a205a56eSDimitris Papastamos *  - ERRATA_MISSING when firmware mitigation would be required but
232a205a56eSDimitris Papastamos *    is not compiled in.
233a205a56eSDimitris Papastamos *
234a205a56eSDimitris Papastamos * NOTE: Must be called only after cpu_ops have been initialized
235a205a56eSDimitris Papastamos *       in per-CPU data.
236a205a56eSDimitris Papastamos */
2372c3a1078SDimitris Papastamos	.globl	check_wa_cve_2017_5715
2382c3a1078SDimitris Papastamosfunc check_wa_cve_2017_5715
239a205a56eSDimitris Papastamos	mrs	x0, tpidr_el3
240a205a56eSDimitris Papastamos#if ENABLE_ASSERTIONS
241a205a56eSDimitris Papastamos	cmp	x0, #0
242a205a56eSDimitris Papastamos	ASM_ASSERT(ne)
243a205a56eSDimitris Papastamos#endif
244a205a56eSDimitris Papastamos	ldr	x0, [x0, #CPU_DATA_CPU_OPS_PTR]
245601e3ed2SVarun Wadekar#if ENABLE_ASSERTIONS
246601e3ed2SVarun Wadekar	cmp	x0, #0
247601e3ed2SVarun Wadekar	ASM_ASSERT(ne)
248601e3ed2SVarun Wadekar#endif
249a205a56eSDimitris Papastamos	ldr	x0, [x0, #CPU_EXTRA1_FUNC]
250a205a56eSDimitris Papastamos	/*
251a205a56eSDimitris Papastamos	 * If the reserved function pointer is NULL, this CPU
252a205a56eSDimitris Papastamos	 * is unaffected by CVE-2017-5715 so bail out.
253a205a56eSDimitris Papastamos	 */
2549b2510b6SBipin Ravi	cmp	x0, #CPU_NO_EXTRA1_FUNC
255a205a56eSDimitris Papastamos	beq	1f
256a205a56eSDimitris Papastamos	br	x0
257a205a56eSDimitris Papastamos1:
258a205a56eSDimitris Papastamos	mov	x0, #ERRATA_NOT_APPLIES
259a205a56eSDimitris Papastamos	ret
2602c3a1078SDimitris Papastamosendfunc check_wa_cve_2017_5715
261fe007b2eSDimitris Papastamos
262fe007b2eSDimitris Papastamos/*
2638ae6b1adSArvind Ram Prakash * int check_wa_cve_2024_7881(void);
2648ae6b1adSArvind Ram Prakash *
2658ae6b1adSArvind Ram Prakash * This function returns:
2668ae6b1adSArvind Ram Prakash *  - ERRATA_APPLIES when firmware mitigation is required.
2678ae6b1adSArvind Ram Prakash *  - ERRATA_NOT_APPLIES when firmware mitigation is _not_ required.
2688ae6b1adSArvind Ram Prakash *  - ERRATA_MISSING when firmware mitigation would be required but
2698ae6b1adSArvind Ram Prakash *    is not compiled in.
2708ae6b1adSArvind Ram Prakash *
2718ae6b1adSArvind Ram Prakash * NOTE: Must be called only after cpu_ops have been initialized
2728ae6b1adSArvind Ram Prakash *       in per-CPU data.
2738ae6b1adSArvind Ram Prakash */
2748ae6b1adSArvind Ram Prakash.globl	check_wa_cve_2024_7881
2758ae6b1adSArvind Ram Prakashfunc check_wa_cve_2024_7881
2768ae6b1adSArvind Ram Prakash	mrs	x0, tpidr_el3
2778ae6b1adSArvind Ram Prakash#if ENABLE_ASSERTIONS
2788ae6b1adSArvind Ram Prakash	cmp	x0, #0
2798ae6b1adSArvind Ram Prakash	ASM_ASSERT(ne)
2808ae6b1adSArvind Ram Prakash#endif
2818ae6b1adSArvind Ram Prakash	ldr	x0, [x0, #CPU_DATA_CPU_OPS_PTR]
2828ae6b1adSArvind Ram Prakash#if ENABLE_ASSERTIONS
2838ae6b1adSArvind Ram Prakash	cmp	x0, #0
2848ae6b1adSArvind Ram Prakash	ASM_ASSERT(ne)
2858ae6b1adSArvind Ram Prakash#endif
2868ae6b1adSArvind Ram Prakash	ldr	x0, [x0, #CPU_EXTRA4_FUNC]
2878ae6b1adSArvind Ram Prakash	/*
2888ae6b1adSArvind Ram Prakash	 * If the reserved function pointer is NULL, this CPU
2898ae6b1adSArvind Ram Prakash	 * is unaffected by CVE-2024-7881 so bail out.
2908ae6b1adSArvind Ram Prakash	 */
2918ae6b1adSArvind Ram Prakash	cmp	x0, #CPU_NO_EXTRA4_FUNC
2928ae6b1adSArvind Ram Prakash	beq	1f
2938ae6b1adSArvind Ram Prakash	br	x0
2948ae6b1adSArvind Ram Prakash1:
2958ae6b1adSArvind Ram Prakash	mov	x0, #ERRATA_NOT_APPLIES
2968ae6b1adSArvind Ram Prakash	ret
2978ae6b1adSArvind Ram Prakashendfunc check_wa_cve_2024_7881
2988ae6b1adSArvind Ram Prakash
2998ae6b1adSArvind Ram Prakash/*
300fe007b2eSDimitris Papastamos * void *wa_cve_2018_3639_get_disable_ptr(void);
301fe007b2eSDimitris Papastamos *
302fe007b2eSDimitris Papastamos * Returns a function pointer which is used to disable mitigation
303fe007b2eSDimitris Papastamos * for CVE-2018-3639.
304fe007b2eSDimitris Papastamos * The function pointer is only returned on cores that employ
305fe007b2eSDimitris Papastamos * dynamic mitigation.  If the core uses static mitigation or is
306fe007b2eSDimitris Papastamos * unaffected by CVE-2018-3639 this function returns NULL.
307fe007b2eSDimitris Papastamos *
308fe007b2eSDimitris Papastamos * NOTE: Must be called only after cpu_ops have been initialized
309fe007b2eSDimitris Papastamos *       in per-CPU data.
310fe007b2eSDimitris Papastamos */
311fe007b2eSDimitris Papastamos	.globl	wa_cve_2018_3639_get_disable_ptr
312fe007b2eSDimitris Papastamosfunc wa_cve_2018_3639_get_disable_ptr
313fe007b2eSDimitris Papastamos	mrs	x0, tpidr_el3
314fe007b2eSDimitris Papastamos#if ENABLE_ASSERTIONS
315fe007b2eSDimitris Papastamos	cmp	x0, #0
316fe007b2eSDimitris Papastamos	ASM_ASSERT(ne)
317fe007b2eSDimitris Papastamos#endif
318fe007b2eSDimitris Papastamos	ldr	x0, [x0, #CPU_DATA_CPU_OPS_PTR]
319601e3ed2SVarun Wadekar#if ENABLE_ASSERTIONS
320601e3ed2SVarun Wadekar	cmp	x0, #0
321601e3ed2SVarun Wadekar	ASM_ASSERT(ne)
322601e3ed2SVarun Wadekar#endif
323fe007b2eSDimitris Papastamos	ldr	x0, [x0, #CPU_EXTRA2_FUNC]
324fe007b2eSDimitris Papastamos	ret
325fe007b2eSDimitris Papastamosendfunc wa_cve_2018_3639_get_disable_ptr
3269b2510b6SBipin Ravi
3279b2510b6SBipin Ravi/*
3289b2510b6SBipin Ravi * int check_smccc_arch_wa3_applies(void);
3299b2510b6SBipin Ravi *
3309b2510b6SBipin Ravi * This function checks whether SMCCC_ARCH_WORKAROUND_3 is enabled to mitigate
3319b2510b6SBipin Ravi * CVE-2022-23960 for this CPU. It returns:
3329b2510b6SBipin Ravi *  - ERRATA_APPLIES when SMCCC_ARCH_WORKAROUND_3 can be invoked to mitigate
3339b2510b6SBipin Ravi *    the CVE.
3349b2510b6SBipin Ravi *  - ERRATA_NOT_APPLIES when SMCCC_ARCH_WORKAROUND_3 should not be invoked to
3359b2510b6SBipin Ravi *    mitigate the CVE.
3369b2510b6SBipin Ravi *
3379b2510b6SBipin Ravi * NOTE: Must be called only after cpu_ops have been initialized
3389b2510b6SBipin Ravi *       in per-CPU data.
3399b2510b6SBipin Ravi */
3409b2510b6SBipin Ravi	.globl	check_smccc_arch_wa3_applies
3419b2510b6SBipin Ravifunc check_smccc_arch_wa3_applies
3429b2510b6SBipin Ravi	mrs	x0, tpidr_el3
3439b2510b6SBipin Ravi#if ENABLE_ASSERTIONS
3449b2510b6SBipin Ravi	cmp	x0, #0
3459b2510b6SBipin Ravi	ASM_ASSERT(ne)
3469b2510b6SBipin Ravi#endif
3479b2510b6SBipin Ravi	ldr	x0, [x0, #CPU_DATA_CPU_OPS_PTR]
3489b2510b6SBipin Ravi#if ENABLE_ASSERTIONS
3499b2510b6SBipin Ravi	cmp	x0, #0
3509b2510b6SBipin Ravi	ASM_ASSERT(ne)
3519b2510b6SBipin Ravi#endif
3529b2510b6SBipin Ravi	ldr	x0, [x0, #CPU_EXTRA3_FUNC]
3539b2510b6SBipin Ravi	/*
3549b2510b6SBipin Ravi	 * If the reserved function pointer is NULL, this CPU
3559b2510b6SBipin Ravi	 * is unaffected by CVE-2022-23960 so bail out.
3569b2510b6SBipin Ravi	 */
3579b2510b6SBipin Ravi	cmp	x0, #CPU_NO_EXTRA3_FUNC
3589b2510b6SBipin Ravi	beq	1f
3599b2510b6SBipin Ravi	br	x0
3609b2510b6SBipin Ravi1:
3619b2510b6SBipin Ravi	mov	x0, #ERRATA_NOT_APPLIES
3629b2510b6SBipin Ravi	ret
3639b2510b6SBipin Raviendfunc check_smccc_arch_wa3_applies
364