Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze
Browse files Browse the repository at this point in the history
* 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze: (49 commits)
  microblaze: Add KGDB support
  microblaze: Support brki rX, 0x18 for user application debugging
  microblaze: Remove nop after MSRCLR/SET, MTS, MFS instructions
  microblaze: Simplify syscall rutine
  microblaze: Move PT_MODE saving to delay slot
  microblaze: Fix _interrupt function
  microblaze: Fix _user_exception function
  microblaze: Put together addik instructions
  microblaze: Use delay slot in syscall macros
  microblaze: Save kernel mode in delay slot
  microblaze: Do not mix register saving and mode setting
  microblaze: Move SAVE_STATE upward
  microblaze: entry.S: Macro optimization
  microblaze: Optimize hw exception rutine
  microblaze: Implement clear_ums macro and fix SAVE_STATE macro
  microblaze: Remove additional setup for kernel_mode
  microblaze: Optimize SAVE_STATE macro
  microblaze: Remove additional loading
  microblaze: Completely remove working with R11 register
  microblaze: Do not setup BIP in _debug_exception
  ...
  • Loading branch information
torvalds committed Aug 5, 2010
2 parents 673b864 + 2d5973c commit bbc4fd1
Show file tree
Hide file tree
Showing 34 changed files with 977 additions and 544 deletions.
31 changes: 31 additions & 0 deletions arch/microblaze/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ config MICROBLAZE
select USB_ARCH_HAS_EHCI
select ARCH_WANT_OPTIONAL_GPIOLIB
select HAVE_OPROFILE
select HAVE_ARCH_KGDB
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG
select TRACING_SUPPORT
Expand Down Expand Up @@ -223,6 +224,36 @@ config TASK_SIZE
hex "Size of user task space" if TASK_SIZE_BOOL
default "0x80000000"

choice
prompt "Page size"
default MICROBLAZE_4K_PAGES
depends on ADVANCED_OPTIONS && !MMU
help
Select the kernel logical page size. Increasing the page size
will reduce software overhead at each page boundary, allow
hardware prefetch mechanisms to be more effective, and allow
larger dma transfers increasing IO efficiency and reducing
overhead. However the utilization of memory will increase.
For example, each cached file will using a multiple of the
page size to hold its contents and the difference between the
end of file and the end of page is wasted.

If unsure, choose 4K_PAGES.

config MICROBLAZE_4K_PAGES
bool "4k page size"

config MICROBLAZE_8K_PAGES
bool "8k page size"

config MICROBLAZE_16K_PAGES
bool "16k page size"

config MICROBLAZE_32K_PAGES
bool "32k page size"

endchoice

endmenu

source "mm/Kconfig"
Expand Down
1 change: 1 addition & 0 deletions arch/microblaze/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ source "lib/Kconfig.debug"

config EARLY_PRINTK
bool "Early printk function for kernel"
depends on SERIAL_UARTLITE_CONSOLE
default n
help
This option turns on/off early printk messages to console.
Expand Down
11 changes: 6 additions & 5 deletions arch/microblaze/boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ quiet_cmd_cp = CP $< $@$2
cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)

quiet_cmd_strip = STRIP $@
cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@
cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
-K _fdt_start vmlinux -o $@

quiet_cmd_uimage = UIMAGE $@.ub
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
-C none -n 'Linux-$(KERNELRELEASE)' \
-a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
-d $@ $@.ub
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
-C none -n 'Linux-$(KERNELRELEASE)' \
-a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
-d $@ [email protected]

$(obj)/simpleImage.%: vmlinux FORCE
$(call if_changed,cp,.unstrip)
Expand Down
18 changes: 13 additions & 5 deletions arch/microblaze/include/asm/cacheflush.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

/* Somebody depends on this; sigh... */
#include <linux/mm.h>
#include <linux/io.h>

/* Look at Documentation/cachetlb.txt */

Expand Down Expand Up @@ -60,7 +61,6 @@ void microblaze_cache_init(void);
#define invalidate_icache() mbc->iin();
#define invalidate_icache_range(start, end) mbc->iinr(start, end);


#define flush_icache_user_range(vma, pg, adr, len) flush_icache();
#define flush_icache_page(vma, pg) do { } while (0)

Expand All @@ -72,9 +72,15 @@ void microblaze_cache_init(void);
#define flush_dcache() mbc->dfl();
#define flush_dcache_range(start, end) mbc->dflr(start, end);

#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
/* D-cache aliasing problem can't happen - cache is between MMU and ram */
#define flush_dcache_page(page) do { } while (0)
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
/* MS: We have to implement it because of rootfs-jffs2 issue on WB */
#define flush_dcache_page(page) \
do { \
unsigned long addr = (unsigned long) page_address(page); /* virtual */ \
addr = (u32)virt_to_phys((void *)addr); \
flush_dcache_range((unsigned) (addr), (unsigned) (addr) + PAGE_SIZE); \
} while (0);

#define flush_dcache_mmap_lock(mapping) do { } while (0)
#define flush_dcache_mmap_unlock(mapping) do { } while (0)

Expand All @@ -97,8 +103,10 @@ void microblaze_cache_init(void);

#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
do { \
u32 addr = virt_to_phys(dst); \
invalidate_icache_range((unsigned) (addr), (unsigned) (addr) + (len));\
memcpy((dst), (src), (len)); \
flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \
flush_dcache_range((unsigned) (addr), (unsigned) (addr) + (len));\
} while (0)

#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
Expand Down
6 changes: 0 additions & 6 deletions arch/microblaze/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ static inline int dma_supported(struct device *dev, u64 mask)
return ops->dma_supported(dev, mask);
}

#ifdef CONFIG_PCI
/* We have our own implementation of pci_set_dma_mask() */
#define HAVE_ARCH_PCI_SET_DMA_MASK

#endif

static inline int dma_set_mask(struct device *dev, u64 dma_mask)
{
struct dma_map_ops *ops = get_dma_ops(dev);
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
#define ELF_DATA ELFDATA2MSB
#endif

#define ELF_EXEC_PAGESIZE 4096
#define ELF_EXEC_PAGESIZE PAGE_SIZE


#define ELF_CORE_COPY_REGS(_dest, _regs) \
Expand Down
21 changes: 5 additions & 16 deletions arch/microblaze/include/asm/exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
#define _ASM_MICROBLAZE_EXCEPTIONS_H

#ifdef __KERNEL__

#ifndef CONFIG_MMU
#define EX_HANDLER_STACK_SIZ (4*19)
#endif

#ifndef __ASSEMBLY__

/* Macros to enable and disable HW exceptions in the MSR */
Expand Down Expand Up @@ -64,22 +69,6 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
void die(const char *str, struct pt_regs *fp, long err);
void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);

#if defined(CONFIG_KGDB)
void (*debugger)(struct pt_regs *regs);
int (*debugger_bpt)(struct pt_regs *regs);
int (*debugger_sstep)(struct pt_regs *regs);
int (*debugger_iabr_match)(struct pt_regs *regs);
int (*debugger_dabr_match)(struct pt_regs *regs);
void (*debugger_fault_handler)(struct pt_regs *regs);
#else
#define debugger(regs) do { } while (0)
#define debugger_bpt(regs) 0
#define debugger_sstep(regs) 0
#define debugger_iabr_match(regs) 0
#define debugger_dabr_match(regs) 0
#define debugger_fault_handler ((void (*)(struct pt_regs *))0)
#endif

#endif /*__ASSEMBLY__ */
#endif /* __KERNEL__ */
#endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */
28 changes: 28 additions & 0 deletions arch/microblaze/include/asm/kgdb.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifdef __KERNEL__
#ifndef __MICROBLAZE_KGDB_H__
#define __MICROBLAZE_KGDB_H__

#ifndef __ASSEMBLY__

#define CACHE_FLUSH_IS_SAFE 1
#define BUFMAX 2048

/*
* 32 32-bit general purpose registers (r0-r31)
* 6 32-bit special registers (pc, msr, ear, esr, fsr, btr)
* 12 32-bit PVR
* 7 32-bit MMU Regs (redr, rpid, rzpr, rtlbx, rtlbsx, rtlblo, rtlbhi)
* ------
* 57 registers
*/
#define NUMREGBYTES (57 * 4)

#define BREAK_INSTR_SIZE 4
static inline void arch_kgdb_breakpoint(void)
{
__asm__ __volatile__("brki r16, 0x18;");
}

#endif /* __ASSEMBLY__ */
#endif /* __MICROBLAZE_KGDB_H__ */
#endif /* __KERNEL__ */
12 changes: 10 additions & 2 deletions arch/microblaze/include/asm/page.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,16 @@
#ifdef __KERNEL__

/* PAGE_SHIFT determines the page size */
#define PAGE_SHIFT (12)
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
#if defined(CONFIG_MICROBLAZE_32K_PAGES)
#define PAGE_SHIFT 15
#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
#define PAGE_SHIFT 14
#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
#define PAGE_SHIFT 13
#else
#define PAGE_SHIFT 12
#endif
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))

#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
Expand Down
2 changes: 1 addition & 1 deletion arch/microblaze/include/asm/pvr.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#define PVR_MSR_BIT 0x400

struct pvr_s {
unsigned pvr[16];
unsigned pvr[12];
};

