Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 116542
b: refs/heads/master
c: 2cc21ef
h: refs/heads/master
v: v3
  • Loading branch information
Thomas Gleixner authored and Ingo Molnar committed Oct 16, 2008
1 parent 8240ed2 commit ea85410
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 439 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: c6b7674f323622d86316bf7951ad9cae1ce24642
refs/heads/master: 2cc21ef843d4fb7da122239b644a1f6f0aca60a6
130 changes: 4 additions & 126 deletions trunk/arch/x86/kernel/io_apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,6 @@ struct irq_cfg;
struct irq_pin_list;
struct irq_cfg {
unsigned int irq;
#ifdef CONFIG_HAVE_SPARSE_IRQ
struct irq_cfg *next;
#endif
struct irq_pin_list *irq_2_pin;
cpumask_t domain;
cpumask_t old_domain;
Expand Down Expand Up @@ -151,15 +148,6 @@ static void init_one_irq_cfg(struct irq_cfg *cfg)

static struct irq_cfg *irq_cfgx;

#ifdef CONFIG_HAVE_SPARSE_IRQ
/*
* Protect the irq_cfgx_free freelist:
*/
static DEFINE_SPINLOCK(irq_cfg_lock);

static struct irq_cfg *irq_cfgx_free;
#endif

static void __init init_work(void *data)
{
struct dyn_array *da = data;
Expand All @@ -174,114 +162,7 @@ static void __init init_work(void *data)
legacy_count = ARRAY_SIZE(irq_cfg_legacy);
for (i = legacy_count; i < *da->nr; i++)
init_one_irq_cfg(&cfg[i]);

#ifdef CONFIG_HAVE_SPARSE_IRQ
for (i = 1; i < *da->nr; i++)
cfg[i-1].next = &cfg[i];

irq_cfgx_free = &irq_cfgx[legacy_count];
irq_cfgx[legacy_count - 1].next = NULL;
#endif
}

#ifdef CONFIG_HAVE_SPARSE_IRQ
/* need to be biger than size of irq_cfg_legacy */
static int nr_irq_cfg = 32;

static int __init parse_nr_irq_cfg(char *arg)
{
if (arg) {
nr_irq_cfg = simple_strtoul(arg, NULL, 0);
if (nr_irq_cfg < 32)
nr_irq_cfg = 32;
}
return 0;
}

early_param("nr_irq_cfg", parse_nr_irq_cfg);

#define for_each_irq_cfg(irqX, cfg) \
for (cfg = irq_cfgx, irqX = cfg->irq; cfg; cfg = cfg->next, irqX = cfg ? cfg->irq : -1U)


DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irq_cfg, PAGE_SIZE, init_work);

static struct irq_cfg *irq_cfg(unsigned int irq)
{
struct irq_cfg *cfg;

cfg = irq_cfgx;
while (cfg) {
if (cfg->irq == irq)
return cfg;

cfg = cfg->next;
}

return NULL;
}

static struct irq_cfg *irq_cfg_alloc(unsigned int irq)
{
struct irq_cfg *cfg, *cfg_pri;
unsigned long flags;
int count = 0;
int i;

cfg_pri = cfg = irq_cfgx;
while (cfg) {
if (cfg->irq == irq)
return cfg;

cfg_pri = cfg;
cfg = cfg->next;
count++;
}

spin_lock_irqsave(&irq_cfg_lock, flags);
if (!irq_cfgx_free) {
unsigned long phys;
unsigned long total_bytes;
/*
* we run out of pre-allocate ones, allocate more
*/
printk(KERN_DEBUG "try to get more irq_cfg %d\n", nr_irq_cfg);

total_bytes = sizeof(struct irq_cfg) * nr_irq_cfg;
if (after_bootmem)
cfg = kzalloc(total_bytes, GFP_ATOMIC);
else
cfg = __alloc_bootmem_nopanic(total_bytes, PAGE_SIZE, 0);

if (!cfg)
panic("please boot with nr_irq_cfg= %d\n", count * 2);

phys = __pa(cfg);
printk(KERN_DEBUG "irq_cfg ==> [%#lx - %#lx]\n", phys, phys + total_bytes);

for (i = 0; i < nr_irq_cfg; i++)
init_one_irq_cfg(&cfg[i]);

for (i = 1; i < nr_irq_cfg; i++)
cfg[i-1].next = &cfg[i];

irq_cfgx_free = cfg;
}

cfg = irq_cfgx_free;
irq_cfgx_free = irq_cfgx_free->next;
cfg->next = NULL;
if (cfg_pri)
cfg_pri->next = cfg;
else
irq_cfgx = cfg;
cfg->irq = irq;

spin_unlock_irqrestore(&irq_cfg_lock, flags);

return cfg;
}
#else

