Skip to content

Commit

Permalink
csky: Add C based string functions
Browse files Browse the repository at this point in the history
Try to access RAM with the largest bit width possible, but without
doing unaligned accesses.

A further improvement could be to use multiple read and writes as the
assembly version was trying to do.

Tested on a BeagleV Starlight with a SiFive U74 core, where the
improvement is noticeable.

Signed-off-by: Matteo Croce <mcroce@microsoft.com>
Co-developed-by: Guo Ren <guoren@linux.alibaba.com>
Signed-off-by: Guo Ren <guoren@linux.alibaba.com>
  • Loading branch information
teknoraver authored and intel-lab-lkp committed Apr 4, 2022
1 parent 6a2f0b2 commit e8231df
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 348 deletions.
8 changes: 8 additions & 0 deletions arch/csky/Kconfig
Expand Up @@ -321,6 +321,14 @@ config HOTPLUG_CPU
controlled through /sys/devices/system/cpu/cpu1/hotplug/target.

Say N if you want to disable CPU hotplug.

config HAVE_EFFICIENT_UNALIGNED_ACCESS
bool "Enable EFFICIENT_UNALIGNED_ACCESS for abiv2"
depends on CPU_CK807 || CPU_CK810 || CPU_CK860
help
Say Y here to enable EFFICIENT_UNALIGNED_ACCESS. Some CPU models could
deal with unaligned access by hardware.

endmenu

source "arch/csky/Kconfig.platforms"
Expand Down
1 change: 0 additions & 1 deletion arch/csky/abiv1/Makefile
Expand Up @@ -4,5 +4,4 @@ obj-y += bswapdi.o
obj-y += bswapsi.o
obj-y += cacheflush.o
obj-y += mmap.o
obj-y += memcpy.o
obj-y += strksyms.o
347 changes: 0 additions & 347 deletions arch/csky/abiv1/memcpy.S

This file was deleted.

2 changes: 2 additions & 0 deletions arch/csky/abiv2/Makefile
Expand Up @@ -2,9 +2,11 @@
obj-y += cacheflush.o
obj-$(CONFIG_CPU_HAS_FPU) += fpu.o
obj-y += memcmp.o
ifeq ($(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), y)
obj-y += memcpy.o
obj-y += memmove.o
obj-y += memset.o
endif
obj-y += strcmp.o
obj-y += strcpy.o
obj-y += strlen.o
Expand Down
3 changes: 3 additions & 0 deletions arch/csky/lib/Makefile
@@ -1,3 +1,6 @@
# SPDX-License-Identifier: GPL-2.0-only
lib-y := usercopy.o delay.o
obj-$(CONFIG_FUNCTION_ERROR_INJECTION) += error-inject.o
ifneq ($(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS), y)
lib-y += string.o
endif

0 comments on commit e8231df

Please sign in to comment.