From 91887a362984324e254473e92820758c8e658f78 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Mar 2009 14:19:37 +1030 Subject: cpumask: arch_send_call_function_ipi_mask: parisc We're weaning the core code off handing cpumask's around on-stack. This introduces arch_send_call_function_ipi_mask(), and by defining it, the old arch_send_call_function_ipi is defined by the core code. We also take the chance to change send_IPI_mask() and use the new for_each_cpu() iterator. Signed-off-by: Rusty Russell --- arch/parisc/include/asm/smp.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/smp.h b/arch/parisc/include/asm/smp.h index 6ef4b7867b1..21eb45a5262 100644 --- a/arch/parisc/include/asm/smp.h +++ b/arch/parisc/include/asm/smp.h @@ -29,7 +29,8 @@ extern void smp_send_reschedule(int cpu); extern void smp_send_all_nop(void); extern void arch_send_call_function_single_ipi(int cpu); -extern void arch_send_call_function_ipi(cpumask_t mask); +extern void arch_send_call_function_ipi_mask(const struct cpumask *mask); +#define arch_send_call_function_ipi_mask arch_send_call_function_ipi_mask #endif /* !ASSEMBLY */ -- cgit v1.2.3 From 48d27cb2299c0b2fc4d551bddb6a1005828dc0c6 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Sun, 18 Jan 2009 19:16:16 +0100 Subject: parisc: fix usage of 32bit PTE page table entries on 32bit kernels This patch fixes a long outstanding bug on 32bit parisc linux kernels which prevented us from using 32bit PTE table entries (instead of 64bit entries of which 32bit were unused). The problem was caused by this assembler statement in the L2_ptep macro in arch/parisc/kernel/entry.S:447: EXTR \va,31-ASM_PGDIR_SHIFT,ASM_BITS_PER_PGD,\index which expanded to extrw,u r8,9,11,r1 and which has undefined behavior since the length value (11) extends beyond the leftmost bit (11-1 > 9). Interestingly PA2.0 processors seem to don't care and just zero-extend the value, while PA1.1 processors don't. Fix this problem by detecting an address space overflow with ASM_BITS_PER_PGD and adjusting it accordingly. To prevent such problems in the future, some compile time sanity checks in arch/parisc/mm/init.c were added. Since the page table now only consumes half of it's old size, we can use the freed memory to harmonize 32- and 64bit kernels and let both map 16MB for the initial page table. Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/page.h | 13 ++----------- arch/parisc/include/asm/pgtable.h | 15 ++++++++++----- 2 files changed, 12 insertions(+), 16 deletions(-) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h index c3941f09a87..7bc5125d7d4 100644 --- a/arch/parisc/include/asm/page.h +++ b/arch/parisc/include/asm/page.h @@ -36,16 +36,7 @@ void clear_user_page(void *page, unsigned long vaddr, struct page *pg); */ #define STRICT_MM_TYPECHECKS #ifdef STRICT_MM_TYPECHECKS -typedef struct { unsigned long pte; -#if !defined(CONFIG_64BIT) - unsigned long future_flags; - /* XXX: it's possible to remove future_flags and change BITS_PER_PTE_ENTRY - to 2, but then strangely the identical 32bit kernel boots on a - c3000(pa20), but not any longer on a 715(pa11). - Still investigating... HelgeD. - */ -#endif -} pte_t; /* either 32 or 64bit */ +typedef struct { unsigned long pte; } pte_t; /* either 32 or 64bit */ /* NOTE: even on 64 bits, these entries are __u32 because we allocate * the pmd and pgd in ZONE_DMA (i.e. under 4GB) */ @@ -111,7 +102,7 @@ extern int npmem_ranges; #define BITS_PER_PMD_ENTRY 2 #define BITS_PER_PGD_ENTRY 2 #else -#define BITS_PER_PTE_ENTRY 3 +#define BITS_PER_PTE_ENTRY 2 #define BITS_PER_PMD_ENTRY 2 #define BITS_PER_PGD_ENTRY BITS_PER_PMD_ENTRY #endif diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h index 470a4b88124..a27d2e200fb 100644 --- a/arch/parisc/include/asm/pgtable.h +++ b/arch/parisc/include/asm/pgtable.h @@ -50,11 +50,7 @@ printk("%s:%d: bad pgd %08lx.\n", __FILE__, __LINE__, (unsigned long)pgd_val(e)) /* This is the size of the initially mapped kernel memory */ -#ifdef CONFIG_64BIT #define KERNEL_INITIAL_ORDER 24 /* 0 to 1<<24 = 16MB */ -#else -#define KERNEL_INITIAL_ORDER 23 /* 0 to 1<<23 = 8MB */ -#endif #define KERNEL_INITIAL_SIZE (1 << KERNEL_INITIAL_ORDER) #if defined(CONFIG_64BIT) && defined(CONFIG_PARISC_PAGE_SIZE_4KB) @@ -91,16 +87,25 @@ /* Definitions for 1st level */ #define PGDIR_SHIFT (PMD_SHIFT + BITS_PER_PMD) +#if (PGDIR_SHIFT + PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY) > BITS_PER_LONG +#define BITS_PER_PGD (BITS_PER_LONG - PGDIR_SHIFT) +#else #define BITS_PER_PGD (PAGE_SHIFT + PGD_ORDER - BITS_PER_PGD_ENTRY) +#endif #define PGDIR_SIZE (1UL << PGDIR_SHIFT) #define PGDIR_MASK (~(PGDIR_SIZE-1)) #define PTRS_PER_PGD (1UL << BITS_PER_PGD) #define USER_PTRS_PER_PGD PTRS_PER_PGD +#ifdef CONFIG_64BIT #define MAX_ADDRBITS (PGDIR_SHIFT + BITS_PER_PGD) #define MAX_ADDRESS (1UL << MAX_ADDRBITS) - #define SPACEID_SHIFT (MAX_ADDRBITS - 32) +#else +#define MAX_ADDRBITS (BITS_PER_LONG) +#define MAX_ADDRESS (1UL << MAX_ADDRBITS) +#define SPACEID_SHIFT 0 +#endif /* This calculates the number of initial pages we need for the initial * page tables */ -- cgit v1.2.3 From 445c088f88d63db49598390be3525252d211688f Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Fri, 30 Jan 2009 01:03:50 +0000 Subject: parisc: expose 32/64-bit capabilities in cpuinfo It'd be rather useful for debian-installer if we could get hold of accurate firmware information on whether only 32-bit kernels are supported, only 64-bit kernels, or both; this would allow us to present an accurate menu of kernel packages if more than one is available, rather than the user having to guess. This patch attempts to expose it in cpuinfo. I adjusted pdc_model_capabilities to cope with a potential PDC_INVALID_ARG return as the firmware manual instructs, by assuming 32-bit only. This may be the wrong place for it. I made up user-visible capability names by total fiat and for the moment ignored the other bits that may appear in the capabilities word. I have no PA-RISC machine myself to test on, and no PA experience either, so I rather hope that somebody will kind-heartedly take this and fix it up if needed. I ran it past Dann Frazier on IRC and he said "looks good to me", but I think without testing. Also, this is against the Ubuntu 2.6.28 kernel tree since that's what I had handy and I was a bit tight on disk space to slurp down another tree. Sorry if it's skewed in any relevant way; I'll be happy to adjust if necessary. Thanks in advance! Signed-off-by: Colin Watson Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/pdc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h index 430f1aeea0b..a26e98dc0d4 100644 --- a/arch/parisc/include/asm/pdc.h +++ b/arch/parisc/include/asm/pdc.h @@ -49,6 +49,8 @@ #define PDC_MODEL_CPU_ID 6 /* returns cpu-id (only newer machines!) */ #define PDC_MODEL_CAPABILITIES 7 /* returns OS32/OS64-flags */ /* Values for PDC_MODEL_CAPABILITIES non-equivalent virtual aliasing support */ +#define PDC_MODEL_OS64 (1 << 0) +#define PDC_MODEL_OS32 (1 << 1) #define PDC_MODEL_IOPDIR_FDC (1 << 2) #define PDC_MODEL_NVA_MASK (3 << 4) #define PDC_MODEL_NVA_SUPPORTED (0 << 4) -- cgit v1.2.3 From d75f054a2cf0614ff63d534ff21ca8eaab41e713 Mon Sep 17 00:00:00 2001 From: Helge Deller Date: Mon, 9 Feb 2009 00:43:36 +0100 Subject: parisc: add ftrace (function and graph tracer) functionality This patch adds the ftrace debugging functionality to the parisc kernel. It will currently only work with 64bit kernels, because the gcc options -pg and -ffunction-sections can't be enabled at the same time and -ffunction-sections is still needed to be able to link 32bit kernels. Signed-off-by: Helge Deller Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/ftrace.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 arch/parisc/include/asm/ftrace.h (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/ftrace.h b/arch/parisc/include/asm/ftrace.h new file mode 100644 index 00000000000..2fa05dd6aee --- /dev/null +++ b/arch/parisc/include/asm/ftrace.h @@ -0,0 +1,25 @@ +#ifndef _ASM_PARISC_FTRACE_H +#define _ASM_PARISC_FTRACE_H + +#ifndef __ASSEMBLY__ +extern void mcount(void); + +/* + * Stack of return addresses for functions of a thread. + * Used in struct thread_info + */ +struct ftrace_ret_stack { + unsigned long ret; + unsigned long func; + unsigned long long calltime; +}; + +/* + * Primary handler of a function return. + * It relays on ftrace_return_to_handler. + * Defined in entry.S + */ +extern void return_to_handler(void); +#endif /* __ASSEMBLY__ */ + +#endif /* _ASM_PARISC_FTRACE_H */ -- cgit v1.2.3 From 47e669ce10901dc92960096653d6b22990b5188f Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 22 Mar 2009 03:58:40 +0000 Subject: parisc: fix macro expansion in atomic.h Signed-off-by: James Bottomley Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/atomic.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index edbfe25c5fc..ada3e5364d8 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h @@ -25,7 +25,7 @@ * Since "a" is usually an address, use one spinlock per cacheline. */ # define ATOMIC_HASH_SIZE 4 -# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) a)/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) +# define ATOMIC_HASH(a) (&(__atomic_hash[ (((unsigned long) (a))/L1_CACHE_BYTES) & (ATOMIC_HASH_SIZE-1) ])) extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned; @@ -222,13 +222,13 @@ static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) -#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)i),(v)))) -#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)i),(v)))) +#define atomic_add(i,v) ((void)(__atomic_add_return( ((int)(i)),(v)))) +#define atomic_sub(i,v) ((void)(__atomic_add_return(-((int)(i)),(v)))) #define atomic_inc(v) ((void)(__atomic_add_return( 1,(v)))) #define atomic_dec(v) ((void)(__atomic_add_return( -1,(v)))) -#define atomic_add_return(i,v) (__atomic_add_return( ((int)i),(v))) -#define atomic_sub_return(i,v) (__atomic_add_return(-((int)i),(v))) +#define atomic_add_return(i,v) (__atomic_add_return( ((int)(i)),(v))) +#define atomic_sub_return(i,v) (__atomic_add_return(-((int)(i)),(v))) #define atomic_inc_return(v) (__atomic_add_return( 1,(v))) #define atomic_dec_return(v) (__atomic_add_return( -1,(v))) @@ -289,13 +289,13 @@ atomic64_read(const atomic64_t *v) return v->counter; } -#define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)i),(v)))) -#define atomic64_sub(i,v) ((void)(__atomic64_add_return(-((s64)i),(v)))) +#define atomic64_add(i,v) ((void)(__atomic64_add_return( ((s64)(i)),(v)))) +#define atomic64_sub(i,v) ((void)(__atomic64_add_return(-((s64)(i)),(v)))) #define atomic64_inc(v) ((void)(__atomic64_add_return( 1,(v)))) #define atomic64_dec(v) ((void)(__atomic64_add_return( -1,(v)))) -#define atomic64_add_return(i,v) (__atomic64_add_return( ((s64)i),(v))) -#define atomic64_sub_return(i,v) (__atomic64_add_return(-((s64)i),(v))) +#define atomic64_add_return(i,v) (__atomic64_add_return( ((s64)(i)),(v))) +#define atomic64_sub_return(i,v) (__atomic64_add_return(-((s64)(i)),(v))) #define atomic64_inc_return(v) (__atomic64_add_return( 1,(v))) #define atomic64_dec_return(v) (__atomic64_add_return( -1,(v))) -- cgit v1.2.3 From d845e1fbf2d48f6556fbfae7ec04adf67ab14bca Mon Sep 17 00:00:00 2001 From: Alexander Beregalov Date: Wed, 1 Apr 2009 15:43:40 +0000 Subject: parisc: asm/pdc.h should include asm/page.h Fixes this build error: arch/parisc/kernel/pdc_cons.c:117: error: '__PAGE_OFFSET' undeclared Signed-off-by: Alexander Beregalov Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/pdc.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/pdc.h b/arch/parisc/include/asm/pdc.h index a26e98dc0d4..4ca510b3c6f 100644 --- a/arch/parisc/include/asm/pdc.h +++ b/arch/parisc/include/asm/pdc.h @@ -343,6 +343,8 @@ #ifdef __KERNEL__ +#include /* for __PAGE_OFFSET */ + extern int pdc_type; /* Values for pdc_type */ -- cgit v1.2.3 From bb7350194130ae6bd3fdec16fe1b7597c1c0bb8d Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Thu, 2 Apr 2009 02:40:41 +0000 Subject: parisc: fix build when ARCH_HAS_KMAP When we build for PA8X00, we define ARCH_HAS_KMAP, which results in the kmap_types.h include in highmem.h getting skipped... In file included from include/linux/pagemap.h:10, from include/linux/mempolicy.h:62, from init/main.c:52: include/linux/highmem.h:196: warning: 'enum km_type' declared inside parameter list include/linux/highmem.h:196: warning: its scope is only this definition or declaration, which is probably not what you want include/linux/highmem.h:196: error: parameter 1 ('type') has incomplete type Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/cacheflush.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h index b7ca6dc7fdd..724395143f2 100644 --- a/arch/parisc/include/asm/cacheflush.h +++ b/arch/parisc/include/asm/cacheflush.h @@ -97,6 +97,9 @@ void mark_rodata_ro(void); #ifdef CONFIG_PA8X00 /* Only pa8800, pa8900 needs this */ + +#include + #define ARCH_HAS_KMAP void kunmap_parisc(void *addr); -- cgit v1.2.3 From bf589a349b9a41ea202ddb8115b18f543b944bfd Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Sun, 15 Mar 2009 16:44:25 -0400 Subject: parisc: Move kernel Elf_Fdesc define to elf.h probably won't be exported to userspace, but play it safe and cram it in a #ifdef __KERNEL__ guard. Signed-off-by: Kyle McMartin --- arch/parisc/include/asm/elf.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'arch/parisc/include') diff --git a/arch/parisc/include/asm/elf.h b/arch/parisc/include/asm/elf.h index 7fa675799e6..9c802eb4be8 100644 --- a/arch/parisc/include/asm/elf.h +++ b/arch/parisc/include/asm/elf.h @@ -168,6 +168,16 @@ typedef struct elf64_fdesc { __u64 gp; } Elf64_Fdesc; +#ifdef __KERNEL__ + +#ifdef CONFIG_64BIT +#define Elf_Fdesc Elf64_Fdesc +#else +#define Elf_Fdesc Elf32_Fdesc +#endif /*CONFIG_64BIT*/ + +#endif /*__KERNEL__*/ + /* Legal values for p_type field of Elf32_Phdr/Elf64_Phdr. */ #define PT_HP_TLS (PT_LOOS + 0x0) -- cgit v1.2.3