/* The following taken from Xilinx's standalone BSP pvr.h */
Expand Down
2 changes: 0 additions & 2 deletions arch/microblaze/include/asm/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ void disable_early_printk(void);
void heartbeat(void);
void setup_heartbeat(void);

unsigned long long sched_clock(void);

# ifdef CONFIG_MMU
extern void mmu_reset(void);
extern void early_console_reg_tlb_alloc(unsigned int addr);
Expand Down
1 change: 0 additions & 1 deletion arch/microblaze/include/asm/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ extern struct task_struct *_switch_to(struct thread_info *prev,
#define smp_rmb() rmb()
#define smp_wmb() wmb()

void show_trace(struct task_struct *task, unsigned long *stack);
void __bad_xchg(volatile void *ptr, int size);

static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
Expand Down
4 changes: 2 additions & 2 deletions arch/microblaze/include/asm/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ extern long __user_bad(void);
__copy_tofrom_user((__force void __user *)(to), \
(void __user *)(from), (n))
#define __copy_from_user_inatomic(to, from, n) \
copy_from_user((to), (from), (n))
__copy_from_user((to), (from), (n))

static inline long copy_from_user(void *to,
const void __user *from, unsigned long n)
Expand All @@ -373,7 +373,7 @@ static inline long copy_from_user(void *to,
#define __copy_to_user(to, from, n) \
__copy_tofrom_user((void __user *)(to), \
(__force const void __user *)(from), (n))
#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n))
#define __copy_to_user_inatomic(to, from, n) __copy_to_user((to), (from), (n))

static inline long copy_to_user(void __user *to,
const void *from, unsigned long n)
Expand Down
29 changes: 29 additions & 0 deletions arch/microblaze/include/asm/unwind.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Backtrace support for Microblaze
*
* Copyright (C) 2010 Digital Design Corporation
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/

#ifndef __MICROBLAZE_UNWIND_H
#define __MICROBLAZE_UNWIND_H

struct stack_trace;

struct trap_handler_info {
unsigned long start_addr;
unsigned long end_addr;
const char *trap_name;
};
extern struct trap_handler_info microblaze_trap_handlers;

extern const char _hw_exception_handler;
extern const char ex_handler_unhandled;

void microblaze_unwind(struct task_struct *task, struct stack_trace *trace);

#endif /* __MICROBLAZE_UNWIND_H */

3 changes: 2 additions & 1 deletion arch/microblaze/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extra-y := head.o vmlinux.lds
obj-y += dma.o exceptions.o \
hw_exception_handler.o init_task.o intc.o irq.o of_device.o \
of_platform.o process.o prom.o prom_parse.o ptrace.o \
setup.o signal.o sys_microblaze.o timer.o traps.o reset.o
reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o

obj-y += cpu/

Expand All @@ -28,5 +28,6 @@ obj-$(CONFIG_MODULES) += microblaze_ksyms.o module.o
obj-$(CONFIG_MMU) += misc.o
obj-$(CONFIG_STACKTRACE) += stacktrace.o
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o mcount.o
obj-$(CONFIG_KGDB) += kgdb.o

obj-y += entry$(MMU).o
1 change: 1 addition & 0 deletions arch/microblaze/kernel/cpu/mb.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
cpuinfo.pvr_user1,
cpuinfo.pvr_user2);

count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
return 0;
}

Expand Down
28 changes: 28 additions & 0 deletions arch/microblaze/kernel/entry-nommu.S
Original file line number Diff line number Diff line change
Expand Up @@ -588,3 +588,31 @@ sys_rt_sigsuspend_wrapper:
#include "syscall_table.S"

syscall_table_size=(.-sys_call_table)

type_SYSCALL:
.ascii "SYSCALL\0"
type_IRQ:
.ascii "IRQ\0"
type_IRQ_PREEMPT:
.ascii "IRQ (PREEMPTED)\0"
type_SYSCALL_PREEMPT:
.ascii " SYSCALL (PREEMPTED)\0"

/*
* Trap decoding for stack unwinder
* Tuples are (start addr, end addr, string)
* If return address lies on [start addr, end addr],
* unwinder displays 'string'
*/

.align 4
.global microblaze_trap_handlers
microblaze_trap_handlers:
/* Exact matches come first */
.word ret_to_user ; .word ret_to_user ; .word type_SYSCALL
.word ret_from_intr; .word ret_from_intr ; .word type_IRQ
/* Fuzzy matches go here */
.word ret_from_intr; .word no_intr_resched; .word type_IRQ_PREEMPT
.word work_pending ; .word no_work_pending; .word type_SYSCALL_PREEMPT
/* End of table */
.word 0 ; .word 0 ; .word 0
Loading

0 comments on commit bbc4fd1

Please sign in to comment.