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

[Xen-devel] [PATCH v6 22/31] xen/arm: ITS: Add virtual ITS availability check helper



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

Introduce vgic_is_lpi_supported() helper function
to know virtual ITS availability for a domain

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/vgic-v2.c     |    5 +++++
 xen/arch/arm/vgic-v3.c     |    6 ++++++
 xen/arch/arm/vgic.c        |    5 +++++
 xen/include/asm-arm/vgic.h |    7 +++++++
 4 files changed, 23 insertions(+)

diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index 600d27e..15ec809 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -32,6 +32,8 @@
 #include <asm/platform.h>
 #include <asm/vgic.h>
 
+static struct vgic_info vgic_v2_info;
+
 static struct {
     bool_t enabled;
     /* Distributor interface address */
@@ -594,10 +596,13 @@ static int vgic_v2_domain_init(struct domain *d)
     register_mmio_handler(d, &vgic_v2_distr_mmio_handler, d->arch.vgic.dbase,
                           PAGE_SIZE);
 
+    vgic_v2_info.its_enabled = 0;
+
     return 0;
 }
 
 static const struct vgic_ops vgic_v2_ops = {
+    .info = &vgic_v2_info,
     .vcpu_init   = vgic_v2_vcpu_init,
     .domain_init = vgic_v2_domain_init,
     .get_irq_priority = vgic_v2_get_irq_priority,
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 863648c..771bfd1 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -49,6 +49,8 @@
  */
 #define VGICD_CTLR_DEFAULT  (GICD_CTLR_ARE_NS)
 
+static struct vgic_info vgic_v3_info;
+
 static struct {
     bool_t enabled;
     /* Distributor interface address */
@@ -1247,10 +1249,14 @@ static int vgic_v3_domain_init(struct domain *d)
 
     d->arch.vgic.ctlr = VGICD_CTLR_DEFAULT;
 
+    if ( is_hardware_domain(d) && gic_lpi_supported() )
+        vgic_v3_info.its_enabled = 1;
+
     return 0;
 }
 
 static const struct vgic_ops v3_ops = {
+    .info = &vgic_v3_info,
     .vcpu_init   = vgic_v3_vcpu_init,
     .domain_init = vgic_v3_domain_init,
     .get_irq_priority = vgic_v3_get_irq_priority,
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 6b6bbce..d5e9251 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -61,6 +61,11 @@ struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned 
int irq)
     return vgic_get_rank(v, rank);
 }
 
+bool_t vgic_is_lpi_supported(struct domain *d)
+{
+    return d->arch.vgic.handler->info->its_enabled;
+}
+
 static void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq)
 {
     INIT_LIST_HEAD(&p->inflight);
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index 659d919..1c88300 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -110,7 +110,13 @@ static inline void sgi_target_init(struct sgi_target 
*sgi_target)
     sgi_target->list = 0;
 }
 
+struct vgic_info {
+    bool_t its_enabled;
+};
+
 struct vgic_ops {
+    /* Hold vGIC information */
+    const struct vgic_info *info;
     /* Initialize vGIC */
     int (*vcpu_init)(struct vcpu *v);
     /* Domain specific initialization of vGIC */
@@ -309,6 +315,7 @@ enum gic_sgi_mode;
 
 #define vgic_num_line_irqs(d)        ((d)->arch.vgic.nr_spis + 32)
 
+extern bool_t vgic_is_lpi_supported(struct domain *d);
 extern int domain_vgic_init(struct domain *d, unsigned int nr_spis);
 extern void domain_vgic_free(struct domain *d);
 extern int vcpu_vgic_init(struct vcpu *v);
-- 
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®.