From patchwork Thu Oct 24 12:48:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 177443 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2142415ill; Thu, 24 Oct 2019 05:49:25 -0700 (PDT) X-Google-Smtp-Source: APXvYqxm3/hnUvxpOaBGixh3L9rI6WnhrGMVeTvmc+Dggu8mbHA44xak5eCU4NEtw0adop870cQz X-Received: by 2002:a17:906:2d68:: with SMTP id f8mr15016209eji.71.1571921365556; Thu, 24 Oct 2019 05:49:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571921365; cv=none; d=google.com; s=arc-20160816; b=PmjyOQhP77kaR3ZKMgl0tL+16KCdD2Ex4kDGpgYOs1FxVeDuWSYbpR0V2jDW2Zmq4z eNnlDURtee4xYH/mxBRmGYNfR9NNR1H8mqCeDEMJLkMXM00OjWh+GmtgBKNhIjUGaLjn J05v1T9ppNXRdU9BTdhQxkjaRNUGRVWfalwSABP2GrMpEp0nMBgOASjKAXDppMGSs9ap 0B9wjW9marSyj9B0ZtDR02fATKH3lTqI9HwbZgpESy/TPXBN3G5UBN/MMbmQuSykZ0bH LDXJRLT/i/eC31aHqak2ItF/LmDTx8zXsmwVYv0GhVeg5AS8dTV4Id2isIFOelma/UM7 esIg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wubb1ptsFBR4ICvsyB8Sd/a3awDMFWJa2cfELdT8mrQ=; b=sMaSRCGueh50BT3AeDjOSbzvhKucEAX5EdlEM5487YaPGvCwmbofztKx8prs53kG6S kgS49FViRoiU0UPAsEN6lFYgM/VdXahQ1S9uRYm8jJk9AULBzEjC4OVlaDsBPF3qqMVi sbwCySOufuGgDXC+w8HfIsxVGYd7BJaandXLNtPwH89x7JbT2h8DLy/nA68dG9TeXaKh NcRSj2GcdZmXVe6Py5j6a3sTxzdnAG+EEJbO7cvU6n8dTEQ/nBouJDC9ZaUIjpjAd0Qf d2TqvrgZ9t/J2EL3qPmgyVbvST0An9osCW2UUwI2UY6lhlthiAZrDLcVAmHLpZ/iOT+L 8k2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=swN6qyo8; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si12973378eda.251.2019.10.24.05.49.25; Thu, 24 Oct 2019 05:49:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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=@linaro.org header.s=google header.b=swN6qyo8; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729573AbfJXMtY (ORCPT + 14 others); Thu, 24 Oct 2019 08:49:24 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54015 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502106AbfJXMtY (ORCPT ); Thu, 24 Oct 2019 08:49:24 -0400 Received: by mail-wm1-f67.google.com with SMTP id n7so1869288wmc.3 for ; Thu, 24 Oct 2019 05:49:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wubb1ptsFBR4ICvsyB8Sd/a3awDMFWJa2cfELdT8mrQ=; b=swN6qyo8WVfacyJYM2pvx9heguZ0jS9+KlhIPKGz5EFZhzRCoKkF7ytQera+0Pp1lH JsbjPaXak16OSuy8AF0Q4O32jZ5PdfLm5c7lxVd2cO0U9JZkLLei4B1/H+S5SV6zopIO NJPGJDONGlD4w+SOR3sPHnTHxx5DlGdPDee6FaR171uhCQEE563spiliz2msodP9iemb zZR8Zt5oe+UijhEIFvdij/2+C2IwxdhF0vQ0X/uE1Z6OfHgxYTjKc/UKWuEC+TyJtR9z NxcAkoWujFqJbGmczX9OP+0Tmk2cYcPYA4qSqL5EUL1+jl+dmCnHtDqzPTa0CPmsAhAi vohg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wubb1ptsFBR4ICvsyB8Sd/a3awDMFWJa2cfELdT8mrQ=; b=Ryvm2km3tpt4ksq92yO8/cXi84aNH1cHAKvinXoHESiUU9azfGghgnNb9trF9dE4Hi +MNkJrG/QTPzmO+s4Q+Gw+VJb1V2+mwFTJgMYE0PhPP/VPUsZsCUAc7RFqaDJgsLB8UK fWn7pWetTWyy8/LR00X2G1fxKmu8ozA5xJwI86WQBei88cKoWwSz/8ZVDLerHdrSBDKX O5CeRpbglezLOPwqelEGIOcOzSp4fncW2Wfx6CDVB38a+csUEgQ6+738gl/4Zz3C3G+Z GODTgguRI2AzCtm6jxc+R+CkGlJ9f34XNcsz6WhW70ddO7ickPCcFuVArFPXKReEMQoC QFyQ== X-Gm-Message-State: APjAAAV7xY0Ax484rdgCzShjYkIYpn7T02PBBuvbHb2HDkZV0P2ub9Bc IlVJPGpH1lC5vp2dqUyzuG62d1/pDIN4XBSa X-Received: by 2002:a1c:6308:: with SMTP id x8mr4908868wmb.140.1571921361696; Thu, 24 Oct 2019 05:49:21 -0700 (PDT) Received: from localhost.localdomain (aaubervilliers-681-1-126-126.w90-88.abo.wanadoo.fr. [90.88.7.126]) by smtp.gmail.com with ESMTPSA id j22sm29111038wrd.41.2019.10.24.05.49.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 05:49:20 -0700 (PDT) From: Ard Biesheuvel To: stable@vger.kernel.org Cc: Ard Biesheuvel , Will Deacon , Catalin Marinas , Marc Zyngier , Mark Rutland , Suzuki K Poulose , Jeremy Linton , Andre Przywara , Alexandru Elisei , Will Deacon , Dave Martin Subject: [PATCH for-stable-4.14 21/48] arm64: capabilities: Introduce weak features based on local CPU Date: Thu, 24 Oct 2019 14:48:06 +0200 Message-Id: <20191024124833.4158-22-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191024124833.4158-1-ard.biesheuvel@linaro.org> References: <20191024124833.4158-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Suzuki K Poulose [ Upstream commit 5c137714dd8cae464dbd5f028c07af149e6d09fc ] Now that we have the flexibility of defining system features based on individual CPUs, introduce CPU feature type that can be detected on a local SCOPE and ignores the conflict on late CPUs. This is applicable for ARM64_HAS_NO_HW_PREFETCH, where it is fine for the system to have CPUs without hardware prefetch turning up later. We only suffer a performance penalty, nothing fatal. Cc: Will Deacon Reviewed-by: Dave Martin Signed-off-by: Suzuki K Poulose Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel --- arch/arm64/include/asm/cpufeature.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) -- 2.20.1 diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index b19dd89bcce9..09825b667af0 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -235,6 +235,14 @@ extern struct arm64_ftr_reg arm64_ftr_reg_ctrel0; */ #define ARM64_CPUCAP_SYSTEM_FEATURE \ (ARM64_CPUCAP_SCOPE_SYSTEM | ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU) +/* + * CPU feature detected at boot time based on feature of one or more CPUs. + * All possible conflicts for a late CPU are ignored. + */ +#define ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE \ + (ARM64_CPUCAP_SCOPE_LOCAL_CPU | \ + ARM64_CPUCAP_OPTIONAL_FOR_LATE_CPU | \ + ARM64_CPUCAP_PERMITTED_FOR_LATE_CPU) struct arm64_cpu_capabilities { const char *desc; diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index f4d640dc7f8b..439cdca71024 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -959,7 +959,7 @@ static const struct arm64_cpu_capabilities arm64_features[] = { { .desc = "Software prefetching using PRFM", .capability = ARM64_HAS_NO_HW_PREFETCH, - .type = ARM64_CPUCAP_SYSTEM_FEATURE, + .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, .matches = has_no_hw_prefetch, }, #ifdef CONFIG_ARM64_UAO