From patchwork Mon May 14 09:46:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 135706 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1531766lji; Mon, 14 May 2018 02:47:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrXkGsYh1vZmevBZcsU9J3hdEso9t35lyZj8fZdKZromeuwqXo2irRtasEsrhtCiB+6o664 X-Received: by 2002:a63:735c:: with SMTP id d28-v6mr7748737pgn.436.1526291263485; Mon, 14 May 2018 02:47:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526291263; cv=none; d=google.com; s=arc-20160816; b=GNQVSk23UB8d01mhjhCQAYy+czDZnftKyaC/5jOj/F3kd4I+KBIZWJZnHCZj0fNZgE VFJM7iyWv/wHhARgKQcA9auTpheao3Y4kKs1ETxFBH8PaVT3b7SUOGSgqd+InEjl7V/n 0/ZPUUq45wC3uEIaLE15TL9GGyUSza8mOsksOk1pMH2km/OCYdEg3lGPngn2qEIdmhT9 X0DSXNB3Et1/GMEK96iMD2aTgB2HRzV6hDny91wj20o1Muv4BJdEmRZSdFgtcZlgjT+A PC0K2jf5oLCSIRhdHNdUTlw/vjhycLMpLEpNTr4cMhnBRYf6fL4c+BMGCksyIBrZBYS6 wwOA== 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=DXIOJ8agrKiQcaGEMTPiCAVxjhWTylKsW0oiOKdLXRQ=; b=01epeCKawzWxe7s+UP5AhGRC7E7Uy4ygG3GL1A/8luc7gXikvDSRWDNA81bGT/GToV SNGwCOBmeipON0bdkmR2duRdewNF1pIcT1StR6nkXBWMbhDZpML1sA3ECrJlvNbiOaHh d1JoJ9tQNT4vtMr8kDWMVnO4INc1QvnPepz9icwg96WgIhkH8jJ1h8aYg6mhZ8xj8kbd aNCOY03OzzfhYBHizFg/HaJZVydFI5XkQQkJn1zHeC1cYEKaGRiGLrfTHPsXcf5O3JZb SIM1a/ChP+JL3LHFSQ3kzIgqZH8QoP6JzJSe4/Gk3kf5GHHqXRbKfkC5LAWXCtc+ZFTa J+BQ== 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 c21-v6si8853617plo.51.2018.05.14.02.47.43; Mon, 14 May 2018 02:47:43 -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 S1752488AbeENJrk (ORCPT + 29 others); Mon, 14 May 2018 05:47:40 -0400 Received: from foss.arm.com ([217.140.101.70]:38254 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751219AbeENJrh (ORCPT ); Mon, 14 May 2018 05:47:37 -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 A68CD1684; Mon, 14 May 2018 02:47:37 -0700 (PDT) Received: from lakrids.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 B98963F25D; Mon, 14 May 2018 02:47:35 -0700 (PDT) From: Mark Rutland To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, catalin.marinas@arm.com, dave.martin@arm.com, james.morse@arm.com, linux@dominikbrodowski.net, linux-fsdevel@vger.kernel.org, marc.zyngier@arm.com, mark.rutland@arm.com, viro@zeniv.linux.org.uk, will.deacon@arm.com Subject: [PATCH 06/18] arm64: move sve_user_{enable, disable} to Date: Mon, 14 May 2018 10:46:28 +0100 Message-Id: <20180514094640.27569-7-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180514094640.27569-1-mark.rutland@arm.com> References: <20180514094640.27569-1-mark.rutland@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In subsequent patches, we'll want to make use of sve_user_enable() and sve_user_disable() outside of kernel/fpsimd.c. Let's move these to where we can make use of them. To avoid ifdeffery in sequences like: if (system_supports_sve() && some_condition sve_user_disable(); ... empty stubs are provided when support for SVE is not enabled. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Dave Martin Cc: Will Deacon --- arch/arm64/include/asm/fpsimd.h | 17 ++++++++++++++++- arch/arm64/kernel/fpsimd.c | 11 ----------- 2 files changed, 16 insertions(+), 12 deletions(-) -- 2.11.0 diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h index aa7162ae93e3..7377d7593c06 100644 --- a/arch/arm64/include/asm/fpsimd.h +++ b/arch/arm64/include/asm/fpsimd.h @@ -16,11 +16,13 @@ #ifndef __ASM_FP_H #define __ASM_FP_H -#include #include +#include +#include #ifndef __ASSEMBLY__ +#include #include #include #include @@ -81,6 +83,16 @@ extern int sve_set_vector_length(struct task_struct *task, extern int sve_set_current_vl(unsigned long arg); extern int sve_get_current_vl(void); +static inline void sve_user_disable(void) +{ + sysreg_clear_set(cpacr_el1, CPACR_EL1_ZEN_EL0EN, 0); +} + +static inline void sve_user_enable(void) +{ + sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN); +} + /* * Probing and setup functions. * Calls to these functions must be serialised with one another. @@ -107,6 +119,9 @@ static inline int sve_get_current_vl(void) return -EINVAL; } +static inline void sve_user_disable(void) { } +static inline void sve_user_enable(void) { } + static inline void sve_init_vq_map(void) { } static inline void sve_update_vq_map(void) { } static inline int sve_verify_vq_map(void) { return 0; } diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 088940387a4d..79a81c7d85c6 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -159,7 +159,6 @@ static void sve_free(struct task_struct *task) __sve_free(task); } - /* Offset of FFR in the SVE register dump */ static size_t sve_ffr_offset(int vl) { @@ -172,16 +171,6 @@ static void *sve_pffr(struct task_struct *task) sve_ffr_offset(task->thread.sve_vl); } -static void sve_user_disable(void) -{ - sysreg_clear_set(cpacr_el1, CPACR_EL1_ZEN_EL0EN, 0); -} - -static void sve_user_enable(void) -{ - sysreg_clear_set(cpacr_el1, 0, CPACR_EL1_ZEN_EL0EN); -} - /* * TIF_SVE controls whether a task can use SVE without trapping while * in userspace, and also the way a task's FPSIMD/SVE state is stored