smp.c (e16b38f71322efd8a221f64b6ddc0748d21d2e1a) smp.c (c97d4869a23c439d2bc23cb26c1147c099f9ff78)
1/*
2 * linux/arch/arm/kernel/smp.c
3 *
4 * Copyright (C) 2002 ARM Limited, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
1/*
2 * linux/arch/arm/kernel/smp.c
3 *
4 * Copyright (C) 2002 ARM Limited, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/module.h>
10#include <linux/delay.h>
11#include <linux/init.h>
12#include <linux/spinlock.h>
13#include <linux/sched.h>
14#include <linux/interrupt.h>
15#include <linux/cache.h>
16#include <linux/profile.h>
17#include <linux/errno.h>
18#include <linux/mm.h>
19#include <linux/cpu.h>
20#include <linux/smp.h>
21#include <linux/seq_file.h>
11#include <linux/delay.h>
12#include <linux/init.h>
13#include <linux/spinlock.h>
14#include <linux/sched.h>
15#include <linux/interrupt.h>
16#include <linux/cache.h>
17#include <linux/profile.h>
18#include <linux/errno.h>
19#include <linux/mm.h>
20#include <linux/cpu.h>
21#include <linux/smp.h>
22#include <linux/seq_file.h>
23#include <linux/irq.h>
22
23#include <asm/atomic.h>
24#include <asm/cacheflush.h>
25#include <asm/cpu.h>
26#include <asm/mmu_context.h>
27#include <asm/pgtable.h>
28#include <asm/pgalloc.h>
29#include <asm/processor.h>

--- 439 unchanged lines hidden (view full) ---

469 seq_printf(p, "LOC: ");
470
471 for_each_present_cpu(cpu)
472 seq_printf(p, "%10u ", irq_stat[cpu].local_timer_irqs);
473
474 seq_putc(p, '\n');
475}
476
24
25#include <asm/atomic.h>
26#include <asm/cacheflush.h>
27#include <asm/cpu.h>
28#include <asm/mmu_context.h>
29#include <asm/pgtable.h>
30#include <asm/pgalloc.h>
31#include <asm/processor.h>

--- 439 unchanged lines hidden (view full) ---

471 seq_printf(p, "LOC: ");
472
473 for_each_present_cpu(cpu)
474 seq_printf(p, "%10u ", irq_stat[cpu].local_timer_irqs);
475
476 seq_putc(p, '\n');
477}
478
477static void ipi_timer(struct pt_regs *regs)
479static void ipi_timer(void)
478{
480{
479 int user = user_mode(regs);
480
481 irq_enter();
481 irq_enter();
482 profile_tick(CPU_PROFILING, regs);
483 update_process_times(user);
482 profile_tick(CPU_PROFILING);
483 update_process_times(user_mode(get_irq_regs()));
484 irq_exit();
485}
486
487#ifdef CONFIG_LOCAL_TIMERS
488asmlinkage void do_local_timer(struct pt_regs *regs)
489{
484 irq_exit();
485}
486
487#ifdef CONFIG_LOCAL_TIMERS
488asmlinkage void do_local_timer(struct pt_regs *regs)
489{
490 struct pt_regs *old_regs = set_irq_regs(regs);
490 int cpu = smp_processor_id();
491
492 if (local_timer_ack()) {
493 irq_stat[cpu].local_timer_irqs++;
491 int cpu = smp_processor_id();
492
493 if (local_timer_ack()) {
494 irq_stat[cpu].local_timer_irqs++;
494 ipi_timer(regs);
495 ipi_timer();
495 }
496 }
497
498 set_irq_regs(old_regs);
496}
497#endif
498
499/*
500 * ipi_call_function - handle IPI from smp_call_function()
501 *
502 * Note that we copy data out of the cross-call structure and then
503 * let the caller know that we're here and have done with their data

--- 42 unchanged lines hidden (view full) ---

546 * different mechanism):
547 *
548 * Bit 0 - Inter-processor function call
549 */
550asmlinkage void do_IPI(struct pt_regs *regs)
551{
552 unsigned int cpu = smp_processor_id();
553 struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
499}
500#endif
501
502/*
503 * ipi_call_function - handle IPI from smp_call_function()
504 *
505 * Note that we copy data out of the cross-call structure and then
506 * let the caller know that we're here and have done with their data

--- 42 unchanged lines hidden (view full) ---

549 * different mechanism):
550 *
551 * Bit 0 - Inter-processor function call
552 */
553asmlinkage void do_IPI(struct pt_regs *regs)
554{
555 unsigned int cpu = smp_processor_id();
556 struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
557 struct pt_regs *old_regs = set_irq_regs(regs);
554
555 ipi->ipi_count++;
556
557 for (;;) {
558 unsigned long msgs;
559
560 spin_lock(&ipi->lock);
561 msgs = ipi->bits;

--- 7 unchanged lines hidden (view full) ---

569 unsigned nextmsg;
570
571 nextmsg = msgs & -msgs;
572 msgs &= ~nextmsg;
573 nextmsg = ffz(~nextmsg);
574
575 switch (nextmsg) {
576 case IPI_TIMER:
558
559 ipi->ipi_count++;
560
561 for (;;) {
562 unsigned long msgs;
563
564 spin_lock(&ipi->lock);
565 msgs = ipi->bits;

--- 7 unchanged lines hidden (view full) ---

573 unsigned nextmsg;
574
575 nextmsg = msgs & -msgs;
576 msgs &= ~nextmsg;
577 nextmsg = ffz(~nextmsg);
578
579 switch (nextmsg) {
580 case IPI_TIMER:
577 ipi_timer(regs);
581 ipi_timer();
578 break;
579
580 case IPI_RESCHEDULE:
581 /*
582 * nothing more to do - eveything is
583 * done on the interrupt return path
584 */
585 break;

--- 8 unchanged lines hidden (view full) ---

594
595 default:
596 printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n",
597 cpu, nextmsg);
598 break;
599 }
600 } while (msgs);
601 }
582 break;
583
584 case IPI_RESCHEDULE:
585 /*
586 * nothing more to do - eveything is
587 * done on the interrupt return path
588 */
589 break;

--- 8 unchanged lines hidden (view full) ---

598
599 default:
600 printk(KERN_CRIT "CPU%u: Unknown IPI message 0x%x\n",
601 cpu, nextmsg);
602 break;
603 }
604 } while (msgs);
605 }
606
607 set_irq_regs(old_regs);
602}
603
604void smp_send_reschedule(int cpu)
605{
606 send_ipi_message(cpumask_of_cpu(cpu), IPI_RESCHEDULE);
607}
608
609void smp_send_timer(void)

--- 143 unchanged lines hidden ---
608}
609
610void smp_send_reschedule(int cpu)
611{
612 send_ipi_message(cpumask_of_cpu(cpu), IPI_RESCHEDULE);
613}
614
615void smp_send_timer(void)

--- 143 unchanged lines hidden ---