Commit 20c698d7 authored by David S. Miller's avatar David S. Miller

Merge branch 'sparc32-cosmetic-changes'

Sam Ravnborg says:

====================
sparc32: kgdb_32 and STRICT_MM_TYPECHECKS updates

A few cosmetic pathes for sparc32 follows.
I noticed some inconsistency in kgdb_32 that triggered a few patches.
The inconsistency in kgdb_32 turned out to have no functional impact.
But I anyway fixed it so kgdb_32 and kgdb_64 became just a tiny
bit more alike.

The STRICT_MM_TYPECHECKS patch was triggered by a
discussion on linux-arch where Arnd considered removing
this cruft.
The resulting benary of srmmu.c (I checked an assembler file)
was _smaller_ when I defined STRICT_MM_TYPECHECKS.
But due to lack of testing I left it undefined.
With the build errors fixed it should be trivial to
try out if defining STRICT_MM_TYPECHECKS breaks anything.

Any takers?

As I miss any working sparc32 gear for the moment this
has only been build tested - so please consider if it
is worth taking the risk to apply the patches.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 33656a1f 6b1cabe8
...@@ -43,10 +43,10 @@ ...@@ -43,10 +43,10 @@
nop; nop;
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
#define KGDB_TRAP(num) \ #define KGDB_TRAP(num) \
b kgdb_trap_low; \ mov num, %l7; \
rd %psr,%l0; \ b kgdb_trap_low; \
nop; \ rd %psr,%l0; \
nop; nop;
#else #else
#define KGDB_TRAP(num) \ #define KGDB_TRAP(num) \
......
...@@ -28,10 +28,10 @@ enum regnames { ...@@ -28,10 +28,10 @@ enum regnames {
#define NUMREGBYTES ((GDB_CSR + 1) * 4) #define NUMREGBYTES ((GDB_CSR + 1) * 4)
#else #else
#define NUMREGBYTES ((GDB_Y + 1) * 8) #define NUMREGBYTES ((GDB_Y + 1) * 8)
#endif
struct pt_regs; struct pt_regs;
asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs); asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs);
#endif
void arch_kgdb_breakpoint(void); void arch_kgdb_breakpoint(void);
......
...@@ -69,7 +69,6 @@ typedef struct { unsigned long iopgprot; } iopgprot_t; ...@@ -69,7 +69,6 @@ typedef struct { unsigned long iopgprot; } iopgprot_t;
#define __pte(x) ((pte_t) { (x) } ) #define __pte(x) ((pte_t) { (x) } )
#define __iopte(x) ((iopte_t) { (x) } ) #define __iopte(x) ((iopte_t) { (x) } )
/* #define __pmd(x) ((pmd_t) { (x) } ) */ /* XXX procedure with loop */
#define __pgd(x) ((pgd_t) { (x) } ) #define __pgd(x) ((pgd_t) { (x) } )
#define __ctxd(x) ((ctxd_t) { (x) } ) #define __ctxd(x) ((ctxd_t) { (x) } )
#define __pgprot(x) ((pgprot_t) { (x) } ) #define __pgprot(x) ((pgprot_t) { (x) } )
...@@ -97,7 +96,6 @@ typedef unsigned long iopgprot_t; ...@@ -97,7 +96,6 @@ typedef unsigned long iopgprot_t;
#define __pte(x) (x) #define __pte(x) (x)
#define __iopte(x) (x) #define __iopte(x) (x)
/* #define __pmd(x) (x) */ /* XXX later */
#define __pgd(x) (x) #define __pgd(x) (x)
#define __ctxd(x) (x) #define __ctxd(x) (x)
#define __pgprot(x) (x) #define __pgprot(x) (x)
......
...@@ -29,9 +29,9 @@ static inline void free_pgd_fast(pgd_t *pgd) ...@@ -29,9 +29,9 @@ static inline void free_pgd_fast(pgd_t *pgd)
static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp) static inline void pgd_set(pgd_t * pgdp, pmd_t * pmdp)
{ {
unsigned long pa = __nocache_pa((unsigned long)pmdp); unsigned long pa = __nocache_pa(pmdp);
set_pte((pte_t *)pgdp, (SRMMU_ET_PTD | (pa >> 4))); set_pte((pte_t *)pgdp, __pte((SRMMU_ET_PTD | (pa >> 4))));
} }
#define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD) #define pgd_populate(MM, PGD, PMD) pgd_set(PGD, PMD)
......
...@@ -298,7 +298,7 @@ static inline pte_t mk_pte_io(unsigned long page, pgprot_t pgprot, int space) ...@@ -298,7 +298,7 @@ static inline pte_t mk_pte_io(unsigned long page, pgprot_t pgprot, int space)
#define pgprot_noncached pgprot_noncached #define pgprot_noncached pgprot_noncached
static inline pgprot_t pgprot_noncached(pgprot_t prot) static inline pgprot_t pgprot_noncached(pgprot_t prot)
{ {
prot &= ~__pgprot(SRMMU_CACHE); pgprot_val(prot) &= ~pgprot_val(__pgprot(SRMMU_CACHE));
return prot; return prot;
} }
......
...@@ -1225,20 +1225,18 @@ breakpoint_trap: ...@@ -1225,20 +1225,18 @@ breakpoint_trap:
RESTORE_ALL RESTORE_ALL
#ifdef CONFIG_KGDB #ifdef CONFIG_KGDB
.align 4 ENTRY(kgdb_trap_low)
.globl kgdb_trap_low
.type kgdb_trap_low,#function
kgdb_trap_low:
rd %wim,%l3 rd %wim,%l3
SAVE_ALL SAVE_ALL
wr %l0, PSR_ET, %psr wr %l0, PSR_ET, %psr
WRITE_PAUSE WRITE_PAUSE
mov %l7, %o0 ! trap_level
call kgdb_trap call kgdb_trap
add %sp, STACKFRAME_SZ, %o0 add %sp, STACKFRAME_SZ, %o1 ! struct pt_regs *regs
RESTORE_ALL RESTORE_ALL
.size kgdb_trap_low,.-kgdb_trap_low ENDPROC(kgdb_trap_low)
#endif #endif
.align 4 .align 4
......
...@@ -127,6 +127,7 @@ extern unsigned int t_nmi[]; ...@@ -127,6 +127,7 @@ extern unsigned int t_nmi[];
extern unsigned int linux_trap_ipi15_sun4d[]; extern unsigned int linux_trap_ipi15_sun4d[];
extern unsigned int linux_trap_ipi15_sun4m[]; extern unsigned int linux_trap_ipi15_sun4m[];
extern struct tt_entry trapbase;
extern struct tt_entry trapbase_cpu1; extern struct tt_entry trapbase_cpu1;
extern struct tt_entry trapbase_cpu2; extern struct tt_entry trapbase_cpu2;
extern struct tt_entry trapbase_cpu3; extern struct tt_entry trapbase_cpu3;
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
extern unsigned long trapbase; #include "kernel.h"
#include "entry.h"
void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
{ {
...@@ -133,21 +134,19 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code, ...@@ -133,21 +134,19 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
return -1; return -1;
} }
extern void do_hw_interrupt(struct pt_regs *regs, unsigned long type); asmlinkage void kgdb_trap(unsigned long trap_level, struct pt_regs *regs)
asmlinkage void kgdb_trap(struct pt_regs *regs)
{ {
unsigned long flags; unsigned long flags;
if (user_mode(regs)) { if (user_mode(regs)) {
do_hw_interrupt(regs, 0xfd); do_hw_interrupt(regs, trap_level);
return; return;
} }
flushw_all(); flushw_all();
local_irq_save(flags); local_irq_save(flags);
kgdb_handle_exception(0x172, SIGTRAP, 0, regs); kgdb_handle_exception(trap_level, SIGTRAP, 0, regs);
local_irq_restore(flags); local_irq_restore(flags);
} }
......
...@@ -68,8 +68,6 @@ struct screen_info screen_info = { ...@@ -68,8 +68,6 @@ struct screen_info screen_info = {
* prints out pretty messages and returns. * prints out pretty messages and returns.
*/ */
extern unsigned long trapbase;
/* Pretty sick eh? */ /* Pretty sick eh? */
static void prom_sync_me(void) static void prom_sync_me(void)
{ {
...@@ -300,7 +298,7 @@ void __init setup_arch(char **cmdline_p) ...@@ -300,7 +298,7 @@ void __init setup_arch(char **cmdline_p)
int i; int i;
unsigned long highest_paddr; unsigned long highest_paddr;
sparc_ttable = (struct tt_entry *) &trapbase; sparc_ttable = &trapbase;
/* Initialize PROM console and command line. */ /* Initialize PROM console and command line. */
*cmdline_p = prom_getbootargs(); *cmdline_p = prom_getbootargs();
......
...@@ -133,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan); ...@@ -133,7 +133,7 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK); vaddr = IOUNIT_DMA_BASE + (scan << PAGE_SHIFT) + (vaddr & ~PAGE_MASK);
for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) { for (k = 0; k < npages; k++, iopte = __iopte(iopte_val(iopte) + 0x100), scan++) {
set_bit(scan, iounit->bmap); set_bit(scan, iounit->bmap);
sbus_writel(iopte, &iounit->page_table[scan]); sbus_writel(iopte_val(iopte), &iounit->page_table[scan]);
} }
IOD(("%08lx\n", vaddr)); IOD(("%08lx\n", vaddr));
return vaddr; return vaddr;
...@@ -228,7 +228,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon ...@@ -228,7 +228,7 @@ static int iounit_map_dma_area(struct device *dev, dma_addr_t *pba, unsigned lon
i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT); i = ((addr - IOUNIT_DMA_BASE) >> PAGE_SHIFT);
iopte = iounit->page_table + i; iopte = iounit->page_table + i;
sbus_writel(MKIOPTE(__pa(page)), iopte); sbus_writel(iopte_val(MKIOPTE(__pa(page))), iopte);
} }
addr += PAGE_SIZE; addr += PAGE_SIZE;
va += PAGE_SIZE; va += PAGE_SIZE;
......
...@@ -107,17 +107,22 @@ static inline int srmmu_pmd_none(pmd_t pmd) ...@@ -107,17 +107,22 @@ static inline int srmmu_pmd_none(pmd_t pmd)
/* XXX should we hyper_flush_whole_icache here - Anton */ /* XXX should we hyper_flush_whole_icache here - Anton */
static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp) static inline void srmmu_ctxd_set(ctxd_t *ctxp, pgd_t *pgdp)
{ set_pte((pte_t *)ctxp, (SRMMU_ET_PTD | (__nocache_pa((unsigned long) pgdp) >> 4))); } {
pte_t pte;
pte = __pte((SRMMU_ET_PTD | (__nocache_pa(pgdp) >> 4)));
set_pte((pte_t *)ctxp, pte);
}
void pmd_set(pmd_t *pmdp, pte_t *ptep) void pmd_set(pmd_t *pmdp, pte_t *ptep)
{ {
unsigned long ptp; /* Physical address, shifted right by 4 */ unsigned long ptp; /* Physical address, shifted right by 4 */
int i; int i;
ptp = __nocache_pa((unsigned long) ptep) >> 4; ptp = __nocache_pa(ptep) >> 4;
for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) { for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) {
set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp); set_pte((pte_t *)&pmdp->pmdv[i], __pte(SRMMU_ET_PTD | ptp));
ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4); ptp += (SRMMU_REAL_PTRS_PER_PTE * sizeof(pte_t) >> 4);
} }
} }
...@@ -128,8 +133,8 @@ void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep) ...@@ -128,8 +133,8 @@ void pmd_populate(struct mm_struct *mm, pmd_t *pmdp, struct page *ptep)
ptp = page_to_pfn(ptep) << (PAGE_SHIFT-4); /* watch for overflow */ ptp = page_to_pfn(ptep) << (PAGE_SHIFT-4); /* watch for overflow */
for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) { for (i = 0; i < PTRS_PER_PTE/SRMMU_REAL_PTRS_PER_PTE; i++) {
set_pte((pte_t *)&pmdp->pmdv[i], SRMMU_ET_PTD | ptp); set_pte((pte_t *)&pmdp->pmdv[i], __pte(SRMMU_ET_PTD | ptp));
ptp += (SRMMU_REAL_PTRS_PER_PTE*sizeof(pte_t) >> 4); ptp += (SRMMU_REAL_PTRS_PER_PTE * sizeof(pte_t) >> 4);
} }
} }
...@@ -911,7 +916,7 @@ void __init srmmu_paging_init(void) ...@@ -911,7 +916,7 @@ void __init srmmu_paging_init(void)
/* ctx table has to be physically aligned to its size */ /* ctx table has to be physically aligned to its size */
srmmu_context_table = __srmmu_get_nocache(num_contexts * sizeof(ctxd_t), num_contexts * sizeof(ctxd_t)); srmmu_context_table = __srmmu_get_nocache(num_contexts * sizeof(ctxd_t), num_contexts * sizeof(ctxd_t));
srmmu_ctx_table_phys = (ctxd_t *)__nocache_pa((unsigned long)srmmu_context_table); srmmu_ctx_table_phys = (ctxd_t *)__nocache_pa(srmmu_context_table);
for (i = 0; i < num_contexts; i++) for (i = 0; i < num_contexts; i++)
srmmu_ctxd_set((ctxd_t *)__nocache_fix(&srmmu_context_table[i]), srmmu_swapper_pg_dir); srmmu_ctxd_set((ctxd_t *)__nocache_fix(&srmmu_context_table[i]), srmmu_swapper_pg_dir);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment