Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 136382
b: refs/heads/master
c: 9332fcc
h: refs/heads/master
v: v3
  • Loading branch information
Mike Travis authored and Ingo Molnar committed Jan 11, 2009
1 parent c15d4d6 commit 6f148f6
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0fa0ebbf15addc1be8f73325d809c8547a9de304
refs/heads/master: 9332fccdedf8e09448f3b69b624211ae879f6c45
8 changes: 2 additions & 6 deletions trunk/arch/x86/include/asm/apicdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,8 @@
#define APIC_BASE_MSR 0x800
#define X2APIC_ENABLE (1UL << 10)

#ifdef CONFIG_X86_32
# define MAX_IO_APICS 64
#else
# define MAX_IO_APICS 128
# define MAX_LOCAL_APIC 32768
#endif
/* get MAX_IO_APICS */
#include <asm/apicnum.h>

/*
* All x86-64 systems are xAPIC compatible.
Expand Down
12 changes: 12 additions & 0 deletions trunk/arch/x86/include/asm/apicnum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#ifndef _ASM_X86_APICNUM_H
#define _ASM_X86_APICNUM_H

/* define MAX_IO_APICS */
#ifdef CONFIG_X86_32
# define MAX_IO_APICS 64
#else
# define MAX_IO_APICS 128
# define MAX_LOCAL_APIC 32768
#endif

#endif /* _ASM_X86_APICNUM_H */
16 changes: 11 additions & 5 deletions trunk/arch/x86/include/asm/irq_vectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,24 @@

#if defined(CONFIG_X86_IO_APIC) && !defined(CONFIG_X86_VOYAGER)

#include <asm/apicnum.h> /* need MAX_IO_APICS */

#ifndef CONFIG_SPARSE_IRQ
# if NR_CPUS < MAX_IO_APICS
# define NR_IRQS (NR_VECTORS + (32 * NR_CPUS))
# else
# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
# endif
#else
# if (8 * NR_CPUS) > (32 * MAX_IO_APICS)
# define NR_IRQS (NR_VECTORS + (8 * NR_CPUS))
# else
# define NR_IRQS (NR_VECTORS + (32 * MAX_IO_APICS))
# endif

/* defined as a macro so nr_irqs = max_nr_irqs(nr_cpu_ids) can be used */
# define max_nr_irqs(nr_cpus) \
((8 * nr_cpus) > (32 * MAX_IO_APICS) ? \
(NR_VECTORS + (8 * NR_CPUS)) : \
(NR_VECTORS + (32 * MAX_IO_APICS))) \

# define NR_IRQS max_nr_irqs(NR_CPUS)

#endif

#elif defined(CONFIG_X86_VOYAGER)
Expand Down
7 changes: 7 additions & 0 deletions trunk/include/linux/irqnr.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@

# define for_each_irq_desc_reverse(irq, desc) \
for (irq = nr_irqs - 1; irq >= 0; irq--)

#else /* CONFIG_GENERIC_HARDIRQS */

#include <asm/irq_vectors.h> /* need possible max_nr_irqs() */

extern int nr_irqs;
extern struct irq_desc *irq_to_desc(unsigned int irq);

# ifndef max_nr_irqs
# define max_nr_irqs(nr_cpus) NR_IRQS
# endif

# define for_each_irq_desc(irq, desc) \
for (irq = 0, desc = irq_to_desc(irq); irq < nr_irqs; \
irq++, desc = irq_to_desc(irq)) \
Expand Down
3 changes: 3 additions & 0 deletions trunk/kernel/irq/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ int __init early_irq_init(void)
int legacy_count;
int i;

/* initialize nr_irqs based on nr_cpu_ids */
nr_irqs = max_nr_irqs(nr_cpu_ids);

printk(KERN_INFO "NR_IRQS:%d nr_irqs:%d\n", NR_IRQS, nr_irqs);

desc = irq_desc_legacy;
Expand Down

0 comments on commit 6f148f6

Please sign in to comment.