From 3e7be3fb40296aab48a91ec599f22d2c5e8a4351 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Mar 2009 14:11:46 +1030 Subject: [PATCH 1/6] cpumask: prepare for iterators to only go to nr_cpu_ids/nr_cpumask_bits.: cris Impact: cleanup, futureproof In fact, all cpumask ops will only be valid (in general) for bit numbers < nr_cpu_ids. So use that instead of NR_CPUS in various places. This is always safe: no cpu number can be >= nr_cpu_ids, and nr_cpu_ids is initialized to NR_CPUS at boot. Signed-off-by: Rusty Russell Signed-off-by: Mike Travis Acked-by: Ingo Molnar --- arch/cris/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c index 04d48dd91ddf..b712f4934c4b 100644 --- a/arch/cris/kernel/setup.c +++ b/arch/cris/kernel/setup.c @@ -166,7 +166,7 @@ void __init setup_arch(char **cmdline_p) static void *c_start(struct seq_file *m, loff_t *pos) { - return *pos < NR_CPUS ? (void *)(int)(*pos + 1): NULL; + return *pos < nr_cpu_ids ? (void *)(int)(*pos + 1) : NULL; } static void *c_next(struct seq_file *m, void *v, loff_t *pos) From afc6ca01f6da831ff09f4dabdef3b50f114e9e1e Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Mar 2009 14:11:47 +1030 Subject: [PATCH 2/6] cpumask: Use accessors code.: cris Impact: use new API Use the accessors rather than frobbing bits directly. Most of this is in arch code I haven't even compiled, but is straightforward. Signed-off-by: Rusty Russell Signed-off-by: Mike Travis --- arch/cris/arch-v32/kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c index 9dac17334640..b47764c3308f 100644 --- a/arch/cris/arch-v32/kernel/smp.c +++ b/arch/cris/arch-v32/kernel/smp.c @@ -98,9 +98,9 @@ void __devinit smp_prepare_boot_cpu(void) SUPP_BANK_SEL(2); SUPP_REG_WR(RW_MM_TLB_PGD, pgd); - cpu_set(0, cpu_online_map); + set_cpu_online(0, true); cpu_set(0, phys_cpu_present_map); - cpu_set(0, cpu_possible_map); + set_cpu_possible(0, true); } void __init smp_cpus_done(unsigned int max_cpus) From b9d65c04773850ff3a82f69d43981be650e658a1 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 16 Mar 2009 14:11:47 +1030 Subject: [PATCH 3/6] cpumask: use mm_cpumask() wrapper: cris 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 --- arch/cris/arch-v32/kernel/smp.c | 6 +++--- arch/cris/arch-v32/mm/tlb.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c index b47764c3308f..dc31b04d0827 100644 --- a/arch/cris/arch-v32/kernel/smp.c +++ b/arch/cris/arch-v32/kernel/smp.c @@ -232,7 +232,7 @@ void flush_tlb_common(struct mm_struct* mm, struct vm_area_struct* vma, unsigned cpumask_t cpu_mask; spin_lock_irqsave(&tlbstate_lock, flags); - cpu_mask = (mm == FLUSH_ALL ? CPU_MASK_ALL : mm->cpu_vm_mask); + cpu_mask = (mm == FLUSH_ALL ? cpu_all_mask : *mm_cpumask(mm)); cpu_clear(smp_processor_id(), cpu_mask); flush_mm = mm; flush_vma = vma; @@ -252,8 +252,8 @@ void flush_tlb_mm(struct mm_struct *mm) __flush_tlb_mm(mm); flush_tlb_common(mm, FLUSH_ALL, 0); /* No more mappings in other CPUs */ - cpus_clear(mm->cpu_vm_mask); - cpu_set(smp_processor_id(), mm->cpu_vm_mask); + cpumask_clear(mm_cpumask(mm)); + cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); } void flush_tlb_page(struct vm_area_struct *vma, diff --git a/arch/cris/arch-v32/mm/tlb.c b/arch/cris/arch-v32/mm/tlb.c index 55ade36fe8a8..6779bcb28ab0 100644 --- a/arch/cris/arch-v32/mm/tlb.c +++ b/arch/cris/arch-v32/mm/tlb.c @@ -185,7 +185,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next, /* Make sure there is a MMU context. */ spin_lock(&mmu_context_lock); get_mmu_context(next); - cpu_set(cpu, next->cpu_vm_mask); + cpumask_set_cpu(cpu, mm_cpumask(next)); spin_unlock(&mmu_context_lock); /* From 59b97760771143a2e4221df1c517f915cdb303f7 Mon Sep 17 00:00:00 2001 From: Stoyan Gaydarov Date: Tue, 10 Mar 2009 06:10:40 +0100 Subject: [PATCH 4/6] BUG to BUG_ON changes Signed-off-by: Stoyan Gaydarov Signed-off-by: Jesper Nilsson --- arch/cris/mm/init.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c index 2fdd212eb250..514f46a4b230 100644 --- a/arch/cris/mm/init.c +++ b/arch/cris/mm/init.c @@ -25,8 +25,7 @@ mem_init(void) int codesize, reservedpages, datasize, initsize; unsigned long tmp; - if(!mem_map) - BUG(); + BUG_ON(!mem_map); /* max/min_low_pfn was set by setup.c * now we just copy it to some other necessary places... From c01ce82941af2e45c6f760d274bf33b485d60d1e Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 11 Mar 2009 01:46:11 +0100 Subject: [PATCH 5/6] cris: convert obsolete hw_interrupt_type to struct irq_chip Impact: cleanup Convert the last remaining users to struct irq_chip. Signed-off-by: Thomas Gleixner CC: Mikael Starvik Signed-off-by: Jesper Nilsson --- arch/cris/arch-v10/kernel/irq.c | 2 +- arch/cris/arch-v32/kernel/irq.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c index 65ed803dae6f..5d75f77f9c73 100644 --- a/arch/cris/arch-v10/kernel/irq.c +++ b/arch/cris/arch-v10/kernel/irq.c @@ -132,7 +132,7 @@ static void end_crisv10_irq(unsigned int irq) { } -static struct hw_interrupt_type crisv10_irq_type = { +static struct irq_chip crisv10_irq_type = { .typename = "CRISv10", .startup = startup_crisv10_irq, .shutdown = shutdown_crisv10_irq, diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c index 295131fee710..df3925cb1c7f 100644 --- a/arch/cris/arch-v32/kernel/irq.c +++ b/arch/cris/arch-v32/kernel/irq.c @@ -333,7 +333,7 @@ void set_affinity_crisv32_irq(unsigned int irq, const struct cpumask *dest) spin_unlock_irqrestore(&irq_lock, flags); } -static struct hw_interrupt_type crisv32_irq_type = { +static struct irq_chip crisv32_irq_type = { .typename = "CRISv32", .startup = startup_crisv32_irq, .shutdown = shutdown_crisv32_irq, From 3b5a53689730bef6cb4dfde1de53e836e5299547 Mon Sep 17 00:00:00 2001 From: Jesper Nilsson Date: Thu, 2 Apr 2009 15:57:45 +0200 Subject: [PATCH 6/6] CRISv32: Remove extraneous space between -I and the path. Fixes build error: LD init/built-in.o LD vmlinux SYSMAP System.map OBJCOPY arch/cris/arch-v32/boot/Image Kernel: arch/cris/arch-v32/boot/Image is ready GZIP arch/cris/arch-v32/boot/compressed/piggy.gz AS arch/cris/arch-v32/boot/compressed/head.o crisv32-axis-linux-gnu-gcc: cannot specify -o with -c or -S and multiple compilations make[3]: *** [arch/cris/arch-v32/boot/compressed/head.o] Error 1 make[2]: *** [arch/cris/arch-v32/boot/compressed/vmlinux] Error 2 make[1]: *** [zImage] Error 2 make: *** [sub-make] Error 2 Signed-off-by: Jesper Nilsson --- arch/cris/arch-v32/boot/compressed/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile index 5a1b31c99eaa..e176b8b69d92 100644 --- a/arch/cris/arch-v32/boot/compressed/Makefile +++ b/arch/cris/arch-v32/boot/compressed/Makefile @@ -2,9 +2,9 @@ # arch/cris/arch-v32/boot/compressed/Makefile # -asflags-y += -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch -ccflags-y += -O2 -I $(srctree)/include/asm/mach/ -I $(srctree)/include/asm/arch -ldflags-y += -T $(srctree)/$(src)/decompress.lds +asflags-y += -I$(srctree)/include/asm/mach/ -I$(srctree)/include/asm/arch +ccflags-y += -O2 -I$(srctree)/include/asm/mach/ -I$(srctree)/include/asm/arch +ldflags-y += -T$(srctree)/$(src)/decompress.lds OBJECTS = $(obj)/head.o $(obj)/misc.o OBJCOPYFLAGS = -O binary --remove-section=.bss