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

[Xen-devel] [PATCH v6 20/31] xen/arm: ITS: Introduce helper to get number of event IDs



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

gic_nr_event_ids() helper to read number of event IDs that
ITS hardware supports.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/gic-v3-its.c     |    7 +++++++
 xen/arch/arm/gic-v3.c         |    3 +++
 xen/arch/arm/gic.c            |    5 +++++
 xen/include/asm-arm/gic-its.h |    1 +
 xen/include/asm-arm/gic.h     |    4 ++++
 5 files changed, 20 insertions(+)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 77abbc6..f41ec83 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -138,6 +138,11 @@ void irqdesc_set_its_device(struct irq_desc *desc, struct 
its_device *dev)
     irq_get_msi_desc(desc)->dev = dev;
 }
 
+u32 its_get_nr_event_ids(void)
+{
+    return (1 << its_data.eventid_bits);
+}
+
 static struct its_collection *dev_event_to_col(struct its_device *dev,
                                                u32 event)
 {
@@ -861,6 +866,8 @@ int its_assign_device(struct domain *d, u32 vdevid, u32 
pdevid)
 
     for ( i = 0; i < pdev->event_map.nr_lpis; i++ )
     {
+        ASSERT(i < gic_nr_event_ids());
+
         plpi = its_get_plpi(pdev, i);
         /* TODO: Route lpi */
     }
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index bb2c531..538f9f4 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1315,7 +1315,10 @@ static int __init gicv3_init(void)
          * ITS dt node is available
          */
         if ( !its_init(&gicv3.rdist_data) )
+        {
             gicv3_info.lpi_supported = 1;
+            gicv3_info.nr_event_ids = its_get_nr_event_ids();
+        }
         else
             gicv3_info.lpi_supported = 0;
     }
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 555ad3c..2f23a14 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -81,6 +81,11 @@ bool_t gic_lpi_supported(void)
     return gic_hw_ops->info->lpi_supported;
 }
 
+unsigned int gic_nr_event_ids(void)
+{
+    return gic_hw_ops->info->nr_event_ids;
+}
+
 void gic_save_state(struct vcpu *v)
 {
     ASSERT(!local_irq_is_enabled());
diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h
index 7077477..a3d21f7 100644
--- a/xen/include/asm-arm/gic-its.h
+++ b/xen/include/asm-arm/gic-its.h
@@ -330,6 +330,7 @@ unsigned int irqdesc_get_lpi_event(struct irq_desc *desc);
 struct its_device *irqdesc_get_its_device(struct irq_desc *desc);
 void irqdesc_set_its_device(struct irq_desc *desc, struct its_device *dev);
 bool_t is_valid_collection(struct domain *d, uint32_t col);
+unsigned int its_get_nr_event_ids(void);
 int its_init(struct rdist_prop *rdists);
 int its_cpu_init(void);
 int its_add_device(u32 devid, u32 nr_ites, struct dt_device_node *dt_its);
diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h
index 15c76d0..2b26e28 100644
--- a/xen/include/asm-arm/gic.h
+++ b/xen/include/asm-arm/gic.h
@@ -283,6 +283,8 @@ extern void gic_dump_info(struct vcpu *v);
 
 /* Number of interrupt lines */
 extern unsigned int gic_number_lines(void);
+/* Number of event ids supported */
+extern unsigned int gic_nr_event_ids(void);
 /* LPI support info */
 bool_t gic_lpi_supported(void);
 
@@ -304,6 +306,8 @@ struct gic_info {
     const struct dt_device_node *node;
     /* Number of IRQ ID bits supported */
     uint32_t nr_id_bits;
+    /* Number of Event IDs supported */
+    uint32_t nr_event_ids;
     /* LPIs are support information */
     bool_t lpi_supported; 
 };
-- 
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®.