From patchwork Wed Jul 19 16:01:26 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 108302 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp1011705obm; Wed, 19 Jul 2017 09:03:05 -0700 (PDT) X-Received: by 10.84.174.3 with SMTP id q3mr626584plb.289.1500480185645; Wed, 19 Jul 2017 09:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1500480185; cv=none; d=google.com; s=arc-20160816; b=B793SDWJQNYbACGnlVVsU1X8D5QEjlggkswkFH8BRjuVBOJTAgnT97CVCpiC0uSJjl Yc0CWkk6g0olpbV1PlBGmy8WQQ+qpXYPoGk61t+6IKY8nGK7Ds+51CRiPksmRgdas6sM VgphrxZb0lsIco5vOoNiqRYZ7IFE8jqwOceglGVVyneob1XgTIRavr66pc5IA5x1wsPi GnNjHjbvzXhfnrQwFQW+unxpdL+1OExpGgZeIFbdUwuChWs3oZMLVFyeBUxslC3Ce8UB s3JTeZiYdBKmCFxeI79QIuKzxjdYIAWXGTohayCe66KDq5Ti+5AfSFm2WmXZ2MkD22Oc H6KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=NtmXuX66YdJHrfZUBbAdRKXZayzacvCWoIaN4/+dLys=; b=HC9DrY86PwH6rVw8gu7Bh59TsoQehDeuA5OIg9pKVlQh03sjn0eYR93bsdiZlz04OH 6tFhL1H2RI0/m15OpW07V/qLTHUxmdOu8AA0iaJlt35JZVbYSm42ZJfWNC/28qAuircK ianBp4zZ04+HFAVrnHt9ZwX1BTwRuyLwd0UsHfzcUJatdLacr8un3yFHxJESGhJObSKa 4FTo8IoU8/UDq5abLYPstebUWqL0LZCjAbUgn3CAOg83K+Ldvwlr57CNFjit3iuO5lda Mq2l13sPBXe2wXorOcmXho8doss5Ei8rXtqwjvrnJoHXM63dmDCwRIVCrD8vO9N6gED4 XRAg== ARC-Authentication-Results: i=1; mx.google.com; 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 s139si240442pgs.644.2017.07.19.09.03.05; Wed, 19 Jul 2017 09:03:05 -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; 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 S1755503AbdGSQDB (ORCPT + 25 others); Wed, 19 Jul 2017 12:03:01 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:42300 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754369AbdGSQC7 (ORCPT ); Wed, 19 Jul 2017 12:02:59 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DD30E1610; Wed, 19 Jul 2017 09:02:58 -0700 (PDT) Received: from leverpostej.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 875093F577; Wed, 19 Jul 2017 09:02:56 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: arnd@arndb.de, catalin.marinas@arm.com, christoffer.dall@linaro.org, Dave.Martin@arm.com, jiong.wang@arm.com, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, suzuki.poulose@arm.com, will.deacon@arm.com, yao.qi@arm.com, linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com Subject: [PATCH 05/11] arm64/cpufeature: detect pointer authentication Date: Wed, 19 Jul 2017 17:01:26 +0100 Message-Id: <1500480092-28480-6-git-send-email-mark.rutland@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1500480092-28480-1-git-send-email-mark.rutland@arm.com> References: <1500480092-28480-1-git-send-email-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So that we can dynamically handle the presence of pointer authentication functionality, wire up probing code in cpufeature.c. Currently, this only detects the presence of an architected algorithm. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Suzuki K Poulose Cc: Will Deacon --- arch/arm64/include/asm/cpucaps.h | 4 +++- arch/arm64/kernel/cpufeature.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) -- 1.9.1 diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h index 8d2272c..903b458 100644 --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h @@ -39,7 +39,9 @@ #define ARM64_WORKAROUND_QCOM_FALKOR_E1003 18 #define ARM64_WORKAROUND_858921 19 #define ARM64_WORKAROUND_CAVIUM_30115 20 +#define ARM64_HAS_ADDRESS_AUTH 21 +#define ARM64_HAS_GENERIC_AUTH 22 -#define ARM64_NCAPS 21 +#define ARM64_NCAPS 23 #endif /* __ASM_CPUCAPS_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index b23ad83..4016b1e7 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -892,6 +892,28 @@ static bool has_no_fpsimd(const struct arm64_cpu_capabilities *entry, int __unus .min_field_value = 0, .matches = has_no_fpsimd, }, +#ifdef CONFIG_ARM64_POINTER_AUTHENTICATION + { + .desc = "Address authentication (architected algorithm)", + .capability = ARM64_HAS_ADDRESS_AUTH, + .def_scope = SCOPE_SYSTEM, + .sys_reg = SYS_ID_AA64ISAR1_EL1, + .sign = FTR_UNSIGNED, + .field_pos = ID_AA64ISAR1_APA_SHIFT, + .min_field_value = ID_AA64ISAR1_APA_ARCHITECTED, + .matches = has_cpuid_feature, + }, + { + .desc = "Generic authentication (architected algorithm)", + .capability = ARM64_HAS_GENERIC_AUTH, + .def_scope = SCOPE_SYSTEM, + .sys_reg = SYS_ID_AA64ISAR1_EL1, + .sign = FTR_UNSIGNED, + .field_pos = ID_AA64ISAR1_GPA_SHIFT, + .min_field_value = ID_AA64ISAR1_GPA_ARCHITECTED, + .matches = has_cpuid_feature + }, +#endif /* CONFIG_ARM64_POINTER_AUTHENTICATION */ {}, };