[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v6 25/31] xen/arm: ITS: Allocate irq descriptors for LPIs



From: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>

Allocate dynamically irq descriptors for LPIs

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
v6: - Add separate patch for irq_pending structures
    - renamed and moved is_domain_lpi to vgic
    - Updated __irq_to_domain
---
 xen/arch/arm/gic-v3-its.c |    4 ++++
 xen/arch/arm/irq.c        |   33 ++++++++++++++++++++++++++++++++-
 xen/include/asm-arm/irq.h |    1 +
 3 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index f41ec83..d9ec044 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1435,6 +1435,10 @@ int __init its_init(struct rdist_prop *rdists)
     its_alloc_lpi_tables();
     its_lpi_init(rdists->id_bits);
 
+    /* Allocate irq descriptors for LPIs */
+    if ( init_lpi() )
+        return -ENOMEM;
+
     its = list_first_entry(&its_nodes, struct its_node, entry);
     if ( !its )
         return -ENOMEM;
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 93e9411..2a37521 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -31,6 +31,7 @@
 static unsigned int local_irqs_type[NR_LOCAL_IRQS];
 static DEFINE_SPINLOCK(local_irqs_type_lock);
 
+static irq_desc_t *irq_desc_lpi;
 /* Number of LPI supported in XEN */
 /*
  * LPI number start from 8192. Minimum number of bits
@@ -70,7 +71,15 @@ static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], 
local_irq_desc);
 irq_desc_t *__irq_to_desc(int irq)
 {
     if (irq < NR_LOCAL_IRQS) return &this_cpu(local_irq_desc)[irq];
-    return &irq_desc[irq-NR_LOCAL_IRQS];
+    else if ( gic_is_lpi(irq) )
+    {
+        ASSERT(irq_desc_lpi != NULL);
+        return &irq_desc_lpi[irq - FIRST_GIC_LPI];
+    }
+    else
+        return &irq_desc[irq - NR_LOCAL_IRQS];
+
+    return NULL;
 }
 
 int __init arch_init_one_irq_desc(struct irq_desc *desc)
@@ -120,6 +129,28 @@ static int __cpuinit init_local_irq_data(void)
     return 0;
 }
 
+int init_lpi(void)
+{
+    struct irq_desc *desc;
+    unsigned int i;
+
+    /* Allocate LPI irq descriptors */
+    irq_desc_lpi = xzalloc_array(struct irq_desc, nr_lpis);
+    if ( !irq_desc_lpi )
+        return -ENOSPC;
+
+    for ( i = 0; i < nr_lpis; i++ )
+    {
+       desc = &irq_desc_lpi[i];
+       init_one_irq_desc(desc);
+       desc->irq = FIRST_GIC_LPI + i;
+       desc->arch.type = DT_IRQ_TYPE_EDGE_BOTH;
+       desc->action = NULL;
+    }
+
+    return 0;
+}
+
 void __init init_IRQ(void)
 {
     int irq;
diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h
index ff37234..437f99b 100644
--- a/xen/include/asm-arm/irq.h
+++ b/xen/include/asm-arm/irq.h
@@ -68,6 +68,7 @@ int platform_get_irq(const struct dt_device_node *device, int 
index);
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);
 void irq_set_msi_desc(struct irq_desc *desc, struct msi_desc *msi);
 struct msi_desc *irq_get_msi_desc(struct irq_desc *desc);
+int init_lpi(void);
 
 #endif /* _ASM_HW_IRQ_H */
 /*
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.