2005-04-17 06:20:36 +08:00
|
|
|
#ifdef __KERNEL__
|
2005-10-10 20:54:57 +08:00
|
|
|
#ifndef _ASM_POWERPC_IRQ_H
|
|
|
|
#define _ASM_POWERPC_IRQ_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version
|
|
|
|
* 2 of the License, or (at your option) any later version.
|
|
|
|
*/
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2012-02-15 05:06:50 +08:00
|
|
|
#include <linux/irqdomain.h>
|
2005-10-10 20:54:57 +08:00
|
|
|
#include <linux/threads.h>
|
2006-07-03 19:36:01 +08:00
|
|
|
#include <linux/list.h>
|
|
|
|
#include <linux/radix-tree.h>
|
2005-10-10 20:54:57 +08:00
|
|
|
|
|
|
|
#include <asm/types.h>
|
2011-07-27 07:09:06 +08:00
|
|
|
#include <linux/atomic.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
|
2006-07-03 19:36:01 +08:00
|
|
|
extern atomic_t ppc_n_lost_interrupts;
|
2005-10-10 20:54:57 +08:00
|
|
|
|
2006-07-03 19:36:01 +08:00
|
|
|
/* This number is used when no interrupt has been assigned */
|
|
|
|
#define NO_IRQ (0)
|
|
|
|
|
2009-10-14 03:44:44 +08:00
|
|
|
/* Total number of virq in the platform */
|
|
|
|
#define NR_IRQS CONFIG_NR_IRQS
|
2005-10-10 20:54:57 +08:00
|
|
|
|
2009-10-14 03:45:03 +08:00
|
|
|
/* Same thing, used by the generic IRQ code */
|
|
|
|
#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
|
|
|
|
|
2007-06-04 12:47:04 +08:00
|
|
|
extern irq_hw_number_t virq_to_hw(unsigned int virq);
|
2011-04-04 11:46:58 +08:00
|
|
|
|
2006-08-02 09:13:50 +08:00
|
|
|
/**
|
2006-07-03 19:36:01 +08:00
|
|
|
* irq_early_init - Init irq remapping subsystem
|
|
|
|
*/
|
|
|
|
extern void irq_early_init(void);
|
|
|
|
|
|
|
|
static __inline__ int irq_canonicalize(int irq)
|
2005-10-10 20:54:57 +08:00
|
|
|
{
|
2006-07-03 19:36:01 +08:00
|
|
|
return irq;
|
2005-10-10 20:54:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
extern int distribute_irqs;
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-10-10 20:54:57 +08:00
|
|
|
struct irqaction;
|
|
|
|
struct pt_regs;
|
|
|
|
|
powerpc: Implement accurate task and CPU time accounting
This implements accurate task and cpu time accounting for 64-bit
powerpc kernels. Instead of accounting a whole jiffy of time to a
task on a timer interrupt because that task happened to be running at
the time, we now account time in units of timebase ticks according to
the actual time spent by the task in user mode and kernel mode. We
also count the time spent processing hardware and software interrupts
accurately. This is conditional on CONFIG_VIRT_CPU_ACCOUNTING. If
that is not set, we do tick-based approximate accounting as before.
To get this accurate information, we read either the PURR (processor
utilization of resources register) on POWER5 machines, or the timebase
on other machines on
* each entry to the kernel from usermode
* each exit to usermode
* transitions between process context, hard irq context and soft irq
context in kernel mode
* context switches.
On POWER5 systems with shared-processor logical partitioning we also
read both the PURR and the timebase at each timer interrupt and
context switch in order to determine how much time has been taken by
the hypervisor to run other partitions ("steal" time). Unfortunately,
since we need values of the PURR on both threads at the same time to
accurately calculate the steal time, and since we can only calculate
steal time on a per-core basis, the apportioning of the steal time
between idle time (time which we ceded to the hypervisor in the idle
loop) and actual stolen time is somewhat approximate at the moment.
This is all based quite heavily on what s390 does, and it uses the
generic interfaces that were added by the s390 developers,
i.e. account_system_time(), account_user_time(), etc.
This patch doesn't add any new interfaces between the kernel and
userspace, and doesn't change the units in which time is reported to
userspace by things such as /proc/stat, /proc/<pid>/stat, getrusage(),
times(), etc. Internally the various task and cpu times are stored in
timebase units, but they are converted to USER_HZ units (1/100th of a
second) when reported to userspace. Some precision is therefore lost
but there should not be any accumulating error, since the internal
accumulation is at full precision.
Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-02-24 07:06:59 +08:00
|
|
|
#define __ARCH_HAS_DO_SOFTIRQ
|
|
|
|
|
2008-04-30 16:49:55 +08:00
|
|
|
#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
|
|
|
|
/*
|
|
|
|
* Per-cpu stacks for handling critical, debug and machine check
|
|
|
|
* level interrupts.
|
|
|
|
*/
|
|
|
|
extern struct thread_info *critirq_ctx[NR_CPUS];
|
|
|
|
extern struct thread_info *dbgirq_ctx[NR_CPUS];
|
|
|
|
extern struct thread_info *mcheckirq_ctx[NR_CPUS];
|
|
|
|
extern void exc_lvl_ctx_init(void);
|
|
|
|
#else
|
|
|
|
#define exc_lvl_ctx_init()
|
|
|
|
#endif
|
|
|
|
|
2005-10-10 20:54:57 +08:00
|
|
|
/*
|
|
|
|
* Per-cpu stacks for handling hard and soft interrupts.
|
|
|
|
*/
|
|
|
|
extern struct thread_info *hardirq_ctx[NR_CPUS];
|
|
|
|
extern struct thread_info *softirq_ctx[NR_CPUS];
|
|
|
|
|
|
|
|
extern void irq_ctx_init(void);
|
|
|
|
extern void call_do_softirq(struct thread_info *tp);
|
2013-09-23 12:29:11 +08:00
|
|
|
extern void call_do_irq(struct pt_regs *regs, struct thread_info *tp);
|
2005-10-20 07:23:26 +08:00
|
|
|
extern void do_IRQ(struct pt_regs *regs);
|
2013-09-23 12:29:11 +08:00
|
|
|
extern void __do_irq(struct pt_regs *regs);
|
2005-10-20 07:23:26 +08:00
|
|
|
|
2011-05-19 21:54:26 +08:00
|
|
|
int irq_choose_cpu(const struct cpumask *mask);
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#endif /* _ASM_IRQ_H */
|
|
|
|
#endif /* __KERNEL__ */
|