• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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	mrs	x1, dczid_el0
19	tbnz	x1, #4, 2f	/* Branch if DC ZVA is prohibited */
20	and	w1, w1, #0xf
21	mov	x2, #4
22	lsl	x1, x2, x1
23
241:	dc	zva, x0
25	add	x0, x0, x1
26	tst	x0, #(PAGE_SIZE - 1)
27	b.ne	1b
28	ret
29
302:	stnp	xzr, xzr, [x0]
31	stnp	xzr, xzr, [x0, #16]
32	stnp	xzr, xzr, [x0, #32]
33	stnp	xzr, xzr, [x0, #48]
34	add	x0, x0, #64
35	tst	x0, #(PAGE_SIZE - 1)
36	b.ne	2b
37	ret
38SYM_FUNC_END_PI(clear_page)
39EXPORT_SYMBOL(clear_page)
40