1*b2441318SGreg Kroah-Hartman/* SPDX-License-Identifier: GPL-2.0 */ 2ae2c6ca6SDavid S. Miller/* NG4copy_to_user.S: Niagara-4 optimized copy to userspace. 3ae2c6ca6SDavid S. Miller * 4ae2c6ca6SDavid S. Miller * Copyright (C) 2012 David S. Miller (davem@davemloft.net) 5ae2c6ca6SDavid S. Miller */ 6ae2c6ca6SDavid S. Miller 795707704SDavid S. Miller#define EX_ST(x,y) \ 8ae2c6ca6SDavid S. Miller98: x; \ 9ae2c6ca6SDavid S. Miller .section __ex_table,"a";\ 10ae2c6ca6SDavid S. Miller .align 4; \ 1195707704SDavid S. Miller .word 98b, y; \ 12ae2c6ca6SDavid S. Miller .text; \ 13ae2c6ca6SDavid S. Miller .align 4; 14ae2c6ca6SDavid S. Miller 1595707704SDavid S. Miller#define EX_ST_FP(x,y) \ 16a7c5724bSRob Gardner98: x; \ 17a7c5724bSRob Gardner .section __ex_table,"a";\ 18a7c5724bSRob Gardner .align 4; \ 1995707704SDavid S. Miller .word 98b, y##_fp; \ 20a7c5724bSRob Gardner .text; \ 21a7c5724bSRob Gardner .align 4; 22a7c5724bSRob Gardner 23ae2c6ca6SDavid S. Miller#ifndef ASI_AIUS 24ae2c6ca6SDavid S. Miller#define ASI_AIUS 0x11 25ae2c6ca6SDavid S. Miller#endif 26ae2c6ca6SDavid S. Miller 27ae2c6ca6SDavid S. Miller#ifndef ASI_BLK_INIT_QUAD_LDD_AIUS 28ae2c6ca6SDavid S. Miller#define ASI_BLK_INIT_QUAD_LDD_AIUS 0x23 29ae2c6ca6SDavid S. Miller#endif 30ae2c6ca6SDavid S. Miller 31ae2c6ca6SDavid S. Miller#define FUNC_NAME NG4copy_to_user 32ae2c6ca6SDavid S. Miller#define STORE(type,src,addr) type##a src, [addr] %asi 33ae2c6ca6SDavid S. Miller#define STORE_ASI ASI_BLK_INIT_QUAD_LDD_AIUS 34ae2c6ca6SDavid S. Miller#define EX_RETVAL(x) 0 35ae2c6ca6SDavid S. Miller 36ae2c6ca6SDavid S. Miller#ifdef __KERNEL__ 37ae2c6ca6SDavid S. Miller /* Writing to %asi is _expensive_ so we hardcode it. 38ae2c6ca6SDavid S. Miller * Reading %asi to check for KERNEL_DS is comparatively 39ae2c6ca6SDavid S. Miller * cheap. 40ae2c6ca6SDavid S. Miller */ 41ae2c6ca6SDavid S. Miller#define PREAMBLE \ 42ae2c6ca6SDavid S. Miller rd %asi, %g1; \ 43ae2c6ca6SDavid S. Miller cmp %g1, ASI_AIUS; \ 4431af2f36SAl Viro bne,pn %icc, raw_copy_in_user; \ 45ae2c6ca6SDavid S. Miller nop 46ae2c6ca6SDavid S. Miller#endif 47ae2c6ca6SDavid S. Miller 48ae2c6ca6SDavid S. Miller#include "NG4memcpy.S" 49