/* SPDX-License-Identifier: GPL-2.0-only */1/*2* Copyright (C) 2012 ARM Ltd.3*/45#include <linux/linkage.h>6#include <linux/const.h>7#include <asm/assembler.h>8#include <asm/page.h>910/*11* Clear page @dest12*13* Parameters:14* x0 - dest15*/16SYM_FUNC_START(__pi_clear_page)17#ifdef CONFIG_AS_HAS_MOPS18.arch_extension mops19alternative_if_not ARM64_HAS_MOPS20b .Lno_mops21alternative_else_nop_endif2223mov x1, #PAGE_SIZE24setpn [x0]!, x1!, xzr25setmn [x0]!, x1!, xzr26seten [x0]!, x1!, xzr27ret28.Lno_mops:29#endif30mrs x1, dczid_el031tbnz x1, #4, 2f /* Branch if DC ZVA is prohibited */32and w1, w1, #0xf33mov x2, #434lsl x1, x2, x135361: dc zva, x037add x0, x0, x138tst x0, #(PAGE_SIZE - 1)39b.ne 1b40ret41422: stnp xzr, xzr, [x0]43stnp xzr, xzr, [x0, #16]44stnp xzr, xzr, [x0, #32]45stnp xzr, xzr, [x0, #48]46add x0, x0, #6447tst x0, #(PAGE_SIZE - 1)48b.ne 2b49ret50SYM_FUNC_END(__pi_clear_page)51SYM_FUNC_ALIAS(clear_page, __pi_clear_page)52EXPORT_SYMBOL(clear_page)535455