1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2023 SiFive
4 * Author: Andy Chiu <andy.chiu@sifive.com>
6 #include <linux/linkage.h>
9 #include <asm/vector.h>
13 #include <asm/asm-prototypes.h>
17 size_t riscv_v_usercopy_threshold
= CONFIG_RISCV_ISA_V_UCOPY_THRESHOLD
;
18 int __asm_vector_usercopy(void *dst
, void *src
, size_t n
);
19 int fallback_scalar_usercopy(void *dst
, void *src
, size_t n
);
20 asmlinkage
int enter_vector_usercopy(void *dst
, void *src
, size_t n
)
22 size_t remain
, copied
;
24 /* skip has_vector() check because it has been done by the asm */
28 kernel_vector_begin();
29 remain
= __asm_vector_usercopy(dst
, src
, n
);
43 return fallback_scalar_usercopy(dst
, src
, n
);