mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
xen/arm: Replace route_guest_dt_irq by route_guest_irq
We can use platform_get_irq to get the IRQ which will be route to the guest. platform_get_irq will store the type of IRQ (e.g level/edge...) directly in the irq_desc. This will avoid to have device tree specific routing function. Signed-off-by: Julien Grall <julien.grall@linaro.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
1 parent
554cbe3238
commit
ebb398b771
4 files changed
+26
-21
No files matched your search
@@ -686,7 +686,7 @@ static int map_device(struct domain *d, struct dt_device_node *dev)
|
||||
unsigned int naddr;
|
||||
unsigned int i;
|
||||
int res;
|
||||
struct dt_irq irq;
|
||||
unsigned int irq;
|
||||
struct dt_raw_irq rirq;
|
||||
u64 addr, size;
|
||||
|
||||
@@ -729,20 +729,22 @@ static int map_device(struct domain *d, struct dt_device_node *dev)
|
||||
continue;
|
||||
}
|
||||
|
||||
res = dt_irq_translate(&rirq, &irq);
|
||||
if ( res )
|
||||
res = platform_get_irq(dev, i);
|
||||
if ( res < 0 )
|
||||
{
|
||||
printk(XENLOG_ERR "Unable to translate irq %u for %s\n",
|
||||
printk(XENLOG_ERR "Unable to get irq %u for %s\n",
|
||||
i, dt_node_full_name(dev));
|
||||
return res;
|
||||
}
|
||||
|
||||
DPRINT("irq %u = %u type = 0x%x\n", i, irq.irq, irq.type);
|
||||
res = route_dt_irq_to_guest(d, &irq, dt_node_name(dev));
|
||||
irq = res;
|
||||
|
||||
DPRINT("irq %u = %u\n", i, irq);
|
||||
res = route_irq_to_guest(d, irq, dt_node_name(dev));
|
||||
if ( res )
|
||||
{
|
||||
printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n",
|
||||
irq.irq, d->domain_id);
|
||||
irq, d->domain_id);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
+5
-7
@@ -316,11 +316,11 @@ err:
|
||||
return rc;
|
||||
}
|
||||
|
||||
int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq,
|
||||
const char * devname)
|
||||
int route_irq_to_guest(struct domain *d, unsigned int irq,
|
||||
const char * devname)
|
||||
{
|
||||
struct irqaction *action;
|
||||
struct irq_desc *desc = irq_to_desc(irq->irq);
|
||||
struct irq_desc *desc = irq_to_desc(irq);
|
||||
unsigned long flags;
|
||||
int retval = 0;
|
||||
|
||||
@@ -348,10 +348,9 @@ int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq,
|
||||
|
||||
if ( desc->status & IRQ_GUEST )
|
||||
printk(XENLOG_ERR "ERROR: IRQ %u is already used by domain %u\n",
|
||||
irq->irq, ad->domain_id);
|
||||
irq, ad->domain_id);
|
||||
else
|
||||
printk(XENLOG_ERR "ERROR: IRQ %u is already used by Xen\n",
|
||||
irq->irq);
|
||||
printk(XENLOG_ERR "ERROR: IRQ %u is already used by Xen\n", irq);
|
||||
retval = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
@@ -360,7 +359,6 @@ int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq,
|
||||
if ( retval )
|
||||
goto out;
|
||||
|
||||
desc->arch.type = irq->type;
|
||||
gic_route_irq_to_guest(d, desc, cpumask_of(smp_processor_id()),
|
||||
GIC_PRI_IRQ);
|
||||
spin_unlock_irqrestore(&desc->lock, flags);
|
||||
|
||||
@@ -57,16 +57,21 @@ static int map_one_mmio(struct domain *d, const char *what,
|
||||
static int map_one_spi(struct domain *d, const char *what,
|
||||
unsigned int spi, unsigned int type)
|
||||
{
|
||||
struct dt_irq irq;
|
||||
unsigned int irq;
|
||||
int ret;
|
||||
|
||||
irq.type = type;
|
||||
irq = spi + 32; /* SPIs start at IRQ 32 */
|
||||
|
||||
irq.irq = spi + 32; /* SPIs start at IRQ 32 */
|
||||
ret = irq_set_spi_type(irq, type);
|
||||
if ( ret )
|
||||
{
|
||||
printk("Failed to set the type for IRQ%u\n", irq);
|
||||
return ret;
|
||||
}
|
||||
|
||||
printk("Additional IRQ %u (%s)\n", irq.irq, what);
|
||||
printk("Additional IRQ %u (%s)\n", irq, what);
|
||||
|
||||
ret = route_dt_irq_to_guest(d, &irq, what);
|
||||
ret = route_irq_to_guest(d, irq, what);
|
||||
if ( ret )
|
||||
printk("Failed to route %s to dom%d\n", what, d->domain_id);
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ void do_IRQ(struct cpu_user_regs *regs, unsigned int irq, int is_fiq);
|
||||
void init_IRQ(void);
|
||||
void init_secondary_IRQ(void);
|
||||
|
||||
int route_dt_irq_to_guest(struct domain *d, const struct dt_irq *irq,
|
||||
const char *devname);
|
||||
int route_irq_to_guest(struct domain *d, unsigned int irq,
|
||||
const char *devname);
|
||||
|
||||
/* Set IRQ type for an SPI */
|
||||
int irq_set_spi_type(unsigned int spi, unsigned int type);
|
||||
|
||||