From patchwork Wed Apr 3 10:56:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Murray X-Patchwork-Id: 10883437 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 206CB17E1 for ; Wed, 3 Apr 2019 10:56:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03D8C28843 for ; Wed, 3 Apr 2019 10:56:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E9D58289D1; Wed, 3 Apr 2019 10:56:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88E7728843 for ; Wed, 3 Apr 2019 10:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=FoVwUzSTCiahNKUfaOFtV+4UkF4J1fW3yjxU4cDMGeg=; b=oX0ulhF1pIU1oC nR9L/RSly+3vl0E+zRIG2QCana7fzPn7bw0TFEx/PEZNMF49qHTG8dfwpxsFStImw7dvlsJCcPws/ WwJoTXw7aaNj7MC2j5las3VnuAoByvmTF91bItVXHCi8QjXMv33wdcIZiucCQDRFQSFp7aaz/TXJe eE4exF407qiZCMmlgApaFVjUt4+v241nU5OCMFiVGYRHIyludRl/y+l92MuGhySxiXHsnOz0PrMpn zaUoftrtSX5lQL7hEICiXpUKNOciOtVyCtxrW+Pxr7TcCnCD+gZlQXezAtQzyLMUcLoWsop+EhyZx 5czvZnuONFiZoyLkk4yg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBdZU-000665-Hs; Wed, 03 Apr 2019 10:56:44 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBdZR-00063A-JB for linux-arm-kernel@bombadil.infradead.org; Wed, 03 Apr 2019 10:56:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=jsEouzvnva/DUvYsXUbEKb1Ep3erJuEXk1XKof90qW8=; b=0e3FmPxgy0+GRJ0fAwxaEnGHgg GFQY1mWGUgYsV1fFi7z0UlTWRlCvfThnxtFJBNNez3B0oakUdM7qXObFc3FELyL9VSqGGndaH02/g AEr+qME7NPQEoOzTMurc9a8hdW3grdUT2DlZugbo79ViCY2JCEZiJtLyZa7BwpcUBF9lzhmevQydR +O9QlZBvsChQz9ZPLzaRFsf7UPhduF1pEbJ37l+QjNyxdm3NvNrGBWG+V0ZxdoOwyYADCeQhppF+f BJL5yURaBRa9B5GVRTD4fW7tr8w5Pk9tKuxgQcSlB6AoXQCIoWeJuU8kMUuFA/hg9Q0wQYe3BEowG 1o/cVW/A==; Received: from foss.arm.com ([217.140.101.70]) by merlin.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBdZO-0001ku-Ls for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2019 10:56:39 +0000 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 7C20880D; Wed, 3 Apr 2019 03:56:36 -0700 (PDT) Received: from e119886-lin.cambridge.arm.com (unknown [10.37.6.20]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 66B9D3F59C; Wed, 3 Apr 2019 03:56:34 -0700 (PDT) From: Andrew Murray To: Catalin Marinas , Will Deacon Subject: [PATCH v4 0/6] arm64: Initial support for CVADP Date: Wed, 3 Apr 2019 11:56:22 +0100 Message-Id: <20190403105628.39798-1-andrew.murray@arm.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190403_065638_807505_45710821 X-CRM114-Status: GOOD ( 15.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , libc-alpha@sourceware.org, Suzuki K Poulose , Szabolcs Nagy , linux-api@vger.kernel.org, Phil Blundell , dave.martin@arm.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP ARMv8.5 introduces a DC CVADP instruction which cleans the data cache to the point of deep persistence. This series makes the instruction available to userspace and advertises the presence of this CPU feature. At present when CONFIG_ARM64_PMEM is enabled and the CVAP feature is present (ARMv8.2) the CVAP instruction is used (from memcpy_flushcache and arch_wb_cache_pmem). No changes have been made to use CVADP in these functions or similar. As we have moved beyond 32 capabilities we now begin using AT_HWCAP2 for userspace. Tested as follows: $ dmesg | grep "Deep" [ 0.166496] CPU features: detected: Data cache clean to Point of Deep Persistence $ LD_SHOW_AUXV=1 sleep 2>&1 | grep AT_HWCAP AT_HWCAP: ef91ff87 AT_HWCAP2: 0x1 Changes since v3: - Rebased onto v5.1-rc3 - Add macros for mapping uapi HWCAPs to KERNEL_HWCAPs - Squash AT_HWCAP2 documentation into AT_HWCAP2 patch - Reorder series to allow HWCAP changes to be taken without CVADP (if needed) - Additional comments, changes to comments and commit messages Changes since v2: - Rebased onto v5.1-rc2 - Renamed cpu_{have,set}_feature_name to cpu_{have,set}_named_feature - Add additional comments and update kernel Documentation Changes since v1: - Rebased onto v5.0-rc7 - Introduced cpu_{have,set}_feature_name to eliminate use of KERNEL_HWCAP prefix - Hard coded MAX_CPU_FEATURES and added a WARN_ON - Minor comment and tab/spacing changes - Use elf_hwcap for all 64 caps in the kernel instead of a new elf_hwcap2 Andrew Murray (6): arm64: HWCAP: add support for AT_HWCAP2 arm64: HWCAP: encapsulate elf_hwcap arm64: Handle trapped DC CVADP arm64: Expose DC CVADP to userspace arm64: add CVADP support to the cache maintenance helper arm64: Advertise ARM64_HAS_DCPODP cpu feature Documentation/arm64/elf_hwcaps.txt | 18 +++- arch/arm64/crypto/aes-ce-ccm-glue.c | 2 +- arch/arm64/crypto/aes-neonbs-glue.c | 2 +- arch/arm64/crypto/chacha-neon-glue.c | 2 +- arch/arm64/crypto/crct10dif-ce-glue.c | 4 +- arch/arm64/crypto/ghash-ce-glue.c | 8 +- arch/arm64/crypto/nhpoly1305-neon-glue.c | 2 +- arch/arm64/crypto/sha256-glue.c | 4 +- arch/arm64/include/asm/assembler.h | 4 + arch/arm64/include/asm/cpucaps.h | 3 +- arch/arm64/include/asm/cpufeature.h | 21 ++--- arch/arm64/include/asm/esr.h | 3 +- arch/arm64/include/asm/hwcap.h | 53 ++++++++++- arch/arm64/include/uapi/asm/hwcap.h | 7 +- arch/arm64/kernel/cpufeature.c | 109 +++++++++++++++-------- arch/arm64/kernel/cpuinfo.c | 3 +- arch/arm64/kernel/fpsimd.c | 4 +- arch/arm64/kernel/traps.c | 3 + drivers/clocksource/arm_arch_timer.c | 8 ++ 19 files changed, 189 insertions(+), 71 deletions(-)