#define for_each_irq_cfg(irq, cfg) \
for (irq = 0, cfg = &irq_cfgx[irq]; irq < nr_irqs; irq++, cfg = &irq_cfgx[irq])
Expand All @@ -290,17 +171,16 @@ DEFINE_DYN_ARRAY(irq_cfgx, sizeof(struct irq_cfg), nr_irqs, PAGE_SIZE, init_work

struct irq_cfg *irq_cfg(unsigned int irq)
{
if (irq < nr_irqs)
return &irq_cfgx[irq];
if (irq < nr_irqs)
return &irq_cfgx[irq];

return NULL;
return NULL;
}
struct irq_cfg *irq_cfg_alloc(unsigned int irq)
{
return irq_cfg(irq);
return irq_cfg(irq);
}

#endif
/*
* This is performance-critical, we want to do it O(1)
*
Expand Down Expand Up @@ -3068,9 +2948,7 @@ unsigned int create_irq_nr(unsigned int irq_want)
unsigned long flags;
struct irq_cfg *cfg_new;

#ifndef CONFIG_HAVE_SPARSE_IRQ
irq_want = nr_irqs - 1;
#endif

irq = 0;
spin_lock_irqsave(&vector_lock, flags);
Expand Down
8 changes: 0 additions & 8 deletions trunk/arch/x86/kernel/irq_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,20 +272,12 @@ int show_interrupts(struct seq_file *p, void *v)
struct irq_desc *desc = NULL;
int tail = 0;

#ifdef CONFIG_HAVE_SPARSE_IRQ
desc = (struct irq_desc *)v;
entries = -1U;
i = desc->irq;
if (!desc->next)
tail = 1;
#else
entries = nr_irqs - 1;
i = *(loff_t *) v;
if (i == nr_irqs)
tail = 1;
else
desc = irq_to_desc(i);
#endif

if (i == 0) {
seq_printf(p, " ");
Expand Down
8 changes: 0 additions & 8 deletions trunk/arch/x86/kernel/irq_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,12 @@ int show_interrupts(struct seq_file *p, void *v)
struct irq_desc *desc = NULL;
int tail = 0;

#ifdef CONFIG_HAVE_SPARSE_IRQ
desc = (struct irq_desc *)v;
entries = -1U;
i = desc->irq;
if (!desc->next)
tail = 1;
#else
entries = nr_irqs - 1;
i = *(loff_t *) v;
if (i == nr_irqs)
tail = 1;
else
desc = irq_to_desc(i);
#endif

if (i == 0) {
seq_printf(p, " ");
Expand Down
31 changes: 0 additions & 31 deletions trunk/drivers/char/random.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,6 @@ struct timer_rand_state {
unsigned dont_count_entropy:1;
};

#ifndef CONFIG_HAVE_SPARSE_IRQ

#ifdef CONFIG_HAVE_DYN_ARRAY
static struct timer_rand_state **irq_timer_state;
DEFINE_DYN_ARRAY(irq_timer_state, sizeof(struct timer_rand_state *), nr_irqs, PAGE_SIZE, NULL);
Expand All @@ -583,33 +581,6 @@ static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *stat
irq_timer_state[irq] = state;
}

#else

static struct timer_rand_state *get_timer_rand_state(unsigned int irq)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);

if (!desc)
return NULL;

return desc->timer_rand_state;
}

static void set_timer_rand_state(unsigned int irq, struct timer_rand_state *state)
{
struct irq_desc *desc;

desc = irq_to_desc(irq);

if (!desc)
return;

desc->timer_rand_state = state;
}
#endif

static struct timer_rand_state input_timer_state;

/*
Expand Down Expand Up @@ -967,10 +938,8 @@ void rand_initialize_irq(int irq)
{
struct timer_rand_state *state;

#ifndef CONFIG_HAVE_SPARSE_IRQ
if (irq >= nr_irqs)
return;
#endif

state = get_timer_rand_state(irq);

Expand Down
19 changes: 1 addition & 18 deletions trunk/drivers/pci/htirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ void unmask_ht_irq(unsigned int irq)
write_ht_irq_msg(irq, &msg);
}

static unsigned int build_irq_for_pci_dev(struct pci_dev *dev)
{
unsigned int irq;

irq = dev->bus->number;
irq <<= 8;
irq |= dev->devfn;
irq <<= 12;

return irq;
}

/**
* __ht_create_irq - create an irq and attach it to a device.
* @dev: The hypertransport device to find the irq capability on.
Expand All @@ -110,7 +98,6 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
int max_irq;
int pos;
int irq;
unsigned int irq_want;

pos = pci_find_ht_capability(dev, HT_CAPTYPE_IRQ);
if (!pos)
Expand Down Expand Up @@ -138,12 +125,8 @@ int __ht_create_irq(struct pci_dev *dev, int idx, ht_irq_update_t *update)
cfg->msg.address_lo = 0xffffffff;
cfg->msg.address_hi = 0xffffffff;

irq_want= build_irq_for_pci_dev(dev);
#ifdef CONFIG_HAVE_SPARSE_IRQ
irq = create_irq_nr(irq_want + idx);
#else
irq = create_irq();
#endif

if (irq <= 0) {
kfree(cfg);
return -EBUSY;
Expand Down
Loading

0 comments on commit ea85410

Please sign in to comment.