Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1981892pxx; Sat, 31 Oct 2020 04:46:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAoSN0p2e8gDyLPStkUivrDfY2Jii+PHzMXawA032oEUDYdjSXOaqSdI/ZtMXTHqfSEuXe X-Received: by 2002:a17:906:831a:: with SMTP id j26mr6951191ejx.450.1604144761147; Sat, 31 Oct 2020 04:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604144761; cv=none; d=google.com; s=arc-20160816; b=dz6qeEt2wttTiwd6n+rP7bZ70VpNt0WromFKhxz1uFVSbHQQ65RZgDCc4egNmYQMbE Yz+G2vtGwcF3lObjYwL0w2DZDnYdTvyWOjS/ROI9DORTJxMgYbNwtgKRowYlvVrtngz/ WbUeWe9V3TreIiPacyCgsR4rXIFdYF5YDmVQv9mv1ngpZu31S0MXAP4CAac2wc1Cmno4 iPm3Jljxo7FT77hMIUsPwOcrbjo+TdIvmQlPIR1ivd5gE+4J9cOiFOeg04iEQhuvaZtO bRZOfnfhBN+t7nhvG4MB1UyCZU1HtU3VqjGwUQ77rxw5NiWPU7dczUMG9zMcTVyg9s8e 3ORw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=V2Ml5BxpS2knGet2Kn4Ks5I0u3k3MK75HVATW9Nyycc=; b=IDZyrovPG01pVLSQNaBsAYcbS5+Bi161ITBJCs8HIRYJzxmu9l05Ln9vf05IfjYDzc /lzwL3rXzvclmoAHnG+bA06gf6dlvFNBBccozUvOdAblPXt03uuWUBoOPRpGUsc760z+ j2PrvGHvyfqoOc6VtAMjq/3JkelwRrnAEudxFOFkGaPL1Ch3NGer8B4kXukhiVp3eP5W FYyW3RDXKu1rglJllUu7p009qj+TaGkMG9WQ1y8bzFssUF8bNHs3SU8Ws0GG1//Q8ven SFW9hyIo6SMRnTZxq1OL26oWwB12qXfoSyOx3u84G4CaCFyL1avj3YT+hjrWbIu9Q2os ImfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PITULxK6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b6si7398715ejb.204.2020.10.31.04.45.38; Sat, 31 Oct 2020 04:46:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PITULxK6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727684AbgJaLlc (ORCPT + 99 others); Sat, 31 Oct 2020 07:41:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:40596 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727689AbgJaLl3 (ORCPT ); Sat, 31 Oct 2020 07:41:29 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B8C8A20731; Sat, 31 Oct 2020 11:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604144489; bh=+d/sucMsUapMozPmJw7Ff+qM2F0/qiUU8RKwYMKg6O0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PITULxK6RVht7/gLuImLXVdEcvh4z2+My1W3ElU6ofa8z7xjiFVTg17rMT/2LWi0E GphhDLnmQv5ehh4F98J7mj7nDi05Ck11D/govcVOlnG4IjnXqpo8mOhyuq7L6i1wyD 5mXJQwAiN9d+5G9/kLKHC4o86H9yIk3X38tMZxpU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suzuki K Poulose , Marc Zyngier , Will Deacon Subject: [PATCH 5.8 20/70] arm64: Run ARCH_WORKAROUND_1 enabling code on all CPUs Date: Sat, 31 Oct 2020 12:35:52 +0100 Message-Id: <20201031113500.477897266@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201031113459.481803250@linuxfoundation.org> References: <20201031113459.481803250@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Marc Zyngier commit 18fce56134c987e5b4eceddafdbe4b00c07e2ae1 upstream. Commit 73f381660959 ("arm64: Advertise mitigation of Spectre-v2, or lack thereof") changed the way we deal with ARCH_WORKAROUND_1, by moving most of the enabling code to the .matches() callback. This has the unfortunate effect that the workaround gets only enabled on the first affected CPU, and no other. In order to address this, forcefully call the .matches() callback from a .cpu_enable() callback, which brings us back to the original behaviour. Fixes: 73f381660959 ("arm64: Advertise mitigation of Spectre-v2, or lack thereof") Cc: Reviewed-by: Suzuki K Poulose Signed-off-by: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpu_errata.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -599,6 +599,12 @@ check_branch_predictor(const struct arm6 return (need_wa > 0); } +static void +cpu_enable_branch_predictor_hardening(const struct arm64_cpu_capabilities *cap) +{ + cap->matches(cap, SCOPE_LOCAL_CPU); +} + static const __maybe_unused struct midr_range tx2_family_cpus[] = { MIDR_ALL_VERSIONS(MIDR_BRCM_VULCAN), MIDR_ALL_VERSIONS(MIDR_CAVIUM_THUNDERX2), @@ -890,9 +896,11 @@ const struct arm64_cpu_capabilities arm6 }, #endif { + .desc = "Branch predictor hardening", .capability = ARM64_HARDEN_BRANCH_PREDICTOR, .type = ARM64_CPUCAP_LOCAL_CPU_ERRATUM, .matches = check_branch_predictor, + .cpu_enable = cpu_enable_branch_predictor_hardening, }, #ifdef CONFIG_HARDEN_EL2_VECTORS {