* [PATCH 0/1] microblaze: Fix issues with freestanding
@ 2022-02-25 13:50 Michal Simek
2022-02-25 13:50 ` [PATCH 1/1] microblaze: Use simple memmove/memcpy implementation from lib/string.c Michal Simek
2022-02-25 13:56 ` [PATCH 0/1] microblaze: Fix issues with freestanding Michal Simek
0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2022-02-25 13:50 UTC (permalink / raw)
To: linux-kernel, monstr, michal.simek, git; +Cc: Mahesh Bodapati, Randy Dunlap
Hi,
with GCC 10 there is issue with simple memset implementation which is
called recursively. There are couple of discussions about it and the first
two patches are trying to workaround this.
The third patch only removes simple implementations from arch code and use
generic one which is the same.
Thanks,
Michal
Michal Simek (1):
microblaze: Use simple memmove/memcpy implementation from lib/string.c
arch/microblaze/include/asm/string.h | 2 +-
arch/microblaze/lib/memcpy.c | 18 ++---------------
arch/microblaze/lib/memmove.c | 29 ++--------------------------
3 files changed, 5 insertions(+), 44 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] microblaze: Use simple memmove/memcpy implementation from lib/string.c
2022-02-25 13:50 [PATCH 0/1] microblaze: Fix issues with freestanding Michal Simek
@ 2022-02-25 13:50 ` Michal Simek
2022-02-25 13:56 ` [PATCH 0/1] microblaze: Fix issues with freestanding Michal Simek
1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2022-02-25 13:50 UTC (permalink / raw)
To: linux-kernel, monstr, michal.simek, git; +Cc: Mahesh Bodapati, Randy Dunlap
This is based on previous commit ("microblaze: Use simple memset
implementation from lib/string.c") where generic memset implementation is
used when OPT_LIB_FUNCTION is not defined. The same change can be done for
memset/memcpy implementation where doesn't make sense to have generic
implementation in architecture code.
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---
arch/microblaze/include/asm/string.h | 2 +-
arch/microblaze/lib/memcpy.c | 18 ++---------------
arch/microblaze/lib/memmove.c | 29 ++--------------------------
3 files changed, 5 insertions(+), 44 deletions(-)
diff --git a/arch/microblaze/include/asm/string.h b/arch/microblaze/include/asm/string.h
index dbdb9eb4a733..8798ad2c132a 100644
--- a/arch/microblaze/include/asm/string.h
+++ b/arch/microblaze/include/asm/string.h
@@ -10,13 +10,13 @@
#ifdef CONFIG_OPT_LIB_FUNCTION
#define __HAVE_ARCH_MEMSET
-#endif
#define __HAVE_ARCH_MEMCPY
#define __HAVE_ARCH_MEMMOVE
extern void *memset(void *, int, __kernel_size_t);
extern void *memcpy(void *, const void *, __kernel_size_t);
extern void *memmove(void *, const void *, __kernel_size_t);
+#endif
#endif /* __KERNEL__ */
diff --git a/arch/microblaze/lib/memcpy.c b/arch/microblaze/lib/memcpy.c
index 63041fdf916d..9966dce55619 100644
--- a/arch/microblaze/lib/memcpy.c
+++ b/arch/microblaze/lib/memcpy.c
@@ -31,20 +31,7 @@
#include <linux/string.h>
-#ifdef __HAVE_ARCH_MEMCPY
-#ifndef CONFIG_OPT_LIB_FUNCTION
-void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
-{
- const char *src = v_src;
- char *dst = v_dst;
-
- /* Simple, byte oriented memcpy. */
- while (c--)
- *dst++ = *src++;
-
- return v_dst;
-}
-#else /* CONFIG_OPT_LIB_FUNCTION */
+#ifdef CONFIG_OPT_LIB_FUNCTION
void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
{
const char *src = v_src;
@@ -188,6 +175,5 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
return v_dst;
}
-#endif /* CONFIG_OPT_LIB_FUNCTION */
EXPORT_SYMBOL(memcpy);
-#endif /* __HAVE_ARCH_MEMCPY */
+#endif /* CONFIG_OPT_LIB_FUNCTION */
diff --git a/arch/microblaze/lib/memmove.c b/arch/microblaze/lib/memmove.c
index 9862f6b1e59d..2e49d0ef1e07 100644
--- a/arch/microblaze/lib/memmove.c
+++ b/arch/microblaze/lib/memmove.c
@@ -30,31 +30,7 @@
#include <linux/compiler.h>
#include <linux/string.h>
-#ifdef __HAVE_ARCH_MEMMOVE
-#ifndef CONFIG_OPT_LIB_FUNCTION
-void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
-{
- const char *src = v_src;
- char *dst = v_dst;
-
- if (!c)
- return v_dst;
-
- /* Use memcpy when source is higher than dest */
- if (v_dst <= v_src)
- return memcpy(v_dst, v_src, c);
-
- /* copy backwards, from end to beginning */
- src += c;
- dst += c;
-
- /* Simple, byte oriented memmove. */
- while (c--)
- *--dst = *--src;
-
- return v_dst;
-}
-#else /* CONFIG_OPT_LIB_FUNCTION */
+#ifdef CONFIG_OPT_LIB_FUNCTION
void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
{
const char *src = v_src;
@@ -215,6 +191,5 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
}
return v_dst;
}
-#endif /* CONFIG_OPT_LIB_FUNCTION */
EXPORT_SYMBOL(memmove);
-#endif /* __HAVE_ARCH_MEMMOVE */
+#endif /* CONFIG_OPT_LIB_FUNCTION */
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] microblaze: Fix issues with freestanding
2022-02-25 13:50 [PATCH 0/1] microblaze: Fix issues with freestanding Michal Simek
2022-02-25 13:50 ` [PATCH 1/1] microblaze: Use simple memmove/memcpy implementation from lib/string.c Michal Simek
@ 2022-02-25 13:56 ` Michal Simek
1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2022-02-25 13:56 UTC (permalink / raw)
To: Michal Simek, linux-kernel, monstr, git; +Cc: Mahesh Bodapati, Randy Dunlap
On 2/25/22 14:50, Michal Simek wrote:
> Hi,
>
> with GCC 10 there is issue with simple memset implementation which is
> called recursively. There are couple of discussions about it and the first
> two patches are trying to workaround this.
> The third patch only removes simple implementations from arch code and use
> generic one which is the same.
>
> Thanks,
> Michal
>
>
> Michal Simek (1):
> microblaze: Use simple memmove/memcpy implementation from lib/string.c
>
> arch/microblaze/include/asm/string.h | 2 +-
> arch/microblaze/lib/memcpy.c | 18 ++---------------
> arch/microblaze/lib/memmove.c | 29 ++--------------------------
> 3 files changed, 5 insertions(+), 44 deletions(-)
>
I didn't send all 3 patches. Sorry about it. V2 has all required changes.
Thanks,
Michal
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-25 13:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-25 13:50 [PATCH 0/1] microblaze: Fix issues with freestanding Michal Simek
2022-02-25 13:50 ` [PATCH 1/1] microblaze: Use simple memmove/memcpy implementation from lib/string.c Michal Simek
2022-02-25 13:56 ` [PATCH 0/1] microblaze: Fix issues with freestanding Michal Simek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.