Skip to content

Commit

Permalink
Merge tag 'microblaze-v5.19' of git://git.monstr.eu/linux-2.6-microblaze
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Linus Torvalds committed May 31, 2022
2 parents 8ab2afa + 78b5f52 commit 3335d55
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 64 deletions.
2 changes: 2 additions & 0 deletions arch/microblaze/include/asm/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

#ifdef __KERNEL__

#ifdef CONFIG_OPT_LIB_FUNCTION
#define __HAVE_ARCH_MEMSET
#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__ */

Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/kernel/kgdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#define GDB_RTLBLO 55
#define GDB_RTLBHI 56

/* keep pvr separately because it is unchangeble */
/* keep pvr separately because it is unchangeable */
static struct pvr_s pvr;

void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
Expand Down
18 changes: 2 additions & 16 deletions arch/microblaze/lib/memcpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
31 changes: 3 additions & 28 deletions arch/microblaze/lib/memmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,7 +78,7 @@ void *memmove(void *v_dst, const void *v_src, __kernel_size_t c)

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

Expand Down Expand Up @@ -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 */
33 changes: 14 additions & 19 deletions arch/microblaze/lib/memset.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,7 @@
#include <linux/compiler.h>
#include <linux/string.h>

#ifdef __HAVE_ARCH_MEMSET
#ifndef CONFIG_OPT_LIB_FUNCTION
void *memset(void *v_src, int c, __kernel_size_t n)
{
char *src = v_src;

/* Truncate c to 8 bits */
c = (c & 0xFF);

/* Simple, byte oriented memset or the rest of count. */
while (n--)
*src++ = c;

return v_src;
}
#else /* CONFIG_OPT_LIB_FUNCTION */
#ifdef CONFIG_OPT_LIB_FUNCTION
void *memset(void *v_src, int c, __kernel_size_t n)
{
char *src = v_src;
Expand Down Expand Up @@ -89,11 +74,21 @@ void *memset(void *v_src, int c, __kernel_size_t n)
}

/* Simple, byte oriented memset or the rest of count. */
while (n--)
switch (n) {
case 3:
*src++ = c;
fallthrough;
case 2:
*src++ = c;
fallthrough;
case 1:
*src++ = c;
break;
default:
break;
}

return v_src;
}
#endif /* CONFIG_OPT_LIB_FUNCTION */
EXPORT_SYMBOL(memset);
#endif /* __HAVE_ARCH_MEMSET */
#endif /* CONFIG_OPT_LIB_FUNCTION */
5 changes: 5 additions & 0 deletions arch/microblaze/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/kernel.h>
#include <linux/mm.h> /* mem_init */
#include <linux/initrd.h>
#include <linux/of_fdt.h>
#include <linux/pagemap.h>
#include <linux/pfn.h>
#include <linux/slab.h>
Expand Down Expand Up @@ -261,8 +262,12 @@ asmlinkage void __init mmu_init(void)

parse_early_param();

early_init_fdt_scan_reserved_mem();

/* CMA initialization */
dma_contiguous_reserve(memory_start + lowmem_size - 1);

memblock_dump_all();
}

void * __ref zalloc_maybe_bootmem(size_t size, gfp_t mask)
Expand Down

0 comments on commit 3335d55

Please sign in to comment.