Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 62294
b: refs/heads/master
c: 93b3238
h: refs/heads/master
v: v3
  • Loading branch information
David S. Miller committed Jul 21, 2007
1 parent a8f5e83 commit 4cbeac1
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 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: e83fb17f9ba6ea0c64d084cca0c557d7e7dc9693
refs/heads/master: 93b3238ef8b04f1383b2aa7704487fb3c0e44193
44 changes: 25 additions & 19 deletions trunk/arch/sparc64/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ struct ino_bucket ivector_table[NUM_IVECS] __attribute__ ((aligned (SMP_CACHE_BY
*/
#define irq_work(__cpu) &(trap_block[(__cpu)].irq_worklist)

static unsigned int virt_to_real_irq_table[NR_IRQS];
static struct {
unsigned int irq;
unsigned int dev_handle;
unsigned int dev_ino;
} virt_to_real_irq_table[NR_IRQS];

static unsigned char virt_irq_alloc(unsigned int real_irq)
{
Expand All @@ -96,15 +100,15 @@ static unsigned char virt_irq_alloc(unsigned int real_irq)
BUILD_BUG_ON(NR_IRQS >= 256);

for (ent = 1; ent < NR_IRQS; ent++) {
if (!virt_to_real_irq_table[ent])
if (!virt_to_real_irq_table[ent].irq)
break;
}
if (ent >= NR_IRQS) {
printk(KERN_ERR "IRQ: Out of virtual IRQs.\n");
return 0;
}

virt_to_real_irq_table[ent] = real_irq;
virt_to_real_irq_table[ent].irq = real_irq;

return ent;
}
Expand All @@ -117,16 +121,16 @@ static void virt_irq_free(unsigned int virt_irq)
if (virt_irq >= NR_IRQS)
return;

real_irq = virt_to_real_irq_table[virt_irq];
virt_to_real_irq_table[virt_irq] = 0;
real_irq = virt_to_real_irq_table[virt_irq].irq;
virt_to_real_irq_table[virt_irq].irq = 0;

__bucket(real_irq)->virt_irq = 0;
}
#endif

static unsigned int virt_to_real_irq(unsigned char virt_irq)
{
return virt_to_real_irq_table[virt_irq];
return virt_to_real_irq_table[virt_irq].irq;
}

/*
Expand Down Expand Up @@ -418,16 +422,15 @@ static void sun4v_irq_end(unsigned int virt_irq)
static void sun4v_virq_enable(unsigned int virt_irq)
{
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
unsigned int ino = bucket - &ivector_table[0];

if (likely(bucket)) {
unsigned long cpuid, dev_handle, dev_ino;
int err;

cpuid = irq_choose_cpu(virt_irq);

dev_handle = ino & IMAP_IGN;
dev_ino = ino & IMAP_INO;
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;

err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
if (err != HV_EOK)
Expand All @@ -452,16 +455,15 @@ static void sun4v_virq_enable(unsigned int virt_irq)
static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask)
{
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
unsigned int ino = bucket - &ivector_table[0];

if (likely(bucket)) {
unsigned long cpuid, dev_handle, dev_ino;
int err;

cpuid = irq_choose_cpu(virt_irq);

dev_handle = ino & IMAP_IGN;
dev_ino = ino & IMAP_INO;
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;

err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
if (err != HV_EOK)
Expand All @@ -474,14 +476,13 @@ static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask)
static void sun4v_virq_disable(unsigned int virt_irq)
{
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
unsigned int ino = bucket - &ivector_table[0];

if (likely(bucket)) {
unsigned long dev_handle, dev_ino;
int err;

dev_handle = ino & IMAP_IGN;
dev_ino = ino & IMAP_INO;
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;

err = sun4v_vintr_set_valid(dev_handle, dev_ino,
HV_INTR_DISABLED);
Expand All @@ -495,7 +496,6 @@ static void sun4v_virq_disable(unsigned int virt_irq)
static void sun4v_virq_end(unsigned int virt_irq)
{
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
unsigned int ino = bucket - &ivector_table[0];
struct irq_desc *desc = irq_desc + virt_irq;

if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
Expand All @@ -505,8 +505,8 @@ static void sun4v_virq_end(unsigned int virt_irq)
unsigned long dev_handle, dev_ino;
int err;

dev_handle = ino & IMAP_IGN;
dev_ino = ino & IMAP_INO;
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;

err = sun4v_vintr_set_state(dev_handle, dev_ino,
HV_INTR_STATE_IDLE);
Expand Down Expand Up @@ -700,6 +700,7 @@ unsigned int sun4v_build_irq(u32 devhandle, unsigned int devino)
unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
{
unsigned long sysino, hv_err;
unsigned int virq;

BUG_ON(devhandle & devino);

Expand All @@ -713,7 +714,12 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
prom_halt();
}

return sun4v_build_common(sysino, &sun4v_virq);
virq = sun4v_build_common(sysino, &sun4v_virq);

virt_to_real_irq_table[virq].dev_handle = devhandle;
virt_to_real_irq_table[virq].dev_ino = devino;

return virq;
}

#ifdef CONFIG_PCI_MSI
Expand Down

0 comments on commit 4cbeac1

Please sign in to comment.