Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp819710pxb; Tue, 3 Nov 2020 13:27:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLhkvJ5caRd5PEGil8G31a1d9wJqry5DoyMyUHwbUGkD9BUfev1iZUV7+/V7J7kMm/tW3i X-Received: by 2002:a17:906:f2da:: with SMTP id gz26mr13165543ejb.546.1604438860301; Tue, 03 Nov 2020 13:27:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604438860; cv=none; d=google.com; s=arc-20160816; b=JkC+A6iKUhWcVNZTzXa0SrjAz7SGHtOpk6Q+96OQsiz1ayofzh0XuBUj5ztGzVus/p 2wo/zWTcehzxtYozcjjvxDp3ZFcA0iKgRuz6GC7/QhiZgK0P7xN5pOXg2UnXj7kHZ6g7 YUlqJ0XAkjcIkGqAmsXg7nyYodSVK7X6C9o4dVKdO3HqSCN3Z9XWBR8pSLUbXV8HBy2h 3mtlyJm6aoyCFy1FuKMYRMAXhhFMefti31HGX3frewBi5/9MzXRy5TFwYWrQgZquw6tM nB+1uM6fMlvB7+ot1zMIIGNjnnY0htMuPZbwy6ybH81W4Yo+zcOnAsnggNp+w77blIJ/ y1SQ== 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=H1cEpI7SyMBi0qGdet0X2swVdLRml/OrwaXEOYJ5fe8=; b=B3jFdDnSgI2T5xLIt9GuzMriivfc9lE6tyeV/WqodBMUUqXqtzXf4Xafe56lsN7C0Z FGW3Zx8n7AEfpLmR7ewBiaZe/wcKXBmsQTTk6itPSCpu6VM1t8n6VwqSCN6+AZSGTYTo k/Toxmz2uZvPH54zA9TyteUSaQ9IiSIUMWN343PQeudFh/UOAl0bX57xrwjCzKSe2iUY yGTMz83fUWkp8oQk5W+gbBBLtafDyESEpf/h54MQsv/GHATB+eVc4UQ6V6BQHO2D4Gf4 kZ071FAdauwokGvIHwpL1ined1cah+0HKfwczZq2e+U0ZKJ6ZaogFeg8Bx/MkX+8etXC LAFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mxfFDxyL; 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 p19si13557837edu.169.2020.11.03.13.27.17; Tue, 03 Nov 2020 13:27:40 -0800 (PST) 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=mxfFDxyL; 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 S2387751AbgKCVFK (ORCPT + 99 others); Tue, 3 Nov 2020 16:05:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:40292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732706AbgKCVDA (ORCPT ); Tue, 3 Nov 2020 16:03:00 -0500 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 08CEA20658; Tue, 3 Nov 2020 21:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437379; bh=T9mhykYyDpuupiNvHJ9Z4437cyY0TUXF+Gyuyiv4tMc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mxfFDxyLzuYQPPUDA33EwILWeoypo6ukr93cjMVcj+xuxKmS1PoU0Fl8lmL3pC9Lj uMqCxM/iW+/nKpvmImbJ2x330Pny768hAgCjkHV5r5pUtz/GLralYZuLLpUIJAGPc8 u9y5Teg6UsVYM8Tb5Ld8SE+VpZT7JkdgmvRXFk9Q= 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 4.19 003/191] arm64: Run ARCH_WORKAROUND_1 enabling code on all CPUs Date: Tue, 3 Nov 2020 21:34:55 +0100 Message-Id: <20201103203233.088740109@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 @@ -619,6 +619,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), @@ -813,9 +819,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 {