From mboxrd@z Thu Jan 1 00:00:00 1970 From: vijay.kilari@gmail.com Subject: [PATCH v3 06/16] xen/arm: move gic lock out of gic data structure Date: Tue, 15 Apr 2014 16:47:45 +0530 Message-ID: <1397560675-29861-7-git-send-email-vijay.kilari@gmail.com> References: <1397560675-29861-1-git-send-email-vijay.kilari@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1397560675-29861-1-git-send-email-vijay.kilari@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian.Campbell@citrix.com, julien.grall@linaro.org, stefano.stabellini@eu.citrix.com, stefano.stabellini@citrix.com, xen-devel@lists.xen.org Cc: Prasun.Kapoor@caviumnetworks.com, Vijaya Kumar K , vijay.kilari@gmail.com List-Id: xen-devel@lists.xenproject.org From: Vijaya Kumar K spinlock is used across generic and GIC low level functions. Move this lock out of gic data. This helps to separate generic and low level functions later. Signed-off-by: Vijaya Kumar K --- xen/arch/arm/gic.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 05f2240..7c9a408 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -35,6 +35,8 @@ #include #include +static spinlock_t gic_lock; + /* Access to the GIC Distributor registers through the fixmap */ #define GICD ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICD)) #define GICC ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_GICC1)) @@ -50,7 +52,6 @@ static struct { unsigned int lines; /* Number of interrupts (SPIs + PPIs + SGIs) */ struct dt_irq maintenance; /* IRQ maintenance */ unsigned int cpus; - spinlock_t lock; } gic; static irq_desc_t irq_desc[NR_IRQS]; @@ -142,12 +143,12 @@ static void gic_irq_enable(struct irq_desc *desc) unsigned long flags; spin_lock_irqsave(&desc->lock, flags); - spin_lock(&gic.lock); + spin_lock(&gic_lock); desc->status &= ~IRQ_DISABLED; dsb(); /* Enable routing */ GICD[GICD_ISENABLER + irq / 32] = (1u << (irq % 32)); - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); spin_unlock_irqrestore(&desc->lock, flags); } @@ -157,11 +158,11 @@ static void gic_irq_disable(struct irq_desc *desc) unsigned long flags; spin_lock_irqsave(&desc->lock, flags); - spin_lock(&gic.lock); + spin_lock(&gic_lock); /* Disable routing */ GICD[GICD_ICENABLER + irq / 32] = (1u << (irq % 32)); desc->status |= IRQ_DISABLED; - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); spin_unlock_irqrestore(&desc->lock, flags); } @@ -226,7 +227,7 @@ static hw_irq_controller gic_guest_irq_type = { }; /* - * - needs to be called with gic.lock held + * - needs to be called with gic_lock held * - needs to be called with a valid cpu_mask, ie each cpu in the mask has * already called gic_cpu_init */ @@ -277,9 +278,9 @@ static int gic_route_irq(unsigned int irq, bool_t level, desc->handler = &gic_host_irq_type; - spin_lock(&gic.lock); + spin_lock(&gic_lock); gic_set_irq_properties(irq, level, cpu_mask, priority); - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); spin_unlock_irqrestore(&desc->lock, flags); return 0; @@ -471,14 +472,14 @@ void __init gic_init(void) set_fixmap(FIXMAP_GICH, gic.hbase >> PAGE_SHIFT, DEV_SHARED); /* Global settings: interrupt distributor */ - spin_lock_init(&gic.lock); - spin_lock(&gic.lock); + spin_lock_init(&gic_lock); + spin_lock(&gic_lock); gic_dist_init(); gic_cpu_init(); gic_hyp_init(); - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); } void send_sgi(const cpumask_t *online_mask, enum gic_sgi sgi, uint8_t irqmode) @@ -550,10 +551,10 @@ void smp_send_state_dump(unsigned int cpu) /* Set up the per-CPU parts of the GIC for a secondary CPU */ void __cpuinit gic_init_secondary_cpu(void) { - spin_lock(&gic.lock); + spin_lock(&gic_lock); gic_cpu_init(); gic_hyp_init(); - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); } /* Shut down the per-CPU GIC interface */ @@ -561,10 +562,10 @@ void gic_disable_cpu(void) { ASSERT(!local_irq_is_enabled()); - spin_lock(&gic.lock); + spin_lock(&gic_lock); gic_cpu_disable(); gic_hyp_disable(); - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); } void gic_route_ppis(void) @@ -911,7 +912,7 @@ int gic_route_irq_to_guest(struct domain *d, const struct dt_irq *irq, action->free_on_release = 1; spin_lock_irqsave(&desc->lock, flags); - spin_lock(&gic.lock); + spin_lock(&gic_lock); desc->handler = &gic_guest_irq_type; desc->status |= IRQ_GUEST; @@ -932,7 +933,7 @@ int gic_route_irq_to_guest(struct domain *d, const struct dt_irq *irq, p->desc = desc; out: - spin_unlock(&gic.lock); + spin_unlock(&gic_lock); spin_unlock_irqrestore(&desc->lock, flags); return retval; } -- 1.7.9.5