From patchwork Wed Sep 18 13:15:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 20433 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f70.google.com (mail-vb0-f70.google.com [209.85.212.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 35EBF26114 for ; Wed, 18 Sep 2013 13:15:31 +0000 (UTC) Received: by mail-vb0-f70.google.com with SMTP id h10sf7181573vbh.5 for ; Wed, 18 Sep 2013 06:15:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=i+zP7lcIB/KufvD+fM6iXTktWV8xjafTpPbjCIHbLDY=; b=A6J7Rf6M/Jm45U74V7kerq/XiyjVin6eSIVepYGEaV++KfpROfA8wG+mV7BNBxmuoJ kun86uGh8bCF4azxqv0AGgSElenFWtbogk8mvG0lD8e8HS718q8xM1+BwaXfEPFrsQnJ PUYM+TsCVWdSVC3BiyEdbftrXxa0K4lzREWGbozXHij4PUz5RtZFtm4+gmQ5uf5FRA+D 263QPLK5nBXYj+h/g0uVMEMXYs/OlB/mE0VZbO6oKTPF0+ITBuxHo+8awRhHGQ8zfNlJ iZGsjsNDDNw/Ns4n5dkPyuwmV0unFF/44g5X1pj9mjt0PGqkVi41wDXGjq4clWqPkRQL yXdA== X-Gm-Message-State: ALoCoQmgPQQH6xvo4OBS4xTOYEA1G37OC7CsZTPc29ZOJN1WijZSdgpINpG7gY3jWRHJFBNPThxM X-Received: by 10.236.216.17 with SMTP id f17mr10183715yhp.18.1379510130764; Wed, 18 Sep 2013 06:15:30 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.53.103 with SMTP id a7ls3309025qep.90.gmail; Wed, 18 Sep 2013 06:15:30 -0700 (PDT) X-Received: by 10.58.233.173 with SMTP id tx13mr286999vec.31.1379510130687; Wed, 18 Sep 2013 06:15:30 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id ll17si519608vec.8.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 06:15:30 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id db12so5671760veb.0 for ; Wed, 18 Sep 2013 06:15:30 -0700 (PDT) X-Received: by 10.220.164.70 with SMTP id d6mr16358164vcy.19.1379510130597; Wed, 18 Sep 2013 06:15:30 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp217402vcz; Wed, 18 Sep 2013 06:15:29 -0700 (PDT) X-Received: by 10.14.204.5 with SMTP id g5mr723397eeo.110.1379510129224; Wed, 18 Sep 2013 06:15:29 -0700 (PDT) Received: from mail-ee0-f45.google.com (mail-ee0-f45.google.com [74.125.83.45]) by mx.google.com with ESMTPS id 7si1775780eeo.169.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 06:15:29 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.83.45 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=74.125.83.45; Received: by mail-ee0-f45.google.com with SMTP id c50so3454114eek.18 for ; Wed, 18 Sep 2013 06:15:28 -0700 (PDT) X-Received: by 10.14.224.66 with SMTP id w42mr1388679eep.86.1379510128273; Wed, 18 Sep 2013 06:15:28 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id n48sm2689190eeg.17.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 18 Sep 2013 06:15:27 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, Julien Grall Subject: [PATCH v3 1/6] xen/arm: use cpumask_t to describe cpu mask in gic_route_dt_irq Date: Wed, 18 Sep 2013 14:15:17 +0100 Message-Id: <1379510122-9467-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1379510122-9467-1-git-send-email-julien.grall@linaro.org> References: <1379510122-9467-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Replace by cpumask_t to take advantage of cpumask_* helpers. Signed-off-by: Julien Grall Acked-by: Ian Campbell --- Changes in v2: - Rework commit message --- xen/arch/arm/gic.c | 20 ++++++++++++-------- xen/arch/arm/time.c | 6 +++--- xen/include/asm-arm/gic.h | 3 ++- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index aff57b9..091eb36 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -184,10 +184,14 @@ static hw_irq_controller gic_guest_irq_type = { /* needs to be called with gic.lock held */ static void gic_set_irq_properties(unsigned int irq, bool_t level, - unsigned int cpu_mask, unsigned int priority) + const cpumask_t *cpu_mask, + unsigned int priority) { volatile unsigned char *bytereg; uint32_t cfg, edgebit; + unsigned int mask = cpumask_bits(cpu_mask)[0]; + + ASSERT(!(mask & ~0xff)); /* Target bitmap only support 8 CPUS */ /* Set edge / level */ cfg = GICD[GICD_ICFGR + irq / 16]; @@ -200,7 +204,7 @@ static void gic_set_irq_properties(unsigned int irq, bool_t level, /* Set target CPU mask (RAZ/WI on uniprocessor) */ bytereg = (unsigned char *) (GICD + GICD_ITARGETSR); - bytereg[irq] = cpu_mask; + bytereg[irq] = mask; /* Set priority */ bytereg = (unsigned char *) (GICD + GICD_IPRIORITYR); @@ -210,12 +214,11 @@ static void gic_set_irq_properties(unsigned int irq, bool_t level, /* Program the GIC to route an interrupt */ static int gic_route_irq(unsigned int irq, bool_t level, - unsigned int cpu_mask, unsigned int priority) + const cpumask_t *cpu_mask, unsigned int priority) { struct irq_desc *desc = irq_to_desc(irq); unsigned long flags; - ASSERT(!(cpu_mask & ~0xff)); /* Targets bitmap only supports 8 CPUs */ ASSERT(priority <= 0xff); /* Only 8 bits of priority */ ASSERT(irq < gic.lines); /* Can't route interrupts that don't exist */ @@ -242,7 +245,7 @@ static int gic_route_irq(unsigned int irq, bool_t level, } /* Program the GIC to route an interrupt with a dt_irq */ -void gic_route_dt_irq(const struct dt_irq *irq, unsigned int cpu_mask, +void gic_route_dt_irq(const struct dt_irq *irq, const cpumask_t *cpu_mask, unsigned int priority) { bool_t level; @@ -496,7 +499,7 @@ void gic_disable_cpu(void) void gic_route_ppis(void) { /* GIC maintenance */ - gic_route_dt_irq(&gic.maintenance, 1u << smp_processor_id(), 0xa0); + gic_route_dt_irq(&gic.maintenance, cpumask_of(smp_processor_id()), 0xa0); /* Route timer interrupt */ route_timer_interrupt(); } @@ -511,7 +514,7 @@ void gic_route_spis(void) if ( (irq = serial_dt_irq(seridx)) == NULL ) continue; - gic_route_dt_irq(irq, 1u << smp_processor_id(), 0xa0); + gic_route_dt_irq(irq, cpumask_of(smp_processor_id()), 0xa0); } } @@ -718,7 +721,8 @@ int gic_route_irq_to_guest(struct domain *d, const struct dt_irq *irq, level = dt_irq_is_level_triggered(irq); - gic_set_irq_properties(irq->irq, level, 1u << smp_processor_id(), 0xa0); + gic_set_irq_properties(irq->irq, level, cpumask_of(smp_processor_id()), + 0xa0); retval = __setup_irq(desc, irq->irq, action); if (retval) { diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c index eb3ad5c..a30d422 100644 --- a/xen/arch/arm/time.c +++ b/xen/arch/arm/time.c @@ -222,11 +222,11 @@ static void vtimer_interrupt(int irq, void *dev_id, struct cpu_user_regs *regs) void __cpuinit route_timer_interrupt(void) { gic_route_dt_irq(&timer_irq[TIMER_PHYS_NONSECURE_PPI], - 1u << smp_processor_id(), 0xa0); + cpumask_of(smp_processor_id()), 0xa0); gic_route_dt_irq(&timer_irq[TIMER_HYP_PPI], - 1u << smp_processor_id(), 0xa0); + cpumask_of(smp_processor_id()), 0xa0); gic_route_dt_irq(&timer_irq[TIMER_VIRT_PPI], - 1u << smp_processor_id(), 0xa0); + cpumask_of(smp_processor_id()), 0xa0); } /* Set up the timer interrupt on this CPU */ diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index 92a3349..3a5ef6f 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -147,7 +147,8 @@ extern void vgic_clear_pending_irqs(struct vcpu *v); extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq); /* Program the GIC to route an interrupt with a dt_irq */ -extern void gic_route_dt_irq(const struct dt_irq *irq, unsigned int cpu_mask, +extern void gic_route_dt_irq(const struct dt_irq *irq, + const cpumask_t *cpu_mask, unsigned int priority); extern void gic_route_ppis(void); extern void gic_route_spis(void);