1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (C) 1999-2002 Hewlett-Packard Co
4 * Stephane Eranian <eranian@hpl.hp.com>
5 * David Mosberger-Tang <davidm@hpl.hp.com>
6 * Copyright (C) 2002 Ken Chen <kenneth.w.chen@intel.com>
8 * 1/06/01 davidm Tuned for Itanium.
9 * 2/12/02 kchen Tuned for both Itanium and McKinley
10 * 3/08/02 davidm Some more tweaking
13 #include <asm/asmmacro.h>
15 #include <asm/export.h>
18 # define L3_LINE_SIZE 64 // Itanium L3 line size
19 # define PREFETCH_LINES 9 // magic number
21 # define L3_LINE_SIZE 128 // McKinley L3 line size
22 # define PREFETCH_LINES 12 // magic number
34 GLOBAL_ENTRY(clear_page)
37 mov r16 = PAGE_SIZE/L3_LINE_SIZE-1 // main loop count, -1=repeat/until
42 mov ar.lc = (PREFETCH_LINES - 1)
47 .fetch: stf.spill.nta [dst_fetch] = f0, L3_LINE_SIZE
48 adds dst3 = 48, in0 // executing this multiple times is harmless
49 br.cloop.sptk.few .fetch
51 addl dst_last = (PAGE_SIZE - PREFETCH_LINES*L3_LINE_SIZE), dst_fetch
52 mov ar.lc = r16 // one L3 line per iteration
56 // Optimized for Itanium
57 1: stf.spill.nta [dst1] = f0, 64
58 stf.spill.nta [dst2] = f0, 64
59 cmp.lt p8,p0=dst_fetch, dst_last
62 // Optimized for McKinley
63 1: stf.spill.nta [dst1] = f0, 64
64 stf.spill.nta [dst2] = f0, 64
65 stf.spill.nta [dst3] = f0, 64
66 stf.spill.nta [dst4] = f0, 128
67 cmp.lt p8,p0=dst_fetch, dst_last
69 stf.spill.nta [dst1] = f0, 64
70 stf.spill.nta [dst2] = f0, 64
72 stf.spill.nta [dst3] = f0, 64
73 (p8) stf.spill.nta [dst_fetch] = f0, L3_LINE_SIZE
76 mov ar.lc = saved_lc // restore lc
79 EXPORT_SYMBOL(clear_page)