Commit 77182300 authored by David S. Miller's avatar David S. Miller

[SPARC64]: Kill ugly __bucket() macro.

All the users go through virt_irq_to_bucket() and essentially
want to go from a virt_irq to an INO, but we have a way
to do that already via virt_to_real_irq_table[].dev_ino.

This also allows us to kill both virt_to_real_irq() and
virt_irq_to_bucket().
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bb74b734
...@@ -122,7 +122,6 @@ static void bucket_set_virt_irq(unsigned long bucket_pa, ...@@ -122,7 +122,6 @@ static void bucket_set_virt_irq(unsigned long bucket_pa,
"i" (ASI_PHYS_USE_EC)); "i" (ASI_PHYS_USE_EC));
} }
#define __bucket(irq) ((struct ino_bucket *)(irq))
#define __irq(bucket) ((unsigned long)(bucket)) #define __irq(bucket) ((unsigned long)(bucket))
#define irq_work_pa(__cpu) &(trap_block[(__cpu)].irq_worklist_pa) #define irq_work_pa(__cpu) &(trap_block[(__cpu)].irq_worklist_pa)
...@@ -179,11 +178,6 @@ void virt_irq_free(unsigned int virt_irq) ...@@ -179,11 +178,6 @@ void virt_irq_free(unsigned int virt_irq)
} }
#endif #endif
static unsigned long virt_to_real_irq(unsigned char virt_irq)
{
return virt_to_real_irq_table[virt_irq].irq;
}
/* /*
* /proc/interrupts printing: * /proc/interrupts printing:
*/ */
...@@ -270,17 +264,6 @@ struct irq_handler_data { ...@@ -270,17 +264,6 @@ struct irq_handler_data {
void *pre_handler_arg2; void *pre_handler_arg2;
}; };
static inline struct ino_bucket *virt_irq_to_bucket(unsigned int virt_irq)
{
unsigned long real_irq = virt_to_real_irq(virt_irq);
struct ino_bucket *bucket = NULL;
if (likely(real_irq))
bucket = __bucket(real_irq);
return bucket;
}
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
static int irq_choose_cpu(unsigned int virt_irq) static int irq_choose_cpu(unsigned int virt_irq)
{ {
...@@ -380,15 +363,10 @@ static void sun4u_irq_end(unsigned int virt_irq) ...@@ -380,15 +363,10 @@ static void sun4u_irq_end(unsigned int virt_irq)
static void sun4v_irq_enable(unsigned int virt_irq) static void sun4v_irq_enable(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); unsigned int ino = virt_to_real_irq_table[virt_irq].dev_ino;
unsigned int ino = bucket - &ivector_table[0]; unsigned long cpuid = irq_choose_cpu(virt_irq);
if (likely(bucket)) {
unsigned long cpuid;
int err; int err;
cpuid = irq_choose_cpu(virt_irq);
err = sun4v_intr_settarget(ino, cpuid); err = sun4v_intr_settarget(ino, cpuid);
if (err != HV_EOK) if (err != HV_EOK)
printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): " printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
...@@ -401,66 +379,48 @@ static void sun4v_irq_enable(unsigned int virt_irq) ...@@ -401,66 +379,48 @@ static void sun4v_irq_enable(unsigned int virt_irq)
if (err != HV_EOK) if (err != HV_EOK)
printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n", printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n",
ino, err); ino, err);
}
} }
static void sun4v_set_affinity(unsigned int virt_irq, cpumask_t mask) static void sun4v_set_affinity(unsigned int virt_irq, cpumask_t mask)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); unsigned int ino = virt_to_real_irq_table[virt_irq].dev_ino;
unsigned int ino = bucket - &ivector_table[0]; unsigned long cpuid = irq_choose_cpu(virt_irq);
if (likely(bucket)) {
unsigned long cpuid;
int err; int err;
cpuid = irq_choose_cpu(virt_irq);
err = sun4v_intr_settarget(ino, cpuid); err = sun4v_intr_settarget(ino, cpuid);
if (err != HV_EOK) if (err != HV_EOK)
printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): " printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
"err(%d)\n", ino, cpuid, err); "err(%d)\n", ino, cpuid, err);
}
} }
static void sun4v_irq_disable(unsigned int virt_irq) static void sun4v_irq_disable(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); unsigned int ino = virt_to_real_irq_table[virt_irq].dev_ino;
unsigned int ino = bucket - &ivector_table[0];
if (likely(bucket)) {
int err; int err;
err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED); err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED);
if (err != HV_EOK) if (err != HV_EOK)
printk(KERN_ERR "sun4v_intr_setenabled(%x): " printk(KERN_ERR "sun4v_intr_setenabled(%x): "
"err(%d)\n", ino, err); "err(%d)\n", ino, err);
}
} }
static void sun4v_irq_end(unsigned int virt_irq) static void sun4v_irq_end(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); unsigned int ino = virt_to_real_irq_table[virt_irq].dev_ino;
unsigned int ino = bucket - &ivector_table[0];
struct irq_desc *desc = irq_desc + virt_irq; struct irq_desc *desc = irq_desc + virt_irq;
int err;
if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
return; return;
if (likely(bucket)) {
int err;
err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE); err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
if (err != HV_EOK) if (err != HV_EOK)
printk(KERN_ERR "sun4v_intr_setstate(%x): " printk(KERN_ERR "sun4v_intr_setstate(%x): "
"err(%d)\n", ino, err); "err(%d)\n", ino, err);
}
} }
static void sun4v_virq_enable(unsigned int virt_irq) static void sun4v_virq_enable(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
if (likely(bucket)) {
unsigned long cpuid, dev_handle, dev_ino; unsigned long cpuid, dev_handle, dev_ino;
int err; int err;
...@@ -486,14 +446,10 @@ static void sun4v_virq_enable(unsigned int virt_irq) ...@@ -486,14 +446,10 @@ static void sun4v_virq_enable(unsigned int virt_irq)
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
"HV_INTR_ENABLED): err(%d)\n", "HV_INTR_ENABLED): err(%d)\n",
dev_handle, dev_ino, err); dev_handle, dev_ino, err);
}
} }
static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask) static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
if (likely(bucket)) {
unsigned long cpuid, dev_handle, dev_ino; unsigned long cpuid, dev_handle, dev_ino;
int err; int err;
...@@ -507,14 +463,10 @@ static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask) ...@@ -507,14 +463,10 @@ static void sun4v_virt_set_affinity(unsigned int virt_irq, cpumask_t mask)
printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): " printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
"err(%d)\n", "err(%d)\n",
dev_handle, dev_ino, cpuid, err); dev_handle, dev_ino, cpuid, err);
}
} }
static void sun4v_virq_disable(unsigned int virt_irq) static void sun4v_virq_disable(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
if (likely(bucket)) {
unsigned long dev_handle, dev_ino; unsigned long dev_handle, dev_ino;
int err; int err;
...@@ -527,21 +479,17 @@ static void sun4v_virq_disable(unsigned int virt_irq) ...@@ -527,21 +479,17 @@ static void sun4v_virq_disable(unsigned int virt_irq)
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
"HV_INTR_DISABLED): err(%d)\n", "HV_INTR_DISABLED): err(%d)\n",
dev_handle, dev_ino, err); dev_handle, dev_ino, err);
}
} }
static void sun4v_virq_end(unsigned int virt_irq) static void sun4v_virq_end(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq);
struct irq_desc *desc = irq_desc + virt_irq; struct irq_desc *desc = irq_desc + virt_irq;
unsigned long dev_handle, dev_ino;
int err;
if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) if (unlikely(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
return; return;
if (likely(bucket)) {
unsigned long dev_handle, dev_ino;
int err;
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle; dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino; dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
...@@ -551,7 +499,6 @@ static void sun4v_virq_end(unsigned int virt_irq) ...@@ -551,7 +499,6 @@ static void sun4v_virq_end(unsigned int virt_irq)
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx," printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
"HV_INTR_STATE_IDLE): err(%d)\n", "HV_INTR_STATE_IDLE): err(%d)\n",
dev_handle, dev_ino, err); dev_handle, dev_ino, err);
}
} }
static void run_pre_handler(unsigned int virt_irq) static void run_pre_handler(unsigned int virt_irq)
...@@ -749,11 +696,10 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino) ...@@ -749,11 +696,10 @@ unsigned int sun4v_build_virq(u32 devhandle, unsigned int devino)
void ack_bad_irq(unsigned int virt_irq) void ack_bad_irq(unsigned int virt_irq)
{ {
struct ino_bucket *bucket = virt_irq_to_bucket(virt_irq); unsigned int ino = virt_to_real_irq_table[virt_irq].dev_ino;
unsigned int ino = 0xdeadbeef;
if (bucket) if (!ino)
ino = bucket - &ivector_table[0]; ino = 0xdeadbeef;
printk(KERN_CRIT "Unexpected IRQ from ino[%x] virt_irq[%u]\n", printk(KERN_CRIT "Unexpected IRQ from ino[%x] virt_irq[%u]\n",
ino, virt_irq); ino, virt_irq);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment