From d200c922bc2b1ac88b8d33b6cfff2ed837af186a Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Sun, 20 Sep 2009 18:14:13 -0400 Subject: Use new __init_task_data macro in arch init_task.c files. Signed-off-by: Joe Perches Signed-off-by: Tim Abbott Acked-by: Paul Mundt Signed-off-by: Sam Ravnborg --- arch/m32r/kernel/init_task.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/init_task.c b/arch/m32r/kernel/init_task.c index fce57e5d3f9..6c42d5f8df5 100644 --- a/arch/m32r/kernel/init_task.c +++ b/arch/m32r/kernel/init_task.c @@ -20,9 +20,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand); * way process stacks are handled. This is done by having a special * "init_task" linker map entry.. */ -union thread_union init_thread_union - __attribute__((__section__(".data.init_task"))) = - { INIT_THREAD_INFO(init_task) }; +union thread_union init_thread_union __init_task_data = + { INIT_THREAD_INFO(init_task) }; /* * Initial task structure. -- cgit v1.2.3 From 00b01b246bc2e28763cbd85f0dc949d6c0d38c13 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 18 Sep 2009 16:32:46 -0400 Subject: m32r: Move GET_THREAD_INFO definition out of asm/thread_info.h. Previously, asm/thread_info.h was not usable from linker scripts because it contains a piece of .macro code. Since that code was only used in the m32r entry.S, the right fix is probably to move the macro there. Signed-off-by: Tim Abbott Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/entry.S | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S index 612d35b082a..403869833b9 100644 --- a/arch/m32r/kernel/entry.S +++ b/arch/m32r/kernel/entry.S @@ -118,6 +118,13 @@ #define resume_kernel restore_all #endif +/* how to get the thread information struct from ASM */ +#define GET_THREAD_INFO(reg) GET_THREAD_INFO reg + .macro GET_THREAD_INFO reg + ldi \reg, #-THREAD_SIZE + and \reg, sp + .endm + ENTRY(ret_from_fork) pop r0 bl schedule_tail -- cgit v1.2.3 From 2a67d26284c31e676bcf3891ad8cee75e87fbada Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 18 Sep 2009 16:32:47 -0400 Subject: m32r: Remove unused .altinstructions and .exit.* code from linker script. It appears that m32r copied the .altinstructions definition from x86 when the architecture was first merged into Linux. m32r doesn't put anything in .altinstructions, so this is just dead code. The following block affecting .exit.text/.exit.data, which has a comment also copied from x86, should also be deleted; the linker script later discards the .exit.text and .exit.data sections. Signed-off-by: Tim Abbott Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/vmlinux.lds.S | 9 --------- 1 file changed, 9 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S index de5e21cca6a..a8aa4a858dd 100644 --- a/arch/m32r/kernel/vmlinux.lds.S +++ b/arch/m32r/kernel/vmlinux.lds.S @@ -91,15 +91,6 @@ SECTIONS .con_initcall.init : { *(.con_initcall.init) } __con_initcall_end = .; SECURITY_INIT - . = ALIGN(4); - __alt_instructions = .; - .altinstructions : { *(.altinstructions) } - __alt_instructions_end = .; - .altinstr_replacement : { *(.altinstr_replacement) } - /* .exit.text is discard at runtime, not link time, to deal with references - from .altinstructions and .eh_frame */ - .exit.text : { EXIT_TEXT } - .exit.data : { EXIT_DATA } #ifdef CONFIG_BLK_DEV_INITRD . = ALIGN(4096); -- cgit v1.2.3 From 743486dff1d03eb4a67bd75402699629f70cd5b4 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 18 Sep 2009 16:32:48 -0400 Subject: m32r: Move the spi_stack_top and spu_stack_top into .init.data section. Since these get squashed into the .data output section by the m32r linker script, it seems likely that they don't need their own input sections. At Hirokazu Takata's suggestion, we place these structures in .init.data rather than just placing them in .data (since they are only used at init time). This patch is preparation for cleaning up the m32r architecture to use the new macros in vmlinux.lds.h; if these sections are indeed not needed, then we can use the RW_DATA_SECTION macro for m32r and save a bunch of redundant code. Signed-off-by: Tim Abbott Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/head.S | 4 ++-- arch/m32r/kernel/vmlinux.lds.S | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/head.S b/arch/m32r/kernel/head.S index 0a7194439eb..a46652dd83e 100644 --- a/arch/m32r/kernel/head.S +++ b/arch/m32r/kernel/head.S @@ -268,13 +268,13 @@ ENTRY(empty_zero_page) /*------------------------------------------------------------------------ * Stack area */ - .section .spi + .section .init.data, "aw" ALIGN .global spi_stack_top .zero 1024 spi_stack_top: - .section .spu + .section .init.data, "aw" ALIGN .global spu_stack_top .zero 1024 diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S index a8aa4a858dd..aadb24eacf0 100644 --- a/arch/m32r/kernel/vmlinux.lds.S +++ b/arch/m32r/kernel/vmlinux.lds.S @@ -49,8 +49,6 @@ SECTIONS /* writeable */ .data : { /* Data */ - *(.spu) - *(.spi) DATA_DATA CONSTRUCTORS } -- cgit v1.2.3 From 85233c43f7fece10a3ea8ed34f0d546b8dd3a435 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 18 Sep 2009 16:32:49 -0400 Subject: m32r: Cleanup linker script using new linker script macros. This patch is largely a straightforward conversion. One thing to note is that the new macros use fewer separate output sections than the old code; this should have no functional impact but is relevant for people objdumping vmlinux files. Also note that it moves the .data.init_task output sections inside _edata. Signed-off-by: Tim Abbott Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/vmlinux.lds.S | 67 ++++++------------------------------------ 1 file changed, 9 insertions(+), 58 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/vmlinux.lds.S b/arch/m32r/kernel/vmlinux.lds.S index aadb24eacf0..8ceb6181d80 100644 --- a/arch/m32r/kernel/vmlinux.lds.S +++ b/arch/m32r/kernel/vmlinux.lds.S @@ -4,6 +4,7 @@ #include #include #include +#include OUTPUT_ARCH(m32r) #if defined(__LITTLE_ENDIAN__) @@ -40,72 +41,22 @@ SECTIONS #endif _etext = .; /* End of text section */ - . = ALIGN(16); /* Exception table */ - __start___ex_table = .; - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - + EXCEPTION_TABLE(16) RODATA - - /* writeable */ - .data : { /* Data */ - DATA_DATA - CONSTRUCTORS - } - - . = ALIGN(4096); - __nosave_begin = .; - .data_nosave : { *(.data.nosave) } - . = ALIGN(4096); - __nosave_end = .; - - . = ALIGN(32); - .data.cacheline_aligned : { *(.data.cacheline_aligned) } - + RW_DATA_SECTION(32, PAGE_SIZE, THREAD_SIZE) _edata = .; /* End of data section */ - . = ALIGN(8192); /* init_task */ - .data.init_task : { *(.data.init_task) } - /* will be freed after init */ - . = ALIGN(4096); /* Init code and data */ + . = ALIGN(PAGE_SIZE); /* Init code and data */ __init_begin = .; - .init.text : { - _sinittext = .; - INIT_TEXT - _einittext = .; - } - .init.data : { INIT_DATA } - . = ALIGN(16); - __setup_start = .; - .init.setup : { *(.init.setup) } - __setup_end = .; - __initcall_start = .; - .initcall.init : { - INITCALLS - } - __initcall_end = .; - __con_initcall_start = .; - .con_initcall.init : { *(.con_initcall.init) } - __con_initcall_end = .; - SECURITY_INIT - -#ifdef CONFIG_BLK_DEV_INITRD - . = ALIGN(4096); - __initramfs_start = .; - .init.ramfs : { *(.init.ramfs) } - __initramfs_end = .; -#endif - - PERCPU(4096) - . = ALIGN(4096); + INIT_TEXT_SECTION(PAGE_SIZE) + INIT_DATA_SECTION(16) + PERCPU(PAGE_SIZE) + . = ALIGN(PAGE_SIZE); __init_end = .; /* freed after init ends here */ - __bss_start = .; /* BSS */ - .bss : { *(.bss) } - . = ALIGN(4); - __bss_stop = .; + BSS_SECTION(0, 0, 4) _end = . ; -- cgit v1.2.3 From c2a3a4881dc851ec9b5bdc83fdc03afa31d6fbed Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 24 Sep 2009 09:34:43 -0600 Subject: cpumask: arch_send_call_function_ipi_mask: m32r 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 wean the implementations off the obsolescent for_each_cpu_mask(): making send_ipi_mask take the pointer seemed the most natural way to ensure all implementations used for_each_cpu. Signed-off-by: Rusty Russell --- arch/m32r/kernel/smp.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 929e5c9d3ad..45c512bcd4c 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c @@ -85,7 +85,7 @@ void smp_ipi_timer_interrupt(struct pt_regs *); void smp_local_timer_interrupt(void); static void send_IPI_allbutself(int, int); -static void send_IPI_mask(cpumask_t, int, int); +static void send_IPI_mask(const struct cpumask *, int, int); unsigned long send_IPI_mask_phys(cpumask_t, int, int); /*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/ @@ -113,7 +113,7 @@ unsigned long send_IPI_mask_phys(cpumask_t, int, int); void smp_send_reschedule(int cpu_id) { WARN_ON(cpu_is_offline(cpu_id)); - send_IPI_mask(cpumask_of_cpu(cpu_id), RESCHEDULE_IPI, 1); + send_IPI_mask(cpumask_of(cpu_id), RESCHEDULE_IPI, 1); } /*==========================================================================* @@ -168,7 +168,7 @@ void smp_flush_cache_all(void) spin_lock(&flushcache_lock); mask=cpus_addr(cpumask); atomic_set_mask(*mask, (atomic_t *)&flushcache_cpumask); - send_IPI_mask(cpumask, INVALIDATE_CACHE_IPI, 0); + send_IPI_mask(&cpumask, INVALIDATE_CACHE_IPI, 0); _flush_cache_copyback_all(); while (flushcache_cpumask) mb(); @@ -424,7 +424,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, * We have to send the IPI only to * CPUs affected. */ - send_IPI_mask(cpumask, INVALIDATE_TLB_IPI, 0); + send_IPI_mask(&cpumask, INVALIDATE_TLB_IPI, 0); while (!cpus_empty(flush_cpumask)) { /* nothing. lockup detection does not belong here */ @@ -546,14 +546,14 @@ static void stop_this_cpu(void *dummy) for ( ; ; ); } -void arch_send_call_function_ipi(cpumask_t mask) +void arch_send_call_function_ipi_mask(const struct cpumask *mask) { send_IPI_mask(mask, CALL_FUNCTION_IPI, 0); } void arch_send_call_function_single_ipi(int cpu) { - send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNC_SINGLE_IPI, 0); + send_IPI_mask(cpumask_of(cpu), CALL_FUNC_SINGLE_IPI, 0); } /*==========================================================================* @@ -729,7 +729,7 @@ static void send_IPI_allbutself(int ipi_num, int try) cpumask = cpu_online_map; cpu_clear(smp_processor_id(), cpumask); - send_IPI_mask(cpumask, ipi_num, try); + send_IPI_mask(&cpumask, ipi_num, try); } /*==========================================================================* @@ -752,7 +752,7 @@ static void send_IPI_allbutself(int ipi_num, int try) * ---------- --- -------------------------------------------------------- * *==========================================================================*/ -static void send_IPI_mask(cpumask_t cpumask, int ipi_num, int try) +static void send_IPI_mask(const struct cpumask *cpumask, int ipi_num, int try) { cpumask_t physid_mask, tmp; int cpu_id, phys_id; @@ -761,11 +761,11 @@ static void send_IPI_mask(cpumask_t cpumask, int ipi_num, int try) if (num_cpus <= 1) /* NO MP */ return; - cpus_and(tmp, cpumask, cpu_online_map); - BUG_ON(!cpus_equal(cpumask, tmp)); + cpumask_and(&tmp, cpumask, cpu_online_mask); + BUG_ON(!cpumask_equal(cpumask, &tmp)); physid_mask = CPU_MASK_NONE; - for_each_cpu_mask(cpu_id, cpumask){ + for_each_cpu(cpu_id, cpumask) { if ((phys_id = cpu_to_physid(cpu_id)) != -1) cpu_set(phys_id, physid_mask); } -- cgit v1.2.3 From 2377afdde16a50b72e0b7ddb96d6b905f73754e2 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 24 Sep 2009 09:34:47 -0600 Subject: cpumask: Use accessors for cpu_*_mask: m32r Use the accessors rather than frobbing bits directly (the new versions are const). Signed-off-by: Rusty Russell Signed-off-by: Mike Travis --- arch/m32r/kernel/smpboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c index 655ea1c47a0..e034844cfc0 100644 --- a/arch/m32r/kernel/smpboot.c +++ b/arch/m32r/kernel/smpboot.c @@ -178,7 +178,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus) for (phys_id = 0 ; phys_id < nr_cpu ; phys_id++) physid_set(phys_id, phys_cpu_present_map); #ifndef CONFIG_HOTPLUG_CPU - cpu_present_map = cpu_possible_map; + init_cpu_present(&cpu_possible_map); #endif show_mp_info(nr_cpu); -- cgit v1.2.3 From 49b92050f6ce436cde7f495bbb27437bcb09e238 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 24 Sep 2009 09:34:49 -0600 Subject: cpumask: use mm_cpumask() wrapper: m32r Makes code futureproof against the impending change to mm->cpu_vm_mask. It's also a chance to use the new cpumask_ ops which take a pointer (the older ones are deprecated, but there's no hurry for arch code). Signed-off-by: Rusty Russell Acked-by: Hirokazu Takata (fixes) --- arch/m32r/kernel/smp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 45c512bcd4c..1b7598e6f6e 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c @@ -264,7 +264,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm) preempt_disable(); cpu_id = smp_processor_id(); mmc = &mm->context[cpu_id]; - cpu_mask = mm->cpu_vm_mask; + cpu_mask = *mm_cpumask(mm); cpu_clear(cpu_id, cpu_mask); if (*mmc != NO_CONTEXT) { @@ -273,7 +273,7 @@ void smp_flush_tlb_mm(struct mm_struct *mm) if (mm == current->mm) activate_context(mm); else - cpu_clear(cpu_id, mm->cpu_vm_mask); + cpumask_clear_cpu(cpu_id, mm_cpumask(mm)); local_irq_restore(flags); } if (!cpus_empty(cpu_mask)) @@ -334,7 +334,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va) preempt_disable(); cpu_id = smp_processor_id(); mmc = &mm->context[cpu_id]; - cpu_mask = mm->cpu_vm_mask; + cpu_mask = *mm_cpumask(mm); cpu_clear(cpu_id, cpu_mask); #ifdef DEBUG_SMP @@ -469,7 +469,7 @@ void smp_invalidate_interrupt(void) if (flush_mm == current->active_mm) activate_context(flush_mm); else - cpu_clear(cpu_id, flush_mm->cpu_vm_mask); + cpumask_clear_cpu(cpu_id, mm_cpumask(flush_mm)); } else { unsigned long va = flush_va; -- cgit v1.2.3 From ced0f005c7b0a7e751b2d15ea502a7654ddb3630 Mon Sep 17 00:00:00 2001 From: Hirokazu Takata Date: Wed, 26 Aug 2009 13:09:12 +0900 Subject: m32r: export delay loop symbols - Move EXPORT_SYMBOL lines of delay loop functions from arch/m32r/kernel/m32r_ksyms.c to arch/m32r/lib/delay.c. - Export __ndelay. Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/m32r_ksyms.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c index 22624b51d4d..700570747a9 100644 --- a/arch/m32r/kernel/m32r_ksyms.c +++ b/arch/m32r/kernel/m32r_ksyms.c @@ -23,12 +23,6 @@ EXPORT_SYMBOL(__ioremap); EXPORT_SYMBOL(iounmap); EXPORT_SYMBOL(kernel_thread); -/* Networking helper routines. */ -/* Delay loops */ -EXPORT_SYMBOL(__udelay); -EXPORT_SYMBOL(__delay); -EXPORT_SYMBOL(__const_udelay); - EXPORT_SYMBOL(strncpy_from_user); EXPORT_SYMBOL(__strncpy_from_user); EXPORT_SYMBOL(clear_user); -- cgit v1.2.3 From bac33bd571a9c2969efb52dd02c5407fbc49c360 Mon Sep 17 00:00:00 2001 From: Hirokazu Takata Date: Wed, 26 Aug 2009 13:13:12 +0900 Subject: m32r: add rtc_lock variable Add a spinlock variable "rtc_lock". This is taken from arch/arm/kernel/time.c. Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/time.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c index ba61c4c7320..e7fee0f198d 100644 --- a/arch/m32r/kernel/time.c +++ b/arch/m32r/kernel/time.c @@ -33,6 +33,15 @@ #include +#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) +/* this needs a better home */ +DEFINE_SPINLOCK(rtc_lock); + +#ifdef CONFIG_RTC_DRV_CMOS_MODULE +EXPORT_SYMBOL(rtc_lock); +#endif +#endif /* pc-style 'CMOS' RTC support */ + #ifdef CONFIG_SMP extern void smp_local_timer_interrupt(void); #endif -- cgit v1.2.3 From 0a3d31b79e7fa600108e699805e2b2f9ea1f3194 Mon Sep 17 00:00:00 2001 From: Toshihiro HANAWA Date: Fri, 2 Oct 2009 17:52:54 +0900 Subject: m32r: Fix IPI function calls for SMP This patch fixes the m32r SMP kernel after 2.6.27. A part of the following patch breaks m32r SMP operation. > m32r: convert to generic helpers for IPI function calls > commit 7b7426c8a615cf61df9a77b9df7d5b75d91e3fa0 In the above patch, a CALL_FUNC_SINGLE_IPI was newly introduced, but the its IPI vector number was wrong in the patch code. The m32r SMP kernel hanged-up during boot operation, because the CPU_BOOT_IPI was called instead of CALL_FUNC_SINGLE_IPI (CPU_BOOT_IPI had no side effect at that time because the 2nd core had already been started up), as a result, csd_unlock() was not called, then a dead lock occurred in csd_lock_wait() after the detection of Compact Flash memory as IDE generic disk. Signed-off-by: Toshihiro HANAWA Signed-off-by: Hirokazu Takata --- arch/m32r/kernel/traps.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/traps.c b/arch/m32r/kernel/traps.c index 03b14e55cd8..fbd109031df 100644 --- a/arch/m32r/kernel/traps.c +++ b/arch/m32r/kernel/traps.c @@ -104,8 +104,8 @@ static void set_eit_vector_entries(void) eit_vector[186] = (unsigned long)smp_call_function_interrupt; eit_vector[187] = (unsigned long)smp_ipi_timer_interrupt; eit_vector[188] = (unsigned long)smp_flush_cache_all_interrupt; - eit_vector[189] = (unsigned long)smp_call_function_single_interrupt; - eit_vector[190] = 0; + eit_vector[189] = 0; /* CPU_BOOT_IPI */ + eit_vector[190] = (unsigned long)smp_call_function_single_interrupt; eit_vector[191] = 0; #endif _flush_cache_copyback_all(); -- cgit v1.2.3 From d43c36dc6b357fa1806800f18aa30123c747a6d1 Mon Sep 17 00:00:00 2001 From: Alexey Dobriyan Date: Wed, 7 Oct 2009 17:09:06 +0400 Subject: headers: remove sched.h from interrupt.h After m68k's task_thread_info() doesn't refer to current, it's possible to remove sched.h from interrupt.h and not break m68k! Many thanks to Heiko Carstens for allowing this. Signed-off-by: Alexey Dobriyan --- arch/m32r/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/m32r/kernel') diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c index 1b7598e6f6e..8a88f1f0a3e 100644 --- a/arch/m32r/kernel/smp.c +++ b/arch/m32r/kernel/smp.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3