From patchwork Wed Mar 18 18:04:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Pitre X-Patchwork-Id: 45987 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 37C342153C for ; Wed, 18 Mar 2015 18:08:00 +0000 (UTC) Received: by lbdu10 with SMTP id u10sf4328563lbd.3 for ; Wed, 18 Mar 2015 11:07:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=/qkvYMuY2fTV0Su41VCame0XsK7QSLx0voe8U6EAbXs=; b=eReAt+uHPZBGqJ1PsDLrfZC4ekKCzi1j3bBRG68/drnrmChERe/JJOCHdEalXR1vmq sIjUoDSP+DssxljyBwY474dA6JU/gBbcsG+qGRbEZGk2YS2euwx1HkM+dMWhcu0EKlHp DPJ+f5aA/k2V7lY6DvzhSgXC8V9LcHxaKvBy5e0XWPsK0EipI02XoMzyT57OOYlzdHqS kKZ70ayu/Q9k90IFKqRsIUomP/oJqLV6wG4UfACUS/pQi+jVs4C0Iui/b7EY8nMfS/CS 5IIo5uNr+bBwhhejnjkQwE3vMXEhR5+mtnFgppWNLitVb2/aMz6dvLBM6JI96fs6gds1 Srfw== X-Gm-Message-State: ALoCoQkwTrZFO66WbnhMojmgvzybIiNDWFQdralwY3rPYWWpdy8VSdbDQoE2aOqJi1KCe1em7jWv X-Received: by 10.112.198.34 with SMTP id iz2mr11316685lbc.22.1426702078635; Wed, 18 Mar 2015 11:07:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.102 with SMTP id q6ls199473laa.24.gmail; Wed, 18 Mar 2015 11:07:58 -0700 (PDT) X-Received: by 10.152.43.51 with SMTP id t19mr64570124lal.73.1426702078395; Wed, 18 Mar 2015 11:07:58 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPS id p8si13445913laf.145.2015.03.18.11.07.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 11:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by lbcgn8 with SMTP id gn8so35760664lbc.2 for ; Wed, 18 Mar 2015 11:07:58 -0700 (PDT) X-Received: by 10.112.130.100 with SMTP id od4mr42778322lbb.86.1426702078190; Wed, 18 Mar 2015 11:07:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp1318998lbj; Wed, 18 Mar 2015 11:07:57 -0700 (PDT) X-Received: by 10.70.53.137 with SMTP id b9mr167221787pdp.69.1426702076454; Wed, 18 Mar 2015 11:07:56 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id hm17si37512731pad.46.2015.03.18.11.07.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 11:07:56 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYILc-0003rS-JH; Wed, 18 Mar 2015 18:05:40 +0000 Received: from relais.videotron.ca ([24.201.245.36]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYILW-0003lU-RS for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 18:05:37 +0000 Received: from yoda.home ([66.131.180.142]) by VL-VM-MR002.ip.videotron.ca (Oracle Communications Messaging Exchange Server 7u4-22.01 64bit (built Apr 21 2011)) with ESMTP id <0NLF00GTA68I7920@VL-VM-MR002.ip.videotron.ca> for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 14:05:06 -0400 (EDT) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTP id 9DEDF2DA0603; Wed, 18 Mar 2015 14:05:06 -0400 (EDT) From: Nicolas Pitre To: linux-arm-kernel@lists.infradead.org Subject: [PATCH RFC/RFT 3/6] ARM: vexpress: DCSCB: tighten CPU validity assertion Date: Wed, 18 Mar 2015 14:04:50 -0400 Message-id: <1426701893-25589-4-git-send-email-nicolas.pitre@linaro.org> X-Mailer: git-send-email 2.1.0 In-reply-to: <1426701893-25589-1-git-send-email-nicolas.pitre@linaro.org> References: <1426701893-25589-1-git-send-email-nicolas.pitre@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150318_110534_963384_A1714314 X-CRM114-Status: GOOD ( 13.09 ) X-Spam-Score: 1.0 (+) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (1.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [24.201.245.36 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [24.201.245.36 listed in wl.mailspike.net] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Kevin Hilman , arm@kernel.org, Haojian Zhuang , Abhilash Kesavan , Dave Martin , linaro-kernel@lists.linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: nicolas.pitre@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Currently the cpu argument validity check uses a hardcoded limit of 4. The DCSCB configuration data provides the actual number of CPUs and we already use it elsewhere. Let's improve the cpu argument validity check by using that information instead. Signed-off-by: Nicolas Pitre --- arch/arm/mach-vexpress/dcscb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-vexpress/dcscb.c b/arch/arm/mach-vexpress/dcscb.c index 30b993399e..12c74734cd 100644 --- a/arch/arm/mach-vexpress/dcscb.c +++ b/arch/arm/mach-vexpress/dcscb.c @@ -54,7 +54,7 @@ static int dcscb_power_up(unsigned int cpu, unsigned int cluster) unsigned int all_mask; pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - if (cpu >= 4 || cluster >= 2) + if (cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster])) return -EINVAL; all_mask = dcscb_allcpus_mask[cluster]; @@ -105,7 +105,7 @@ static void dcscb_power_down(void) cpumask = (1 << cpu); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cpu >= 4 || cluster >= 2); + BUG_ON(cluster >= 2 || !(cpumask & dcscb_allcpus_mask[cluster])); all_mask = dcscb_allcpus_mask[cluster]; @@ -189,7 +189,7 @@ static void __init dcscb_usage_count_init(void) cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); - BUG_ON(cpu >= 4 || cluster >= 2); + BUG_ON(cluster >= 2 || !((1 << cpu) & dcscb_allcpus_mask[cluster])); dcscb_use_count[cpu][cluster] = 1; }