Received: by 10.213.65.68 with SMTP id h4csp704021imn; Fri, 6 Apr 2018 07:33:24 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/bw3AMVrdats7Q5MLzYIN9vGorCCmIM1qrudGkVZnYc+rzdhfEcMxIbkb7RJBjEU5OlVpb X-Received: by 2002:a17:902:590e:: with SMTP id o14-v6mr3622549pli.229.1523025204194; Fri, 06 Apr 2018 07:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523025204; cv=none; d=google.com; s=arc-20160816; b=fqQ4It4f65U3yuyArVOQF4tpRIHYQJ6l9gZzrewqb+aJcyVzeAeWglmwa4+xGAi4cl /S3NXwXkZy4vwSlAw1y2qaL6BwBykHFkmTFpzL4MzUKbnnFU1UqyBOqH3fMCc6KseXz2 zbhekTgdYLUjTvxlgbd9g2FLTjkzwWOIjDnpTXY+RWo4qcekREiX16tQcgdecBR3Jjul mbN3KPGbyIFI/jAs83lERiHDx2h1zD0P23S9WAfTgvrD97SadlreViWZ41cGextDcVY4 vaD9jLGniNIgkYHUG2OwI8kiCCqIXJwsVXN3XSLKGxcVK7lHpjCli1/49/wqlvxAMCcW G1VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ykIfCMUvyfXK1gfuQSMHOhvX4IYpYsI2WELUKFZKTVk=; b=NIz2zWY+jQYbsWFvgtO0rKHuY1xtcYIt1HeVCpl9I7/YhXHz5sd4Nulz69A7IFDaj/ s7T27KxpnfTehzTBRAs0hbYR8myhnAJbwpgsr7SYneD+wUe58V4Z9Tdk3U8hl7dJEZSW 4nfGABWaOGCEAl6aQq8hc88Akj+QeIWe6gXzJGvnD6RleKg+dXcd2rnPNa/dqPdUfga6 oWNCepAy6JEmrs+TkT9X6fsM8DBfB83kNFqe8SSRQ3So0iBOuw4SXVbq0mmx2dUtBi1U bxoEj9Ry8NOIKKuwUYexFkjTWTsGpjMaZWSUbTX29NtBQsr4aY9ioYPsoDhKOF8M0GOP Wc5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l62si7158199pga.740.2018.04.06.07.33.05; Fri, 06 Apr 2018 07:33:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756251AbeDFNgw (ORCPT + 99 others); Fri, 6 Apr 2018 09:36:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59882 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755920AbeDFNgt (ORCPT ); Fri, 6 Apr 2018 09:36:49 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0EB45891; Fri, 6 Apr 2018 13:36:39 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Thomas Gleixner , Daniel Lezcano , Suzuki K Poulose , Marc Zyngier , Will Deacon , Greg Hackmann , Alex Shi , Mark Rutland Subject: [PATCH 4.9 068/102] arm64: Allow checking of a CPU-local erratum Date: Fri, 6 Apr 2018 15:23:49 +0200 Message-Id: <20180406084341.058538653@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier commit 8f4137588261d7504f4aa022dc9d1a1fd1940e8e upstream. this_cpu_has_cap() only checks the feature array, and not the errata one. In order to be able to check for a CPU-local erratum, allow it to inspect the latter as well. This is consistent with cpus_have_cap()'s behaviour, which includes errata already. Acked-by: Thomas Gleixner Acked-by: Daniel Lezcano Reviewed-by: Suzuki K Poulose Signed-off-by: Marc Zyngier Signed-off-by: Alex Shi [v4.9 backport] Signed-off-by: Mark Rutland [v4.9 backport] Tested-by: Will Deacon Tested-by: Greg Hackmann Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpufeature.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1103,20 +1103,29 @@ static void __init setup_feature_capabil * Check if the current CPU has a given feature capability. * Should be called from non-preemptible context. */ -bool this_cpu_has_cap(unsigned int cap) +static bool __this_cpu_has_cap(const struct arm64_cpu_capabilities *cap_array, + unsigned int cap) { const struct arm64_cpu_capabilities *caps; if (WARN_ON(preemptible())) return false; - for (caps = arm64_features; caps->desc; caps++) + for (caps = cap_array; caps->desc; caps++) if (caps->capability == cap && caps->matches) return caps->matches(caps, SCOPE_LOCAL_CPU); return false; } +extern const struct arm64_cpu_capabilities arm64_errata[]; + +bool this_cpu_has_cap(unsigned int cap) +{ + return (__this_cpu_has_cap(arm64_features, cap) || + __this_cpu_has_cap(arm64_errata, cap)); +} + void __init setup_cpu_features(void) { u32 cwg;