mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-18 01:34:14 +08:00
[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: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
bb74b734a6
commit
771823007f
@ -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)
|
|||||||
}
|
}
|
||||||
#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 {
|
|||||||
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,178 +363,142 @@ 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);
|
||||||
|
int err;
|
||||||
|
|
||||||
if (likely(bucket)) {
|
err = sun4v_intr_settarget(ino, cpuid);
|
||||||
unsigned long cpuid;
|
if (err != HV_EOK)
|
||||||
int err;
|
printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
|
||||||
|
"err(%d)\n", ino, cpuid, err);
|
||||||
cpuid = irq_choose_cpu(virt_irq);
|
err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
|
||||||
|
if (err != HV_EOK)
|
||||||
err = sun4v_intr_settarget(ino, cpuid);
|
printk(KERN_ERR "sun4v_intr_setstate(%x): "
|
||||||
if (err != HV_EOK)
|
"err(%d)\n", ino, err);
|
||||||
printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
|
err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED);
|
||||||
"err(%d)\n", ino, cpuid, err);
|
if (err != HV_EOK)
|
||||||
err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
|
printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n",
|
||||||
if (err != HV_EOK)
|
ino, err);
|
||||||
printk(KERN_ERR "sun4v_intr_setstate(%x): "
|
|
||||||
"err(%d)\n", ino, err);
|
|
||||||
err = sun4v_intr_setenabled(ino, HV_INTR_ENABLED);
|
|
||||||
if (err != HV_EOK)
|
|
||||||
printk(KERN_ERR "sun4v_intr_setenabled(%x): err(%d)\n",
|
|
||||||
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);
|
||||||
|
int err;
|
||||||
|
|
||||||
if (likely(bucket)) {
|
err = sun4v_intr_settarget(ino, cpuid);
|
||||||
unsigned long cpuid;
|
if (err != HV_EOK)
|
||||||
int err;
|
printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
|
||||||
|
"err(%d)\n", ino, cpuid, err);
|
||||||
cpuid = irq_choose_cpu(virt_irq);
|
|
||||||
|
|
||||||
err = sun4v_intr_settarget(ino, cpuid);
|
|
||||||
if (err != HV_EOK)
|
|
||||||
printk(KERN_ERR "sun4v_intr_settarget(%x,%lu): "
|
|
||||||
"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];
|
int err;
|
||||||
|
|
||||||
if (likely(bucket)) {
|
err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED);
|
||||||
int err;
|
if (err != HV_EOK)
|
||||||
|
printk(KERN_ERR "sun4v_intr_setenabled(%x): "
|
||||||
err = sun4v_intr_setenabled(ino, HV_INTR_DISABLED);
|
"err(%d)\n", ino, err);
|
||||||
if (err != HV_EOK)
|
|
||||||
printk(KERN_ERR "sun4v_intr_setenabled(%x): "
|
|
||||||
"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)) {
|
err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
|
||||||
int err;
|
if (err != HV_EOK)
|
||||||
|
printk(KERN_ERR "sun4v_intr_setstate(%x): "
|
||||||
err = sun4v_intr_setstate(ino, HV_INTR_STATE_IDLE);
|
"err(%d)\n", ino, err);
|
||||||
if (err != HV_EOK)
|
|
||||||
printk(KERN_ERR "sun4v_intr_setstate(%x): "
|
|
||||||
"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);
|
unsigned long cpuid, dev_handle, dev_ino;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (likely(bucket)) {
|
cpuid = irq_choose_cpu(virt_irq);
|
||||||
unsigned long cpuid, dev_handle, dev_ino;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
cpuid = irq_choose_cpu(virt_irq);
|
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
||||||
|
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
||||||
|
|
||||||
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
|
||||||
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
if (err != HV_EOK)
|
||||||
|
printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
|
||||||
err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
|
"err(%d)\n",
|
||||||
if (err != HV_EOK)
|
dev_handle, dev_ino, cpuid, err);
|
||||||
printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
|
err = sun4v_vintr_set_state(dev_handle, dev_ino,
|
||||||
"err(%d)\n",
|
HV_INTR_STATE_IDLE);
|
||||||
dev_handle, dev_ino, cpuid, err);
|
if (err != HV_EOK)
|
||||||
err = sun4v_vintr_set_state(dev_handle, dev_ino,
|
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
||||||
HV_INTR_STATE_IDLE);
|
"HV_INTR_STATE_IDLE): err(%d)\n",
|
||||||
if (err != HV_EOK)
|
dev_handle, dev_ino, err);
|
||||||
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
err = sun4v_vintr_set_valid(dev_handle, dev_ino,
|
||||||
"HV_INTR_STATE_IDLE): err(%d)\n",
|
HV_INTR_ENABLED);
|
||||||
dev_handle, dev_ino, err);
|
if (err != HV_EOK)
|
||||||
err = sun4v_vintr_set_valid(dev_handle, dev_ino,
|
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
||||||
HV_INTR_ENABLED);
|
"HV_INTR_ENABLED): err(%d)\n",
|
||||||
if (err != HV_EOK)
|
dev_handle, dev_ino, err);
|
||||||
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
|
||||||
"HV_INTR_ENABLED): err(%d)\n",
|
|
||||||
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);
|
unsigned long cpuid, dev_handle, dev_ino;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (likely(bucket)) {
|
cpuid = irq_choose_cpu(virt_irq);
|
||||||
unsigned long cpuid, dev_handle, dev_ino;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
cpuid = irq_choose_cpu(virt_irq);
|
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
||||||
|
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
||||||
|
|
||||||
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
|
||||||
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
if (err != HV_EOK)
|
||||||
|
printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
|
||||||
err = sun4v_vintr_set_target(dev_handle, dev_ino, cpuid);
|
"err(%d)\n",
|
||||||
if (err != HV_EOK)
|
dev_handle, dev_ino, cpuid, err);
|
||||||
printk(KERN_ERR "sun4v_vintr_set_target(%lx,%lx,%lu): "
|
|
||||||
"err(%d)\n",
|
|
||||||
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);
|
unsigned long dev_handle, dev_ino;
|
||||||
|
int err;
|
||||||
|
|
||||||
if (likely(bucket)) {
|
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
||||||
unsigned long dev_handle, dev_ino;
|
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
||||||
int err;
|
|
||||||
|
|
||||||
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
err = sun4v_vintr_set_valid(dev_handle, dev_ino,
|
||||||
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
HV_INTR_DISABLED);
|
||||||
|
if (err != HV_EOK)
|
||||||
err = sun4v_vintr_set_valid(dev_handle, dev_ino,
|
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
||||||
HV_INTR_DISABLED);
|
"HV_INTR_DISABLED): err(%d)\n",
|
||||||
if (err != HV_EOK)
|
dev_handle, dev_ino, err);
|
||||||
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
|
||||||
"HV_INTR_DISABLED): err(%d)\n",
|
|
||||||
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)) {
|
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
||||||
unsigned long dev_handle, dev_ino;
|
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
||||||
int err;
|
|
||||||
|
|
||||||
dev_handle = virt_to_real_irq_table[virt_irq].dev_handle;
|
err = sun4v_vintr_set_state(dev_handle, dev_ino,
|
||||||
dev_ino = virt_to_real_irq_table[virt_irq].dev_ino;
|
HV_INTR_STATE_IDLE);
|
||||||
|
if (err != HV_EOK)
|
||||||
err = sun4v_vintr_set_state(dev_handle, dev_ino,
|
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
||||||
HV_INTR_STATE_IDLE);
|
"HV_INTR_STATE_IDLE): err(%d)\n",
|
||||||
if (err != HV_EOK)
|
dev_handle, dev_ino, err);
|
||||||
printk(KERN_ERR "sun4v_vintr_set_state(%lx,%lx,"
|
|
||||||
"HV_INTR_STATE_IDLE): err(%d)\n",
|
|
||||||
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)
|
|||||||
|
|
||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user