Skip to content

Commit 3335d55

Browse files
committed
Merge tag 'microblaze-v5.19' of git://git.monstr.eu/linux-2.6-microblaze
Pull microblaze updates from Michal Simek: - Fix issues with freestanding - Wire memblock_dump_all() - Add support for memory reservation from DT * tag 'microblaze-v5.19' of git://git.monstr.eu/linux-2.6-microblaze: microblaze: fix typos in comments microblaze: Add support for reserved memory defined by DT microblaze: Wire memblock_dump_all() microblaze: Use simple memmove/memcpy implementation from lib/string.c microblaze: Do loop unrolling for optimized memset implementation microblaze: Use simple memset implementation from lib/string.c
2 parents 8ab2afa + 78b5f52 commit 3335d55

File tree

6 files changed

+27
-64
lines changed

6 files changed

+27
-64
lines changed

arch/microblaze/include/asm/string.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
#ifdef __KERNEL__
1010

11+
#ifdef CONFIG_OPT_LIB_FUNCTION
1112
#define __HAVE_ARCH_MEMSET
1213
#define __HAVE_ARCH_MEMCPY
1314
#define __HAVE_ARCH_MEMMOVE
1415

1516
extern void *memset(void *, int, __kernel_size_t);
1617
extern void *memcpy(void *, const void *, __kernel_size_t);
1718
extern void *memmove(void *, const void *, __kernel_size_t);
19+
#endif
1820

1921
#endif /* __KERNEL__ */
2022

arch/microblaze/kernel/kgdb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#define GDB_RTLBLO 55
3232
#define GDB_RTLBHI 56
3333

34-
/* keep pvr separately because it is unchangeble */
34+
/* keep pvr separately because it is unchangeable */
3535
static struct pvr_s pvr;
3636

3737
void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)

arch/microblaze/lib/memcpy.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,20 +31,7 @@
3131

3232
#include <linux/string.h>
3333

34-
#ifdef __HAVE_ARCH_MEMCPY
35-
#ifndef CONFIG_OPT_LIB_FUNCTION
36-
void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
37-
{
38-
const char *src = v_src;
39-
char *dst = v_dst;
40-
41-
/* Simple, byte oriented memcpy. */
42-
while (c--)
43-
*dst++ = *src++;
44-
45-
return v_dst;
46-
}
47-
#else /* CONFIG_OPT_LIB_FUNCTION */
34+
#ifdef CONFIG_OPT_LIB_FUNCTION
4835
void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
4936
{
5037
const char *src = v_src;
@@ -188,6 +175,5 @@ void *memcpy(void *v_dst, const void *v_src, __kernel_size_t c)
188175

189176
return v_dst;
190177
}
191-
#endif /* CONFIG_OPT_LIB_FUNCTION */
192178
EXPORT_SYMBOL(memcpy);
193-
#endif /* __HAVE_ARCH_MEMCPY */
179+
#endif /* CONFIG_OPT_LIB_FUNCTION */

arch/microblaze/lib/memmove.c

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,7 @@
3030
#include <linux/compiler.h>
3131
#include <linux/string.h>
3232

33-
#ifdef __HAVE_ARCH_MEMMOVE
34-
#ifndef CONFIG_OPT_LIB_FUNCTION
35-
void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
36-
{
37-
const char *src = v_src;
38-
char *dst = v_dst;
39-
40-
if (!c)
41-
return v_dst;
42-
43-
/* Use memcpy when source is higher than dest */
44-
if (v_dst <= v_src)
45-
return memcpy(v_dst, v_src, c);
46-
47-
/* copy backwards, from end to beginning */
48-
src += c;
49-
dst += c;
50-
51-
/* Simple, byte oriented memmove. */
52-
while (c--)
53-
*--dst = *--src;
54-
55-
return v_dst;
56-
}
57-
#else /* CONFIG_OPT_LIB_FUNCTION */
33+
#ifdef CONFIG_OPT_LIB_FUNCTION
5834
void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
5935
{
6036
const char *src = v_src;
@@ -102,7 +78,7 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
10278

10379
i_dst = (void *)dst;
10480
/* Choose a copy scheme based on the source */
105-
/* alignment relative to dstination. */
81+
/* alignment relative to destination. */
10682
switch ((unsigned long)src & 3) {
10783
case 0x0: /* Both byte offsets are aligned */
10884

@@ -215,6 +191,5 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)
215191
}
216192
return v_dst;
217193
}
218-
#endif /* CONFIG_OPT_LIB_FUNCTION */
219194
EXPORT_SYMBOL(memmove);
220-
#endif /* __HAVE_ARCH_MEMMOVE */
195+
#endif /* CONFIG_OPT_LIB_FUNCTION */

arch/microblaze/lib/memset.c

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,7 @@
3030
#include <linux/compiler.h>
3131
#include <linux/string.h>
3232

33-
#ifdef __HAVE_ARCH_MEMSET
34-
#ifndef CONFIG_OPT_LIB_FUNCTION
35-
void *memset(void *v_src, int c, __kernel_size_t n)
36-
{
37-
char *src = v_src;
38-
39-
/* Truncate c to 8 bits */
40-
c = (c & 0xFF);
41-
42-
/* Simple, byte oriented memset or the rest of count. */
43-
while (n--)
44-
*src++ = c;
45-
46-
return v_src;
47-
}
48-
#else /* CONFIG_OPT_LIB_FUNCTION */
33+
#ifdef CONFIG_OPT_LIB_FUNCTION
4934
void *memset(void *v_src, int c, __kernel_size_t n)
5035
{
5136
char *src = v_src;
@@ -89,11 +74,21 @@ void *memset(void *v_src, int c, __kernel_size_t n)
8974
}
9075

9176
/* Simple, byte oriented memset or the rest of count. */
92-
while (n--)
77+
switch (n) {
78+
case 3:
79+
*src++ = c;
80+
fallthrough;
81+
case 2:
9382
*src++ = c;
83+
fallthrough;
84+
case 1:
85+
*src++ = c;
86+
break;
87+
default:
88+
break;
89+
}
9490

9591
return v_src;
9692
}
97-
#endif /* CONFIG_OPT_LIB_FUNCTION */
9893
EXPORT_SYMBOL(memset);
99-
#endif /* __HAVE_ARCH_MEMSET */
94+
#endif /* CONFIG_OPT_LIB_FUNCTION */

arch/microblaze/mm/init.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/kernel.h>
1414
#include <linux/mm.h> /* mem_init */
1515
#include <linux/initrd.h>
16+
#include <linux/of_fdt.h>
1617
#include <linux/pagemap.h>
1718
#include <linux/pfn.h>
1819
#include <linux/slab.h>
@@ -261,8 +262,12 @@ asmlinkage void __init mmu_init(void)
261262

262263
parse_early_param();
263264

265+
early_init_fdt_scan_reserved_mem();
266+
264267
/* CMA initialization */
265268
dma_contiguous_reserve(memory_start + lowmem_size - 1);
269+
270+
memblock_dump_all();
266271
}
267272

268273
void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)

0 commit comments

Comments
 (0)