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

[Xen-devel] [RFC PATCH v3 15/18] xen/arm: ITS: Add domain specific ITS initialization



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

Add Domain and vcpu specific ITS initialization

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@xxxxxxxxxxxxxxxxxx>
---
 xen/arch/arm/gic-v3-its.c     |   17 ++++++++++++++++
 xen/arch/arm/setup.c          |    1 +
 xen/arch/arm/vgic-v3-its.c    |   45 +++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/vgic-v3.c        |    1 +
 xen/include/asm-arm/gic-its.h |    3 +++
 xen/include/asm-arm/vgic.h    |    1 +
 6 files changed, 68 insertions(+)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 4471669..8aa1ec5 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1234,6 +1234,23 @@ static int its_force_quiescent(void __iomem *base)
     }
 }
 
+void its_domain_init(struct domain *d)
+{
+    struct its_node *its;
+
+    if ( is_hardware_domain(d) )
+    {
+        list_for_each_entry(its, &its_nodes, entry)
+        {
+            /* XXX: Assign only first physical ITS address */
+            d->arch.vits->phys_base = its->phys_base;
+            d->arch.vits->phys_size = its->phys_size;
+            break;
+        }
+    }
+    /* TODO: DomU */
+}
+
 static int its_probe(struct dt_device_node *node)
 {
     paddr_t its_addr, its_size;
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 06f8e54..0c1081a 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -776,6 +776,7 @@ void __init start_xen(unsigned long boot_phys_offset,
     init_xen_time();
 
     gic_init();
+    vgic_its_init();
 
     p2m_vmid_allocator_init();
 
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 543db91..00e210f 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1174,6 +1174,51 @@ static const struct mmio_handler_ops 
vgic_gits_mmio_handler = {
     .write_handler = vgic_v3_gits_mmio_write,
 };
 
+int vgic_its_domain_init(struct domain *d)
+{
+    int i;
+
+    d->arch.vits = xzalloc(struct vgic_its);
+    if ( !d->arch.vits )
+        return -ENOMEM;
+
+    spin_lock_init(&d->arch.vits->lock);
+
+    d->arch.vits->collections = xzalloc_array(struct its_collection,
+                                              nr_cpu_ids);
+    if ( !d->arch.vits->collections )
+        return -ENOMEM;
+
+    for ( i = 0; i < nr_cpu_ids; i++ )
+        d->arch.vits->collections[i].target_address = ~0UL;
+
+    for ( i = 0; i < GITS_BASER_NR_REGS; i++)
+    {
+        /* XXX: Fix this */
+        if ( i == 0 )
+            d->arch.vits->baser[i] = 0x107000000000c00;
+        else
+            d->arch.vits->baser[i] = 0x0;
+    }
+
+    d->arch.vits->dev_root = RB_ROOT;
+
+    spin_lock_init(&d->arch.vits[i].lock);
+
+    its_domain_init(d);
+    register_mmio_handler(d, &vgic_gits_mmio_handler,
+                          d->arch.vits->phys_base,
+                          SZ_64K);
+
+    return 0;
+}
+
+void vgic_its_init(void)
+{
+    if ( gic_lpi_supported() )
+        its_lpi_init(gic_nr_id_bits());
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 44922fb..abb1457 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1186,6 +1186,7 @@ static int vgic_v3_domain_init(struct domain *d)
 
     d->arch.vgic.ctlr = VGICD_CTLR_DEFAULT;
 
+    vgic_its_domain_init(d);
     return 0;
 }
 
diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h
index c674b3f..7e25f5b 100644
--- a/xen/include/asm-arm/gic-its.h
+++ b/xen/include/asm-arm/gic-its.h
@@ -276,6 +276,9 @@ static inline uint32_t its_decode_devid(struct domain *d, 
its_cmd_block *cmd)
 
 int its_cpu_init(void);
 int its_init(struct rdist_prop *rdist);
+void its_domain_init(struct domain *d);
+int its_lpi_init(u32 id_bits);
+int vgic_its_domain_init(struct domain *d);
 void its_set_affinity(struct irq_desc *desc, int cpu);
 void lpi_set_config(struct irq_desc *desc, int enable);
 uint8_t vgic_its_get_priority(struct vcpu *v, uint32_t pid);
diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
index f8928ab..4509e9a 100644
--- a/xen/include/asm-arm/vgic.h
+++ b/xen/include/asm-arm/vgic.h
@@ -178,6 +178,7 @@ enum gic_sgi_mode;
 #define vgic_num_irqs(d)        ((d)->arch.vgic.nr_spis + 32)
 
 extern int domain_vgic_init(struct domain *d, unsigned int nr_spis);
+extern void vgic_its_init(void);
 extern void domain_vgic_free(struct domain *d);
 extern int vcpu_vgic_init(struct vcpu *v);
 extern struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq);
-- 
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®.