From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xenproject.org
Cc: stefano.stabellini@citrix.com,
Julien Grall <julien.grall@linaro.org>,
tim@xen.org, ian.campbell@citrix.com
Subject: [PATCH v7 3/6] xen/arm: Replace route_guest_dt_irq by route_guest_irq
Date: Fri, 16 May 2014 15:40:29 +0100 [thread overview]
Message-ID: <1400251232-7695-4-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1400251232-7695-1-git-send-email-julien.grall@linaro.org>
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>
---
Changes in v7:
- irq_set_type has been renamed into irq_set_spi_type
Changes in v6:
- Patch added
---
xen/arch/arm/domain_build.c | 16 +++++++++-------
xen/arch/arm/irq.c | 12 +++++-------
xen/arch/arm/platforms/xgene-storm.c | 15 ++++++++++-----
xen/include/asm-arm/irq.h | 4 ++--
4 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index c424793..ddbb88d 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -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;
}
}
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 0808e36..fa35e0d 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -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);
diff --git a/xen/arch/arm/platforms/xgene-storm.c b/xen/arch/arm/platforms/xgene-storm.c
index 70aab73..c9dd63c 100644
--- a/xen/arch/arm/platforms/xgene-storm.c
+++ b/xen/arch/arm/platforms/xgene-storm.c
@@ -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);
diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index bb55390..e567f71 100644
--- a/xen/include/asm-arm/irq.h
+++ b/xen/include/asm-arm/irq.h
@@ -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);
--
1.7.10.4
next prev parent reply other threads:[~2014-05-16 14:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 14:40 [PATCH v7 0/6] xen/arm: Interrupt management reworking Julien Grall
2014-05-16 14:40 ` [PATCH v7 1/6] xen/arm: IRQ: Store IRQ type in arch_irq_desc Julien Grall
2014-05-21 12:27 ` Ian Campbell
2014-05-16 14:40 ` [PATCH v7 2/6] xen/arm: IRQ: Replace {request, setup}_dt_irq by {request, setup}_irq Julien Grall
2014-05-16 14:40 ` Julien Grall [this message]
2014-05-16 14:40 ` [PATCH v7 4/6] xen: IRQ: Add dev_id parameter to release_irq Julien Grall
2014-05-16 14:40 ` [PATCH v7 5/6] xen/arm: IRQ: extend {request, setup}_irq to take an irqflags in parameter Julien Grall
2014-05-16 14:40 ` [PATCH v7 6/6] xen/arm: IRQ: Handle multiple action per IRQ Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400251232-7695-4-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=ian.campbell@citrix.com \
--cc=stefano.stabellini@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).