From patchwork Fri Aug 14 13:18:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Richter X-Patchwork-Id: 7014941 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B162DC05AC for ; Fri, 14 Aug 2015 13:21:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C58F92035E for ; Fri, 14 Aug 2015 13:21:54 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DFF77207DC for ; Fri, 14 Aug 2015 13:21:53 +0000 (UTC) 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 1ZQEtm-0001oW-B2; Fri, 14 Aug 2015 13:19:54 +0000 Received: from casper.infradead.org ([2001:770:15f::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZQEtM-0001cy-9s for linux-arm-kernel@bombadil.infradead.org; Fri, 14 Aug 2015 13:19:28 +0000 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZQEtI-0000Mx-Tb for linux-arm-kernel@lists.infradead.org; Fri, 14 Aug 2015 13:19:26 +0000 Received: by wijp15 with SMTP id p15so19182725wij.0 for ; Fri, 14 Aug 2015 06:19:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=fxg0bjQ1/PVh+lIsJF3ZOQouSJOz1thpR/u084XKo/I=; b=RgVkDwWny5Pn44yAknadxN3gsc1H2v1meNOLe90O/NIRqZ3rRx+HZZEJDs7yxLO3Hz wU8Fi4u877OamasYA0mrt/8PLb+h17KjL8qP6ClXzXGIdTMo2PQC6JAI8u7R7yPyuSZD Zs3h4OXyxk8QOnVdSUlihSVSTBNLWd8mYCSi+1zTYYMpbgqEOWcVaCu9c9HRFo397Q7k 6kTzlhss1JjsQ9YxpwRI6g06RubJ1UBwtFEYvEpR7GPDXm9ka6TXWvElVsSNSGOYdFks 2uoGghD6txlBSE0BYLxupQPDQ2HdA+GpAtJGcPv79iPBkoKsm6d1+7l9EWlQp/15N//9 Obiw== X-Received: by 10.180.83.137 with SMTP id q9mr7233069wiy.68.1439558343051; Fri, 14 Aug 2015 06:19:03 -0700 (PDT) Received: from rric.localdomain (x5ce0c315.dyn.telefonica.de. [92.224.195.21]) by smtp.gmail.com with ESMTPSA id lg8sm3072041wic.12.2015.08.14.06.19.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Aug 2015 06:19:02 -0700 (PDT) From: Robert Richter To: Marc Zygnier , Thomas Gleixner , Jason Cooper , Catalin Marinas , Will Deacon Subject: [PATCH v3 6/6] arm64: errata: Match all cpus if capability value is zero Date: Fri, 14 Aug 2015 15:18:40 +0200 Message-Id: <1439558320-5777-7-git-send-email-rric@kernel.org> X-Mailer: git-send-email 2.1.1 In-Reply-To: <1439558320-5777-1-git-send-email-rric@kernel.org> References: <1439558320-5777-1-git-send-email-rric@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150814_141925_000832_7B76E28E X-CRM114-Status: GOOD ( 17.07 ) X-Spam-Score: -2.4 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robert Richter , Tirumalesh Chalamarla , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Robert Richter This patch make caps usable optionally. If its value is zero, then all cpus are matched. E.g. if caps resides in a stuct for marking it dependend on a certain cpu feature/errata, then an empty value will indicate not to use caps detection. An empty value will match all cpus and thus just skip the cpu feature test. Signed-off-by: Robert Richter --- arch/arm64/include/asm/cpufeature.h | 17 +++++++++++------ drivers/irqchip/irq-gic-common.c | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 2a5e4c163ee5..a5f8a007d982 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -21,13 +21,15 @@ #define MAX_CPU_FEATURES (8 * sizeof(elf_hwcap)) #define cpu_feature(x) ilog2(HWCAP_ ## x) -#define ARM64_WORKAROUND_CLEAN_CACHE 0 -#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 1 -#define ARM64_WORKAROUND_845719 2 -#define ARM64_HAS_SYSREG_GIC_CPUIF 3 -#define ARM64_WORKAROUND_CAVIUM_23154 4 +/* reserve zero to match all cpus for use of caps in empty structs */ +#define ARM64_ALL_CPUS 0 +#define ARM64_WORKAROUND_CLEAN_CACHE 1 +#define ARM64_WORKAROUND_DEVICE_LOAD_ACQUIRE 2 +#define ARM64_WORKAROUND_845719 3 +#define ARM64_HAS_SYSREG_GIC_CPUIF 4 +#define ARM64_WORKAROUND_CAVIUM_23154 5 -#define ARM64_NCAPS 5 +#define ARM64_NCAPS 6 #ifndef __ASSEMBLY__ @@ -57,6 +59,9 @@ static inline bool cpu_have_feature(unsigned int num) static inline bool cpus_have_cap(unsigned int num) { + /* zero matches for all cpus */ + if (!num) + return true; if (num >= ARM64_NCAPS) return false; return test_bit(num, cpu_hwcaps); diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c index f5e901a62ea5..cb55aaf960bb 100644 --- a/drivers/irqchip/irq-gic-common.c +++ b/drivers/irqchip/irq-gic-common.c @@ -25,7 +25,7 @@ void gic_check_capabilities(u32 iidr, const struct gic_capabilities *cap, void *data) { for (; cap->desc; cap++) { - if (cap->cpu_cap && !cpus_have_cap(cap->cpu_cap)) + if (!cpus_have_cap(cap->cpu_cap)) continue; if (cap->iidr != (cap->mask & iidr)) continue;