1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Copyright (C) 2012 ARM Ltd. 4 */ 5 6#include <linux/linkage.h> 7#include <linux/const.h> 8#include <asm/assembler.h> 9#include <asm/page.h> 10 11/* 12 * Clear page @dest 13 * 14 * Parameters: 15 * x0 - dest 16 */ 17SYM_FUNC_START(__pi_clear_page) 18#ifdef CONFIG_AS_HAS_MOPS 19 .arch_extension mops 20alternative_if_not ARM64_HAS_MOPS 21 b .Lno_mops 22alternative_else_nop_endif 23 24 mov x1, #PAGE_SIZE 25 setpn [x0]!, x1!, xzr 26 setmn [x0]!, x1!, xzr 27 seten [x0]!, x1!, xzr 28 ret 29.Lno_mops: 30#endif 31 mrs x1, dczid_el0 32 tbnz x1, #4, 2f /* Branch if DC ZVA is prohibited */ 33 and w1, w1, #0xf 34 mov x2, #4 35 lsl x1, x2, x1 36 371: dc zva, x0 38 add x0, x0, x1 39 tst x0, #(PAGE_SIZE - 1) 40 b.ne 1b 41 ret 42 432: stnp xzr, xzr, [x0] 44 stnp xzr, xzr, [x0, #16] 45 stnp xzr, xzr, [x0, #32] 46 stnp xzr, xzr, [x0, #48] 47 add x0, x0, #64 48 tst x0, #(PAGE_SIZE - 1) 49 b.ne 2b 50 ret 51SYM_FUNC_END(__pi_clear_page) 52SYM_FUNC_ALIAS(clear_page, __pi_clear_page) 53EXPORT_SYMBOL(clear_page) 54