[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 8/8] arm/vgic: Change fixed number of mmio handlers to variable number
Record the number of mmio handlers that are required for vGICv3/2 in variable 'arch_domain.vgic.mmio_count' in vgic_domain_init(). Augment this variable number to a fixed number MAX_IO_HANDLER and pass it to domain_io_init() to allocate enough memory for handlers. New code path: domain_vgic_init() count = MAX_IO_HANDLER + d->arch.vgic.mmio_count; domain_io_init(count) domain_vgic_register_mmio() Signed-off-by: Shanker Donthineni <shankerd@xxxxxxxxxxxxxx> --- xen/arch/arm/domain.c | 10 ++++++---- xen/arch/arm/vgic-v2.c | 2 ++ xen/arch/arm/vgic-v3.c | 3 +++ xen/arch/arm/vgic.c | 7 +++++-- xen/include/asm-arm/domain.h | 1 + xen/include/asm-arm/vgic.h | 1 + 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 4010ff2..ef567c8 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -550,10 +550,6 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, share_xen_page_with_guest( virt_to_page(d->shared_info), d, XENSHARE_writable); - count = MAX_IO_HANDLER; - if ( (rc = domain_io_init(d, count)) != 0 ) - goto fail; - if ( (rc = p2m_alloc_table(d)) != 0 ) goto fail; @@ -593,6 +589,12 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, if ( (rc = domain_vgic_init(d, config->nr_spis)) != 0 ) goto fail; + count = MAX_IO_HANDLER + d->arch.vgic.mmio_count; + if ( (rc = domain_io_init(d, count)) != 0 ) + goto fail; + + domain_vgic_register_mmio(d); + if ( (rc = domain_vtimer_init(d, config)) != 0 ) goto fail; diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c index d42b408..7ed7d32 100644 --- a/xen/arch/arm/vgic-v2.c +++ b/xen/arch/arm/vgic-v2.c @@ -699,6 +699,8 @@ static int vgic_v2_domain_init(struct domain *d) if ( ret ) return ret; + d->arch.vgic.mmio_count = 1; /* Only GICD region */ + return 0; } diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c index 3a5aeb6..6a5f333 100644 --- a/xen/arch/arm/vgic-v3.c +++ b/xen/arch/arm/vgic-v3.c @@ -1479,6 +1479,9 @@ static int vgic_v3_domain_init(struct domain *d) d->arch.vgic.ctlr = VGICD_CTLR_DEFAULT; + /* GICD region + number of Re-distributors */ + d->arch.vgic.mmio_count = d->arch.vgic.nr_regions + 1; + return 0; } diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 5b39e0d..7d34942 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -88,6 +88,11 @@ static void vgic_rank_init(struct vgic_irq_rank *rank, uint8_t index, rank->vcpu[i] = vcpu; } +void domain_vgic_register_mmio(struct domain *d) +{ + d->arch.vgic.handler->domain_register_mmio(d); +} + int domain_vgic_init(struct domain *d, unsigned int nr_spis) { int i; @@ -151,8 +156,6 @@ int domain_vgic_init(struct domain *d, unsigned int nr_spis) for ( i = 0; i < NR_GIC_SGI; i++ ) set_bit(i, d->arch.vgic.allocated_irqs); - d->arch.vgic.handler->domain_register_mmio(d); - return 0; } diff --git a/xen/include/asm-arm/domain.h b/xen/include/asm-arm/domain.h index 9492727..974cf93 100644 --- a/xen/include/asm-arm/domain.h +++ b/xen/include/asm-arm/domain.h @@ -113,6 +113,7 @@ struct arch_domain int nr_regions; /* Number of rdist regions */ uint32_t rdist_stride; /* Re-Distributor stride */ #endif + uint32_t mmio_count; /* Number of mmio handlers */ } vgic; struct vuart { diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 8fe65b4..0032633 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -309,6 +309,7 @@ extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops); int vgic_v2_init(struct domain *d); int vgic_v3_init(struct domain *d); +extern void domain_vgic_register_mmio(struct domain *d); extern int vcpu_vgic_free(struct vcpu *v); extern int vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode, int virq, -- Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |