From patchwork Sun Oct 27 21:00:34 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: 177859 Delivered-To: patch@linaro.org Received: by 2002:a92:409a:0:0:0:0:0 with SMTP id d26csp2533414ill; Sun, 27 Oct 2019 14:11:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy/NIVodmR1A7/m8icruI+JBq76I3atojPk2fo1lBAss3dljP8cfb/XCAqVHR4OjaaVa9H1 X-Received: by 2002:a50:f058:: with SMTP id u24mr16395874edl.288.1572210692766; Sun, 27 Oct 2019 14:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572210692; cv=none; d=google.com; s=arc-20160816; b=xwqQIJ9CGLZ3f1SGDXEm2AxIbM7S6mSWeDvRCLGTVRN74a5OVnE3Kr6v5ptWCIaVNQ urCLXiaMRMESa9fUzftedo5BoU+gfpKVGswrNnXighVlBWWSpgrvISncKAhgKWge5FDm lK5SxvkJKrrB+VhbvcPp29CGnQVxw6GOutY4WEzIPvHzFK4PE07wCnLTN4R2+Fh4sTHX BIZB+BqGhpM/E1jgj4oPZNA4woJEI2YPCxfXHHOY2rqf7yrWQM/NZmIQT52WcMwUa6Zl ico7Uy64MpHjd04iiCx1t5K3ZGsm27pkMYghfFCY2Q0kW6OrYttLPlxGE0F6TxeQq3hV 106w== 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=QnAd9xQQZ7rrVx4Ce6XlfDhECN+6Q+51cmtZg5fuTyw=; b=S/pveiaojd3/Xa+Djjh60bI7qRyOKHEgsY92j+bIjiciC0ott882RUB0V7pRotQjjd 7JzBbuhs1pmWGhvlzLcK8PBVtCe+41C4xhObvK39Tdlti9PD6cUDvz8U0u+Fd/5HtfNM rdZrY1tOozghGuS+GJU3VZrbRzAaDabtS2EysCa38qp6GH5yBoX1ZuatWRN+RhO7O2vm DZ5wlTWdGKtBCShne7eaoek1PApM0H8K4UuwQtnx7KLRGQgCYXEFbZ3+UVs6dYI1cRuG M4SgMpK+GFoA8ExObG9UpWbswLL3r8mpuJ93GabTEVpGljvkbdy2l+US7Jrpo6LFq3f2 fS8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=s8MoZOYg; 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 l14si904928ejc.221.2019.10.27.14.11.32; Sun, 27 Oct 2019 14:11:32 -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=s8MoZOYg; 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 S1729898AbfJ0VL3 (ORCPT + 26 others); Sun, 27 Oct 2019 17:11:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:57986 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729892AbfJ0VL1 (ORCPT ); Sun, 27 Oct 2019 17:11:27 -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 7D29F2064A; Sun, 27 Oct 2019 21:11:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572210686; bh=wvwR0NhNnoQB47Ji28buIEL2m27xAvBrs6GV1oWgXy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s8MoZOYgd8Fsa+idIEFXa51Ed3kpmmYHjoul4zUou6r9eJIva+crWGsEvPZTi4QLz FbmCILJGPdwHanGKG37uByz38VnequSMqAybcnOHo/XDekb1OtVETSorFVNOzQdbxC CH2Fb42+nxXsRcw6mg+T3hKjj79CuEJX3leGbHnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Will Deacon , Dave Martin , Suzuki K Poulose , Ard Biesheuvel Subject: [PATCH 4.14 057/119] arm64: capabilities: Introduce weak features based on local CPU Date: Sun, 27 Oct 2019 22:00:34 +0100 Message-Id: <20191027203325.354084991@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 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 Signed-off-by: Greg Kroah-Hartman --- arch/arm64/include/asm/cpufeature.h | 8 ++++++++ arch/arm64/kernel/cpufeature.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) --- 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_re */ #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; --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -959,7 +959,7 @@ static const struct arm64_cpu_capabiliti { .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