/* SPDX-License-Identifier: GPL-2.0-only */12#include <linux/linkage.h>3#include <asm/asm.h>4#include <asm/asm-extable.h>5#include <asm/csr.h>67#define pDst a08#define pSrc a19#define iNum a21011#define iVL a31213#define ELEM_LMUL_SETTING m814#define vData v01516.macro fixup op reg addr lbl17100:18\op \reg, \addr19_asm_extable 100b, \lbl20.endm2122SYM_FUNC_START(__asm_vector_usercopy)23/* Enable access to user memory */24li t6, SR_SUM25csrs CSR_STATUS, t626mv t6, ra2728call __asm_vector_usercopy_sum_enabled2930/* Disable access to user memory */31mv ra, t632li t6, SR_SUM33csrc CSR_STATUS, t634ret35SYM_FUNC_END(__asm_vector_usercopy)3637SYM_FUNC_START(__asm_vector_usercopy_sum_enabled)38loop:39vsetvli iVL, iNum, e8, ELEM_LMUL_SETTING, ta, ma40fixup vle8.v vData, (pSrc), 10f41sub iNum, iNum, iVL42add pSrc, pSrc, iVL43fixup vse8.v vData, (pDst), 11f44add pDst, pDst, iVL45bnez iNum, loop4647/* Exception fixup for vector load is shared with normal exit */4810:49mv a0, iNum50ret5152/* Exception fixup code for vector store. */5311:54/* Undo the subtraction after vle8.v */55add iNum, iNum, iVL56/* Make sure the scalar fallback skip already processed bytes */57csrr t2, CSR_VSTART58sub iNum, iNum, t259j 10b60SYM_FUNC_END(__asm_vector_usercopy_sum_enabled)616263