Skip to content

Commit bbc4fd1

Browse files
committed
Merge branch 'for-linus' of git://git.monstr.eu/linux-2.6-microblaze
* '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 ...
2 parents 673b864 + 2d5973c commit bbc4fd1

34 files changed

Lines changed: 977 additions & 544 deletions

‎arch/microblaze/Kconfig‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ config MICROBLAZE
1414
select USB_ARCH_HAS_EHCI
1515
select ARCH_WANT_OPTIONAL_GPIOLIB
1616
select HAVE_OPROFILE
17+
select HAVE_ARCH_KGDB
1718
select HAVE_DMA_ATTRS
1819
select HAVE_DMA_API_DEBUG
1920
select TRACING_SUPPORT
@@ -223,6 +224,36 @@ config TASK_SIZE
223224
hex "Size of user task space" if TASK_SIZE_BOOL
224225
default "0x80000000"
225226

227+
choice
228+
prompt "Page size"
229+
default MICROBLAZE_4K_PAGES
230+
depends on ADVANCED_OPTIONS && !MMU
231+
help
232+
Select the kernel logical page size. Increasing the page size
233+
will reduce software overhead at each page boundary, allow
234+
hardware prefetch mechanisms to be more effective, and allow
235+
larger dma transfers increasing IO efficiency and reducing
236+
overhead. However the utilization of memory will increase.
237+
For example, each cached file will using a multiple of the
238+
page size to hold its contents and the difference between the
239+
end of file and the end of page is wasted.
240+
241+
If unsure, choose 4K_PAGES.
242+
243+
config MICROBLAZE_4K_PAGES
244+
bool "4k page size"
245+
246+
config MICROBLAZE_8K_PAGES
247+
bool "8k page size"
248+
249+
config MICROBLAZE_16K_PAGES
250+
bool "16k page size"
251+
252+
config MICROBLAZE_32K_PAGES
253+
bool "32k page size"
254+
255+
endchoice
256+
226257
endmenu
227258

228259
source "mm/Kconfig"

‎arch/microblaze/Kconfig.debug‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ source "lib/Kconfig.debug"
1010

1111
config EARLY_PRINTK
1212
bool "Early printk function for kernel"
13+
depends on SERIAL_UARTLITE_CONSOLE
1314
default n
1415
help
1516
This option turns on/off early printk messages to console.

‎arch/microblaze/boot/Makefile‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,14 @@ quiet_cmd_cp = CP $< $@$2
3535
cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
3636

3737
quiet_cmd_strip = STRIP $@
38-
cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@
38+
cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
39+
-K _fdt_start vmlinux -o $@
3940

4041
quiet_cmd_uimage = UIMAGE $@.ub
41-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
42-
-C none -n 'Linux-$(KERNELRELEASE)' \
43-
-a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
44-
-d $@ $@.ub
42+
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
43+
-C none -n 'Linux-$(KERNELRELEASE)' \
44+
-a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
45+
-d $@ $@.ub
4546

4647
$(obj)/simpleImage.%: vmlinux FORCE
4748
$(call if_changed,cp,.unstrip)

‎arch/microblaze/include/asm/cacheflush.h‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
/* Somebody depends on this; sigh... */
1919
#include <linux/mm.h>
20+
#include <linux/io.h>
2021

2122
/* Look at Documentation/cachetlb.txt */
2223

@@ -60,7 +61,6 @@ void microblaze_cache_init(void);
6061
#define invalidate_icache() mbc->iin();
6162
#define invalidate_icache_range(start, end) mbc->iinr(start, end);
6263

63-
6464
#define flush_icache_user_range(vma, pg, adr, len) flush_icache();
6565
#define flush_icache_page(vma, pg) do { } while (0)
6666

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

75-
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
76-
/* D-cache aliasing problem can't happen - cache is between MMU and ram */
77-
#define flush_dcache_page(page) do { } while (0)
75+
#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
76+
/* MS: We have to implement it because of rootfs-jffs2 issue on WB */
77+
#define flush_dcache_page(page) \
78+
do { \
79+
unsigned long addr = (unsigned long) page_address(page); /* virtual */ \
80+
addr = (u32)virt_to_phys((void *)addr); \
81+
flush_dcache_range((unsigned) (addr), (unsigned) (addr) + PAGE_SIZE); \
82+
} while (0);
83+
7884
#define flush_dcache_mmap_lock(mapping) do { } while (0)
7985
#define flush_dcache_mmap_unlock(mapping) do { } while (0)
8086

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

98104
#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
99105
do { \
106+
u32 addr = virt_to_phys(dst); \
107+
invalidate_icache_range((unsigned) (addr), (unsigned) (addr) + (len));\
100108
memcpy((dst), (src), (len)); \
101-
flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \
109+
flush_dcache_range((unsigned) (addr), (unsigned) (addr) + (len));\
102110
} while (0)
103111

