From patchwork Sun Oct 27 21:00:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 177862 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2535228ill; Sun, 27 Oct 2019 14:13:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQWbR/H4W59t47K3UB7ungrKp3GNKz9sntyBe5GD1tRqixg49DCeuwMZ0Gxz64r/AWNt40 X-Received: by 2002:a17:906:1e55:: with SMTP id i21mr14082231ejj.47.1572210684797; Sun, 27 Oct 2019 14:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210684; cv=none; d=google.com; s=arc-20160816; b=cWvrtJ8vlalSkswp4yJQVC1lckQEiipe69pKx0Zy24lCidFPfcPaT9aiRE+zqduLc+ eEbpLUwcdNMYzFSvWHMxX3H4SutXc1We3ogODOAC4yYm82rWeSicIf/01Rzm9iX7R1eW UUnrHbWZ17C7fCjlPmD9IIfBZJipZP8QJ7GIPb8iOlEKU0kUxi0NrnRDxtFEiRoD0pKE ATvboXoo3V0nt4XmyFZE0GHSuSDrqb4AHadIcqUiDo36+b5GQd7BAnqVuL7mI/BKz5dQ o8KKuZGG1TrFsf5xKkSTkzbPnJXFHz8q8Cgu3imOxY0EL3yDUTzsWETs7phFE5OR+XF9 Mn9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f9SndBLnNGajscmezkPUpZ+5PTgdDQdkeE9c1D689Ts=; b=fhCHWtWRkYby0+HqldWJupS3/MIWTw7cfX8DmoOfwrxWYun/YA28tQmKWuTBfJH56Q lChIgTRZamSf9Bx/V+yQkv/shq8c4/dF87RSvlEMgIlUblW21T/+R2lyQv78K2DxnRus 82de4TsksR96Bkr0IdFilppSv9xteLPId+qZHO3sWF/QwYLyyI7Flvzp8J2km/U6fsQc 3av8zEoAN8aCANjYat/LEFbZCbFDYhE9ux0foplRA0gojUFT9kkCvMJogV70/lmshnfC 37c3Wo7+MnwDpbCETvm13i9d7O7hLCto6RUsT7NvFS46xVB2hLjf0xLwjIpUKIyhvvf1 HF0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="qy0/wXN0"; 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 g90si6497567edd.329.2019.10.27.14.11.24; Sun, 27 Oct 2019 14:11: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; dkim=pass header.i=@kernel.org header.s=default header.b="qy0/wXN0"; 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 S1728398AbfJ0VLX (ORCPT + 26 others); Sun, 27 Oct 2019 17:11:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:57854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729873AbfJ0VLU (ORCPT ); Sun, 27 Oct 2019 17:11:20 -0400 Received: from localhost (100.50.158.77.rev.sfr.net [77.158.50.100]) (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 00502214AF; Sun, 27 Oct 2019 21:11:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210679; bh=0Yf3Sk80zrmXm6bH+9w5Mz+Gheo+SF6FY/8Hxrs8ppQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qy0/wXN0XgOvjdfROp1tDZn7rUxNI7gzb2o3F77IDutNFaDt78U1c2ER+GLX5URGp x1gKQyIoSeIcRNkWu3k4m6AJuo7msFTDJngOWTpVcnq9AOlWbPFwwYA0UmQGEA4ivW E3UuIkd2nN5IkTE1xrTHGctVl//6YCpPnQkD2riQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Dave Martin , Suzuki K Poulose , Will Deacon , Ard Biesheuvel Subject: [PATCH 4.14 055/119] arm64: capabilities: Allow features based on local CPU scope Date: Sun, 27 Oct 2019 22:00:32 +0100 Message-Id: <20191027203324.012028429@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027203259.948006506@linuxfoundation.org> References: <20191027203259.948006506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suzuki K Poulose [ Upstream commit fbd890b9b8497bab04c1d338bd97579a7bc53fab ] So far we have treated the feature capabilities as system wide and this wouldn't help with features that could be detected locally on one or more CPUs (e.g, KPTI, Software prefetch). This patch splits the feature detection to two phases : 1) Local CPU features are checked on all boot time active CPUs. 2) System wide features are checked only once after all CPUs are active. Reviewed-by: Dave Martin Signed-off-by: Suzuki K Poulose Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- arch/arm64/kernel/cpufeature.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -485,6 +485,7 @@ static void __init init_cpu_ftr_reg(u32 } extern const struct arm64_cpu_capabilities arm64_errata[]; +static const struct arm64_cpu_capabilities arm64_features[]; static void update_cpu_capabilities(const struct arm64_cpu_capabilities *caps, u16 scope_mask, const char *info); @@ -526,11 +527,12 @@ void __init init_cpu_features(struct cpu } /* - * Run the errata work around checks on the boot CPU, once we have - * initialised the cpu feature infrastructure. + * Run the errata work around and local feature checks on the + * boot CPU, once we have initialised the cpu feature infrastructure. */ update_cpu_capabilities(arm64_errata, SCOPE_LOCAL_CPU, "enabling workaround for"); + update_cpu_capabilities(arm64_features, SCOPE_LOCAL_CPU, "detected:"); } static void update_cpu_ftr_reg(struct arm64_ftr_reg *reg, u64 new) @@ -1349,15 +1351,18 @@ void check_local_cpu_capabilities(void) /* * If we haven't finalised the system capabilities, this CPU gets - * a chance to update the errata work arounds. + * a chance to update the errata work arounds and local features. * Otherwise, this CPU should verify that it has all the system * advertised capabilities. */ - if (!sys_caps_initialised) + if (!sys_caps_initialised) { update_cpu_capabilities(arm64_errata, SCOPE_LOCAL_CPU, "enabling workaround for"); - else + update_cpu_capabilities(arm64_features, SCOPE_LOCAL_CPU, + "detected:"); + } else { verify_local_cpu_capabilities(); + } } DEFINE_STATIC_KEY_FALSE(arm64_const_caps_ready); @@ -1382,7 +1387,7 @@ void __init setup_cpu_features(void) int cls; /* Set the CPU feature capabilies */ - update_cpu_capabilities(arm64_features, SCOPE_ALL, "detected:"); + update_cpu_capabilities(arm64_features, SCOPE_SYSTEM, "detected:"); update_cpu_capabilities(arm64_errata, SCOPE_SYSTEM, "enabling workaround for"); enable_cpu_capabilities(arm64_features, SCOPE_ALL);