104112
#define copy_from_user_page(vma, page, vaddr, dst, src, len) \

‎arch/microblaze/include/asm/dma-mapping.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ static inline int dma_supported(struct device *dev, u64 mask)
7979
return ops->dma_supported(dev, mask);
8080
}
8181

82-
#ifdef CONFIG_PCI
83-
/* We have our own implementation of pci_set_dma_mask() */
84-
#define HAVE_ARCH_PCI_SET_DMA_MASK
85-
86-
#endif
87-
8882
static inline int dma_set_mask(struct device *dev, u64 dma_mask)
8983
{
9084
struct dma_map_ops *ops = get_dma_ops(dev);

‎arch/microblaze/include/asm/elf.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
7777
#define ELF_DATA ELFDATA2MSB
7878
#endif
7979

80-
#define ELF_EXEC_PAGESIZE 4096
80+
#define ELF_EXEC_PAGESIZE PAGE_SIZE
8181

8282

8383
#define ELF_CORE_COPY_REGS(_dest, _regs) \

‎arch/microblaze/include/asm/exceptions.h‎

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
#define _ASM_MICROBLAZE_EXCEPTIONS_H
1515

1616
#ifdef __KERNEL__
17+
18+
#ifndef CONFIG_MMU
19+
#define EX_HANDLER_STACK_SIZ (4*19)
20+
#endif
21+
1722
#ifndef __ASSEMBLY__
1823

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

67-
#if defined(CONFIG_KGDB)
68-
void (*debugger)(struct pt_regs *regs);
69-
int (*debugger_bpt)(struct pt_regs *regs);
70-
int (*debugger_sstep)(struct pt_regs *regs);
71-
int (*debugger_iabr_match)(struct pt_regs *regs);
72-
int (*debugger_dabr_match)(struct pt_regs *regs);
73-
void (*debugger_fault_handler)(struct pt_regs *regs);
74-
#else
75-
#define debugger(regs) do { } while (0)
76-
#define debugger_bpt(regs) 0
77-
#define debugger_sstep(regs) 0
78-
#define debugger_iabr_match(regs) 0
79-
#define debugger_dabr_match(regs) 0
80-
#define debugger_fault_handler ((void (*)(struct pt_regs *))0)
81-
#endif
82-
8372
#endif /*__ASSEMBLY__ */
8473
#endif /* __KERNEL__ */
8574
#endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */

‎arch/microblaze/include/asm/kgdb.h‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifdef __KERNEL__
2+
#ifndef __MICROBLAZE_KGDB_H__
3+
#define __MICROBLAZE_KGDB_H__
4+
5+
#ifndef __ASSEMBLY__
6+
7+
#define CACHE_FLUSH_IS_SAFE 1
8+
#define BUFMAX 2048
9+
10+
/*
11+
* 32 32-bit general purpose registers (r0-r31)
12+
* 6 32-bit special registers (pc, msr, ear, esr, fsr, btr)
13+
* 12 32-bit PVR
14+
* 7 32-bit MMU Regs (redr, rpid, rzpr, rtlbx, rtlbsx, rtlblo, rtlbhi)
15+
* ------
16+
* 57 registers
17+
*/
18+
#define NUMREGBYTES (57 * 4)
19+
20+
#define BREAK_INSTR_SIZE 4
21+
static inline void arch_kgdb_breakpoint(void)
22+
{
23+
__asm__ __volatile__("brki r16, 0x18;");
24+
}
25+
26+
#endif /* __ASSEMBLY__ */
27+
#endif /* __MICROBLAZE_KGDB_H__ */
28+
#endif /* __KERNEL__ */

‎arch/microblaze/include/asm/page.h‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,16 @@
2323
#ifdef __KERNEL__
2424

2525
/* PAGE_SHIFT determines the page size */
26-
#define PAGE_SHIFT (12)
27-
#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
26+
#if defined(CONFIG_MICROBLAZE_32K_PAGES)
27+
#define PAGE_SHIFT 15
28+
#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
29+
#define PAGE_SHIFT 14
30+
#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
31+
#define PAGE_SHIFT 13
32+
#else
33+
#define PAGE_SHIFT 12
34+
#endif
35+
#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
2836
#define PAGE_MASK (~(PAGE_SIZE-1))
2937

3038
#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))

‎arch/microblaze/include/asm/pvr.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define PVR_MSR_BIT 0x400
1717

1818
struct pvr_s {
19-
unsigned pvr[16];
19+
unsigned pvr[12];
2020
};
2121

2222
/* The following taken from Xilinx's standalone BSP pvr.h */

0 commit comments

Comments
 (0)