[PATCH] arm64: KVM: Obey RES0/1 reserved bits when setting CPTR_EL2

2016-01-19 Thread Dave Martin
are always written with 1, not 0. This patch only addresses CPTR_EL2. Initialisation of other system registers may still need review. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/kvm_arm.h |1 + arch/arm64/kvm/hyp/switch.c |8 ++-- 2 files chan

[RFC PATCH] arm64: Fix EL1/EL2 early init inconsistencies with VHE

2016-04-18 Thread Dave Martin
. In particular, the layout and definition of CPTR_EL2 are changed by enabling VHE so that they resemble CPACR_EL1, so existing code to initialise CPTR_EL2 becomes architecturally wrong in this case. This patch simply skips the affected initialisation code in the non-VHE case. Signed-off-by: Dave Martin

Re: [PATCH 17/27] arm64/sve: Preserve SVE registers around EFI runtime service calls

2017-08-16 Thread Dave Martin
On Tue, Aug 15, 2017 at 06:44:45PM +0100, Ard Biesheuvel wrote: > On 9 August 2017 at 13:05, Dave Martin <dave.mar...@arm.com> wrote: > > The EFI runtime services ABI allows EFI to make free use of the > > FPSIMD registers during EFI runtime service calls, subject t

Re: [PATCH 23/27] arm64/sve: KVM: Hide SVE from CPU features exposed to guests

2017-08-16 Thread Dave Martin
On Wed, Aug 16, 2017 at 12:10:53PM +0100, Marc Zyngier wrote: > On 16/08/17 11:54, Dave Martin wrote: > > On Tue, Aug 15, 2017 at 05:37:55PM +0100, Marc Zyngier wrote: > >> On 09/08/17 13:05, Dave Martin wrote: [...] > >>> + if (id == SYS_ID_AA64PFR0_EL1) { >

Re: [PATCH 11/27] arm64/sve: Core task context handling

2017-08-16 Thread Dave Martin
On Tue, Aug 15, 2017 at 06:31:05PM +0100, Ard Biesheuvel wrote: > Hi Dave, > > On 9 August 2017 at 13:05, Dave Martin <dave.mar...@arm.com> wrote: > > This patch adds the core support for switching and managing the SVE > > architectural state of user tasks. > >

Re: [PATCH 23/27] arm64/sve: KVM: Hide SVE from CPU features exposed to guests

2017-08-16 Thread Dave Martin
On Tue, Aug 15, 2017 at 05:37:55PM +0100, Marc Zyngier wrote: > On 09/08/17 13:05, Dave Martin wrote: > > KVM guests cannot currently use SVE, because SVE is always > > configured to trap to EL2. > > > > However, a guest that sees SVE reported as present in > >

Re: [PATCH 21/27] arm64/sve: KVM: Prevent guests from using SVE

2017-08-16 Thread Dave Martin
On Wed, Aug 16, 2017 at 12:20:41PM +0100, Marc Zyngier wrote: > On 16/08/17 11:50, Dave Martin wrote: > > On Tue, Aug 15, 2017 at 05:33:15PM +0100, Marc Zyngier wrote: > >> On 09/08/17 13:05, Dave Martin wrote: > >>> Until KVM has full SVE support, guests must not b

Re: [PATCH 21/27] arm64/sve: KVM: Prevent guests from using SVE

2017-08-16 Thread Dave Martin
On Tue, Aug 15, 2017 at 05:33:15PM +0100, Marc Zyngier wrote: > On 09/08/17 13:05, Dave Martin wrote: > > Until KVM has full SVE support, guests must not be allowed to > > execute SVE instructions. > > > > This patch enables the necessary traps, and also ensures that

Re: [PATCH 07/11] arm64: add basic pointer authentication support

2017-08-11 Thread Dave Martin
On Fri, Aug 11, 2017 at 08:46:28AM +0100, Yao Qi wrote: > Hi Mark, > > On 19/07/17 17:01, Mark Rutland wrote: > >+#define HWCAP_APIA (1 << 16) > > Can you rename it to HWCAP_ARM64_APIA or HWCAP_ARM_APIA? When we > use it in user space, at least in GDB, we usually do this, > > #ifndef

Re: [PATCH 15/27] arm64/sve: Probe SVE capabilities and usable vector lengths

2017-08-17 Thread Dave Martin
On Wed, Aug 16, 2017 at 06:48:01PM +0100, Suzuki K Poulose wrote: > On 09/08/17 13:05, Dave Martin wrote: > >[This sender failed our fraud detection checks and may not be who they > >appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing] Any idea what this is ^

Re: [PATCH 02/27] arm64: KVM: Hide unsupported AArch64 CPU features from guests

2017-08-17 Thread Dave Martin
On Thu, Aug 17, 2017 at 09:45:51AM +0100, Marc Zyngier wrote: > On 16/08/17 21:32, Dave Martin wrote: > > On Wed, Aug 16, 2017 at 12:10:38PM +0100, Marc Zyngier wrote: > >> On 09/08/17 13:05, Dave Martin wrote: > >>> Currently, a guest kernel sees the true CPU fea

Re: [PATCH 24/27] arm64/sve: Detect SVE and activate runtime support

2017-08-17 Thread Dave Martin
On Wed, Aug 16, 2017 at 06:53:07PM +0100, Suzuki K Poulose wrote: > On 09/08/17 13:05, Dave Martin wrote: > >[This sender failed our fraud detection checks and may not be who they > >appear to be. Learn about spoofing at http://aka.ms/LearnAboutSpoofing] > > > >T

Re: [PATCH 00/11] ARMv8.3 pointer authentication userspace support

2017-07-21 Thread Dave Martin
On Wed, Jul 19, 2017 at 05:01:21PM +0100, Mark Rutland wrote: > This series adds support for the ARMv8.3 pointer authentication extension. > > Since RFC [1]: > * Make the KVM context switch (semi-lazy) > * Rebase to v4.13-rc1 > * Improve pointer authentication documentation > * Add hwcap

Re: [PATCH 01/11] arm64: docs: describe ELF hwcaps

2017-07-21 Thread Dave Martin
t;? I'm not sure of the history here. > Signed-off-by: Mark Rutland <mark.rutl...@arm.com> > Cc: Catalin Marinas <catalin.mari...@arm.com> > Cc: Dave Martin <dave.mar...@arm.com> > Cc: Suzuki K Poulose <suzuki.poul...@arm.com> > Cc: Will De

Re: [RFC 7/9] arm64: expose PAC bit positions via ptrace

2017-07-25 Thread Dave Martin
On Mon, Apr 03, 2017 at 04:19:23PM +0100, Mark Rutland wrote: > When pointer authentication is in use, data/instruction pointers have a > number of PAC bits inserted into them. The number and position of these > bits depends on the configured TCR_ELx.TxSZ and whether tagging is > enabled. ARMv8.3

Re: [RFC 7/9] arm64: expose PAC bit positions via ptrace

2017-07-25 Thread Dave Martin
On Tue, Jul 25, 2017 at 03:59:04PM +0100, Mark Rutland wrote: > On Tue, Jul 25, 2017 at 01:11:48PM +0100, Dave Martin wrote: > > On Mon, Apr 03, 2017 at 04:19:23PM +0100, Mark Rutland wrote: > > > +/* > > > + * The pointer bits used by a pointer authentication code.

Re: [PATCH 07/11] arm64: add basic pointer authentication support

2017-07-25 Thread Dave Martin
On Wed, Jul 19, 2017 at 05:01:28PM +0100, Mark Rutland wrote: > This patch adds basic support for pointer authentication, allowing > userspace to make use of APIAKey. The kernel maintains an APIAKey value > for each process (shared by all threads within), which is initialised to > a random value

Re: [PATCH 07/11] firmware: arm_sdei: Add driver for Software Delegated Exceptions

2017-07-19 Thread Dave Martin
On Mon, May 15, 2017 at 06:43:55PM +0100, James Morse wrote: > The Software Delegated Exception Interface (SDEI) is an ARM standard > for registering callbacks from the platform firmware into the OS. > This is typically used to implement RAS notifications. > > Add the code for detecting the SDEI

Re: [PATCH 06/11] arm64: Don't trap host pointer auth use to EL2

2017-07-24 Thread Dave Martin
On Wed, Jul 19, 2017 at 05:01:27PM +0100, Mark Rutland wrote: > To allow EL0 (and/or EL1) to use pointer authentication functionality, > we must ensure that pointer authentication instructions and accesses to > pointer authentication keys are not trapped to EL2 (where we will not be > able to

[PATCH 06/27] arm64/sve: System register and exception syndrome definitions

2017-08-09 Thread Dave Martin
The SVE architecture adds some system registers, ID register fields and a dedicated ESR exception class. This patch adds the appropriate definitions that will be needed by the kernel. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/esr.h | 3 ++- arch

[PATCH 00/27] ARM Scalable Vector Extension (SVE)

2017-08-09 Thread Dave Martin
functionality has only been performed on the model. Regression testing using LTP is under way and has also been completed on previous versions of this series. Series summary: * Patches 1-5 contain some individual bits of preparatory spadework, which are indirectly related to SVE. Dave Martin (5

[PATCH 05/27] arm64: fpsimd: Simplify uses of {set, clear}_ti_thread_flag()

2017-08-09 Thread Dave Martin
. This should have no impact on behaviour. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/fpsimd.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 138fcfa..9c1f268e 100644 ---

[PATCH 04/27] arm64: Port deprecated instruction emulation to new sysctl interface

2017-08-09 Thread Dave Martin
rectories explicitly, which is ideal here. This patch ports register_insn_emulation_sysctl() over to the register_sysctl() interface and removes the redundant ctl_table for "abi". Signed-off-by: Dave Martin <dave.mar...@arm.com> [1] fea478d4101a (sysctl: Add register_sysctl for nor

[PATCH 02/27] arm64: KVM: Hide unsupported AArch64 CPU features from guests

2017-08-09 Thread Dave Martin
for AArch32: however, these could be handled in a similar way in future, as necessary. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kvm/hyp/switch.c | 6 ++ arch/arm64/kvm/sys_regs.c | 224 +++- 2 files changed, 185 insertions(

[PATCH 01/27] regset: Add support for dynamically sized regsets

2017-08-09 Thread Dave Martin
a get_size() implementation. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- fs/binfmt_elf.c| 6 ++--- include/linux/regset.h | 67 -- 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c

[PATCH 03/27] arm64: efi: Add missing Kconfig dependency on KERNEL_MODE_NEON

2017-08-09 Thread Dave Martin
dependency. This will aid bisection of the patches implementing support for the ARM Scalable Vector Extension (SVE). Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d

[PATCH 07/27] arm64/sve: Low-level SVE architectural state manipulation functions

2017-08-09 Thread Dave Martin
the vector length. Setting of the vector length is done as part of register restore. Since people building kernels may not all get an SVE-enabled toolchain for a while, this patch uses macros that generate explicit opcodes in place of assembler mnemonics. Signed-off-by: Dave Martin <dave.mar...@arm.

[PATCH 08/27] arm64/sve: Kconfig update and conditional compilation support

2017-08-09 Thread Dave Martin
in a later patch, once SVE support is complete enough to be enabled safely. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/Kconfig | 11 +++ arch/arm64/include/asm/cpufeature.h | 5 + 2 files changed, 16 insertions(+) diff --git a/arch/arm64/K

[PATCH 11/27] arm64/sve: Core task context handling

2017-08-09 Thread Dave Martin
: this is an obvious slow path and a hint that we are running a new binary that may not use SVE. Code is added to sync data between thread.fpsimd_state and thread.sve_state whenever enabling/disabling SVE, in a manner consistent with the SVE architectural programmer's model. Signed-off-by: Dave Martin

[PATCH 09/27] arm64/sve: Signal frame and context structure definition

2017-08-09 Thread Dave Martin
length, it is not possible to define a fixed C struct to describe all the registers. Instead, Macros are defined in sigcontext.h to facilitate access to the parts of the structure. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/uapi/asm/sigcontext.h

[PATCH 10/27] arm64/sve: Low-level CPU setup

2017-08-09 Thread Dave Martin
set by ZCR_EL2.) In advance of full SVE support being implemented for userspace, it also necessary to ensure that SVE traps from EL0 are enabled. This patch makes the appropriate changes to the primary and secondary CPU initialisation code. Signed-off-by: Dave Martin <dave.mar...@arm.

[PATCH 12/27] arm64/sve: Support vector length resetting for new processes

2017-08-09 Thread Dave Martin
flag TIF_SVE_VL_INHERIT to control whether to inherit or reset the vector length. Currently these are inactive. Subsequent patches will provide the capability to configure them. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/processor.h | 1 + arch/arm64/inclu

[PATCH 14/27] arm64/sve: Backend logic for setting the vector length

2017-08-09 Thread Dave Martin
that are not a power of two. To handle this, logic is added to check a requested vector length against a possibly sparse bitmap of available vector lengths at runtime, so that the best supported value can be chosen. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/fpsimd.h

[PATCH 13/27] arm64/sve: Signal handling support

2017-08-09 Thread Dave Martin
of the SVE state, this flush is hoisted before the sigframe layout phase, so that the layout and population phases see a consistent view of the thread. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 23 -- arch

[PATCH 15/27] arm64/sve: Probe SVE capabilities and usable vector lengths

2017-08-09 Thread Dave Martin
() remains hardwired to false. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/cpu.h| 4 ++ arch/arm64/include/asm/cpufeature.h | 28 ++ arch/arm64/include/asm/fpsimd.h | 10 arch/arm64/kernel/cpufeature.c | 48

[PATCH 16/27] arm64/sve: Preserve SVE registers around kernel-mode NEON use

2017-08-09 Thread Dave Martin
. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/fpsimd.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 955c873..b7fb836 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/

[PATCH 19/27] arm64/sve: Add prctl controls for userspace vector length management

2017-08-09 Thread Dave Martin
instructions. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/fpsimd.h| 14 arch/arm64/include/asm/processor.h | 4 arch/arm64/kernel/fpsimd.c | 46 ++ include/uapi/linux/prctl.h | 4

[PATCH 18/27] arm64/sve: ptrace and ELF coredump support

2017-08-09 Thread Dave Martin
, which the recipient can use to figure out the content, size and layout of the reset of the regset. Accessor macros are defined to allow the vector-length-dependent parts of the regset to be manipulated. Signed-off-by: Alan Hayward <alan.hayw...@arm.com> Signed-off-by: Dave Martin <dave.mar..

[PATCH 23/27] arm64/sve: KVM: Hide SVE from CPU features exposed to guests

2017-08-09 Thread Dave Martin
as reading as zero, which is consistent with SVE not being implemented. This is a temporary measure, and will be removed in a later series when full KVM support for SVE is implemented. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kvm/sys_regs.c | 14 +- 1 file c

[PATCH 24/27] arm64/sve: Detect SVE and activate runtime support

2017-08-09 Thread Dave Martin
running on hardware that supports SVE, this enables runtime kernel support for SVE, and allows user tasks to execute SVE instructions and make of the of the SVE-specific user/kernel interface extensions implemented by this series. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch

[RFC PATCH 26/27] arm64: signal: Report signal frame size to userspace via auxv

2017-08-09 Thread Dave Martin
s internal SIGFRAME_MAXSZ is supposed to sanity-check against generting frames that we consider _impossibly_ large. In this case, SIGSTKSZ is returned as a "reasonable guess that is at least bigger than MINSIGSTKSZ" and we WARN(). Signed-off-by: Dave Martin <dave.mar...@arm.com> -

[PATCH 25/27] arm64/sve: Add documentation

2017-08-09 Thread Dave Martin
This patch adds basic documentation of the user/kernel interface provided by the for SVE. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- Documentation/arm64/sve.txt | 454 1 file changed, 454 insertions(+) create mode 100644 Documentation

[PATCH 20/27] arm64/sve: Add sysctl to set the default vector length for new processes

2017-08-09 Thread Dave Martin
existing process. The intended usage model is that if userspace is known to be fully SVE-tolerant (or a developer is curious to find out) then init scripts can crank this up during startup. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/fpsimd.

[PATCH 21/27] arm64/sve: KVM: Prevent guests from using SVE

2017-08-09 Thread Dave Martin
Until KVM has full SVE support, guests must not be allowed to execute SVE instructions. This patch enables the necessary traps, and also ensures that the traps are disabled again on exit from the guest so that the host can still use SVE if it wants to. Signed-off-by: Dave Martin <dave.

[PATCH 17/27] arm64/sve: Preserve SVE registers around EFI runtime service calls

2017-08-09 Thread Dave Martin
must be saved and restored too. No attempt is made to restore the restore the vector length after a call, for now. It is deemed rather insane for EFI to change it, and contemporary EFI implementations certainly won't. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/fp

[PATCH 22/27] arm64/sve: KVM: Treat guest SVE use as undefined instruction execution

2017-08-09 Thread Dave Martin
When trapping forbidden attempts by a guest to use SVE, we want the guest to see a trap consistent with SVE not being implemented. This patch injects an undefined instruction exception into the guest in response to such an exception. Signed-off-by: Dave Martin <dave.mar...@arm.com> ---

[RFC PATCH 27/27] arm64/sve: signal: Include SVE when computing AT_MINSIGSTKSZ

2017-08-09 Thread Dave Martin
vector length: this determines the maximum size of SVE context block that can be observed in any signal frame for the lifetime of the process. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/signal.c | 15 +++ 1 file changed, 11 insertions(+), 4 del

Re: [PATCH 02/27] arm64: KVM: Hide unsupported AArch64 CPU features from guests

2017-08-16 Thread Dave Martin
On Wed, Aug 16, 2017 at 12:10:38PM +0100, Marc Zyngier wrote: > On 09/08/17 13:05, Dave Martin wrote: > > Currently, a guest kernel sees the true CPU feature registers > > (ID_*_EL1) when it reads them using MRS instructions. This means > > that the guest will observe feat

Re: [PATCH 12/27] arm64/sve: Support vector length resetting for new processes

2017-08-22 Thread Dave Martin
On Tue, Aug 22, 2017 at 05:22:11PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > It's desirable to be able to reset the vector length to some sane > > default for new processes, since the new binary and its libraries > > proc

Re: [PATCH 11/27] arm64/sve: Core task context handling

2017-08-22 Thread Dave Martin
On Tue, Aug 22, 2017 at 05:21:19PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: [...] > > --- a/arch/arm64/include/asm/processor.h > > +++ b/arch/arm64/include/asm/processor.h > > @@ -85,6 +85,8 @@ struct thread_struct { > >

Re: [PATCH 09/27] arm64/sve: Signal frame and context structure definition

2017-08-22 Thread Dave Martin
On Tue, Aug 22, 2017 at 04:03:20PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > On Tue, Aug 22, 2017 at 02:53:49PM +0100, Alex Bennée wrote: [...] > >> + > >> +#define SVE_VQ_BITS 128 /* 128 bits in one

Re: [PATCH 09/27] arm64/sve: Signal frame and context structure definition

2017-08-22 Thread Dave Martin
On Tue, Aug 22, 2017 at 02:53:49PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > On Tue, Aug 22, 2017 at 11:22:44AM +0100, Alex Bennée wrote: > >> > >> Dave Martin <dave.mar...@arm.com> writes: [...] > >&

Re: [PATCH 10/27] arm64/sve: Low-level CPU setup

2017-08-22 Thread Dave Martin
On Tue, Aug 22, 2017 at 04:04:28PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > To enable the kernel to use SVE, all SVE traps from EL1 must be > > disabled. To take maximum advantage of the hardware, the full > > available vecto

Re: [PATCH 13/27] arm64/sve: Signal handling support

2017-08-23 Thread Dave Martin
On Wed, Aug 23, 2017 at 10:38:51AM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > This patch implements support for saving and restoring the SVE > > registers around signals. > > > > A fixed-size header struct sve_context is

Re: [PATCH 11/27] arm64/sve: Core task context handling

2017-08-17 Thread Dave Martin
On Tue, Aug 15, 2017 at 06:31:05PM +0100, Ard Biesheuvel wrote: > Hi Dave, > > On 9 August 2017 at 13:05, Dave Martin <dave.mar...@arm.com> wrote: > > This patch adds the core support for switching and managing the SVE > > architectural state of user tas

Re: [PATCH 14/27] arm64/sve: Backend logic for setting the vector length

2017-08-23 Thread Dave Martin
On Wed, Aug 23, 2017 at 04:33:18PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > This patch implements the core logic for changing a task's vector > > length on request from userspace. This will be used by the ptrace > > and prc

Re: [PATCH 06/27] arm64/sve: System register and exception syndrome definitions

2017-08-21 Thread Dave Martin
On Mon, Aug 21, 2017 at 03:50:32PM +0100, Alex Bennée wrote: > Dave Martin <dave.mar...@arm.com> writes: > > On Mon, Aug 21, 2017 at 01:34:38PM +0100, Alex Bennée wrote: [...] > >> > Dave Martin <dave.mar...@arm.com> writes: [...] > >> >> +#

Re: [PATCH 09/27] arm64/sve: Signal frame and context structure definition

2017-08-22 Thread Dave Martin
On Tue, Aug 22, 2017 at 11:22:44AM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > This patch defines the representation that will be used for the SVE > > register state in the signal frame, and implements support for > > savin

Re: [PATCH 06/27] arm64/sve: System register and exception syndrome definitions

2017-08-21 Thread Dave Martin
On Mon, Aug 21, 2017 at 10:33:55AM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > The SVE architecture adds some system registers, ID register fields > > and a dedicated ESR exception class. > > > > This patch adds the appr

Re: [PATCH 06/27] arm64/sve: System register and exception syndrome definitions

2017-08-21 Thread Dave Martin
On Mon, Aug 21, 2017 at 01:34:38PM +0100, Alex Bennée wrote: > > Alex Bennée <alex.ben...@linaro.org> writes: > > > Dave Martin <dave.mar...@arm.com> writes: [...] > OK no I'm working directly from the unpacked ZIP file with the rest of > the details I thi

Re: [PATCH 07/27] arm64/sve: Low-level SVE architectural state manipulation functions

2017-08-21 Thread Dave Martin
On Mon, Aug 21, 2017 at 11:11:48AM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > Manipulating the SVE architectural state, including the vector and > > predicate registers, first-fault register and the vector length, > > requires

[PATCH v2 01/28] regset: Add support for dynamically sized regsets

2017-08-31 Thread Dave Martin
a get_size() implementation. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> --- fs/binfmt_elf.c| 6 ++--- include/linux/regset.h | 67 -- 2 files changed, 63 insertions(+), 10 deleti

[PATCH v2 02/28] arm64: KVM: Hide unsupported AArch64 CPU features from guests

2017-08-31 Thread Dave Martin
for AArch32: however, these could be handled in a similar way in future, as necessary. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Marc Zyngier <marc.zyng...@arm.com> --- Changes since v1 Requested by Marc Zyngier: * Get rid of ternary operator use in w

[PATCH v2 00/28] ARM Scalable Vector Extension (SVE)

2017-08-31 Thread Dave Martin
spadework, which are indirectly related to SVE. Dave Martin (5): regset: Add support for dynamically sized regsets arm64: KVM: Hide unsupported AArch64 CPU features from guests arm64: efi: Add missing Kconfig dependency on KERNEL_MODE_NEON arm64: Port deprecated instruction emulation to new

[RFC PATCH v2 27/28] arm64: signal: Report signal frame size to userspace via auxv

2017-08-31 Thread Dave Martin
s internal SIGFRAME_MAXSZ is supposed to sanity-check against generting frames that we consider _impossibly_ large. In this case, SIGSTKSZ is returned as a "reasonable guess that is at least bigger than MINSIGSTKSZ" and we WARN(). Signed-off-by: Dave Martin <dave.mar...@arm.com&

[PATCH v2 07/28] arm64/sve: Low-level SVE architectural state manipulation functions

2017-08-31 Thread Dave Martin
the vector length. Setting of the vector length is done as part of register restore. Since people building kernels may not all get an SVE-enabled toolchain for a while, this patch uses macros that generate explicit opcodes in place of assembler mnemonics. Signed-off-by: Dave Martin <dave.mar...@arm.

[PATCH v2 08/28] arm64/sve: Kconfig update and conditional compilation support

2017-08-31 Thread Dave Martin
in a later patch, once SVE support is complete enough to be enabled safely. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> --- arch/arm64/Kconfig | 11 +++ arch/arm64/include/asm/cpufeature.h | 5 + 2 f

[PATCH v2 11/28] arm64/sve: Core task context handling

2017-08-31 Thread Dave Martin
: this is an obvious slow path and a hint that we are running a new binary that may not use SVE. Code is added to sync data between thread.fpsimd_state and thread.sve_state whenever enabling/disabling SVE, in a manner consistent with the SVE architectural programmer's model. Signed-off-by: Dave Martin

[PATCH v2 15/28] arm64: cpufeature: Move sys_caps_initialised declarations

2017-08-31 Thread Dave Martin
booting a CPU so that it can be updated appropriately. This patch simply moves the sys_caps_initialised stuff to the top of the file so that it can be more widely. There doesn't seem to be a more obvious place to put it. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Suzuki K P

[PATCH v2 13/28] arm64/sve: Signal handling support

2017-08-31 Thread Dave Martin
of the SVE state, this flush is hoisted before the sigframe layout phase, so that the layout and population phases see a consistent view of the thread. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> Cc: Alex Bennée <alex.ben...@linaro.org

[PATCH v2 14/28] arm64/sve: Backend logic for setting the vector length

2017-08-31 Thread Dave Martin
that are not a power of two. To handle this, logic is added to check a requested vector length against a possibly sparse bitmap of available vector lengths at runtime, so that the best supported value can be chosen. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@l

[PATCH v2 10/28] arm64/sve: Low-level CPU setup

2017-08-31 Thread Dave Martin
set by ZCR_EL2.) In advance of full SVE support being implemented for userspace, it also necessary to ensure that SVE traps from EL0 are enabled. This patch makes the appropriate changes to the primary and secondary CPU initialisation code. Signed-off-by: Dave Martin <dave.mar...@arm.

[PATCH v2 12/28] arm64/sve: Support vector length resetting for new processes

2017-08-31 Thread Dave Martin
flag TIF_SVE_VL_INHERIT to control whether to inherit or reset the vector length. Currently these are inactive. Subsequent patches will provide the capability to configure them. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> --- Chan

[PATCH v2 21/28] arm64/sve: Add sysctl to set the default vector length for new processes

2017-08-31 Thread Dave Martin
existing process. The intended usage model is that if userspace is known to be fully SVE-tolerant (or a developer is curious to find out) then init scripts can crank this up during startup. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org>

[PATCH v2 23/28] arm64/sve: KVM: Treat guest SVE use as undefined instruction execution

2017-08-31 Thread Dave Martin
When trapping forbidden attempts by a guest to use SVE, we want the guest to see a trap consistent with SVE not being implemented. This patch injects an undefined instruction exception into the guest in response to such an exception. Signed-off-by: Dave Martin <dave.mar...@arm.com> ---

[RFC PATCH v2 28/28] arm64/sve: signal: Include SVE when computing AT_MINSIGSTKSZ

2017-08-31 Thread Dave Martin
vector length: this determines the maximum size of SVE context block that can be observed in any signal frame for the lifetime of the process. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> Cc: Alex Bennée <alex.ben...@linaro.org

[PATCH v2 20/28] arm64/sve: Add prctl controls for userspace vector length management

2017-08-31 Thread Dave Martin
instructions. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/include/asm/fpsimd.h| 14 arch/arm64/include/asm/processor.h | 4 arch/arm64/kernel/fpsimd.c | 46 ++ include/uapi/linux/prctl.h | 4

[PATCH v2 26/28] arm64/sve: Add documentation

2017-08-31 Thread Dave Martin
This patch adds basic documentation of the user/kernel interface provided by the for SVE. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> Cc: Mark Rutland <mark.rutl...@arm.com> --- Changes since v1 Requested by A

[PATCH v2 24/28] arm64/sve: KVM: Hide SVE from CPU features exposed to guests

2017-08-31 Thread Dave Martin
as reading as zero, which is consistent with SVE not being implemented. This is a temporary measure, and will be removed in a later series when full KVM support for SVE is implemented. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Marc Zyngier <marc.zyng...@arm.com> --- Chan

[PATCH v2 22/28] arm64/sve: KVM: Prevent guests from using SVE

2017-08-31 Thread Dave Martin
(). This should be fine, since cpu_pm_enter() is supposed to be called only with interrupts disabled. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Marc Zyngier <marc.zyng...@arm.com> Cc: Ard Biesheuvel <ard.biesheu...@linaro.org> --- Changes since v1 Request

[PATCH v2 16/28] arm64/sve: Probe SVE capabilities and usable vector lengths

2017-08-31 Thread Dave Martin
() remains hardwired to false. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> Cc: Suzuki K Poulose <suzuki.poul...@arm.com> --- Changes since v1 Requested by Alex Bennée: * Thin out BUG_ON()s: Redundant BUG_ON()s and on

[PATCH v2 25/28] arm64/sve: Detect SVE and activate runtime support

2017-08-31 Thread Dave Martin
running on hardware that supports SVE, this enables runtime kernel support for SVE, and allows user tasks to execute SVE instructions and make of the of the SVE-specific user/kernel interface extensions implemented by this series. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by:

[PATCH v2 17/28] arm64/sve: Preserve SVE registers around kernel-mode NEON use

2017-08-31 Thread Dave Martin
. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- arch/arm64/kernel/fpsimd.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index cea05a7..dd

[PATCH v2 19/28] arm64/sve: ptrace and ELF coredump support

2017-08-31 Thread Dave Martin
, which the recipient can use to figure out the content, size and layout of the reset of the regset. Accessor macros are defined to allow the vector-length-dependent parts of the regset to be manipulated. Signed-off-by: Alan Hayward <alan.hayw...@arm.com> Signed-off-by: Dave Martin <dave.mar..

[PATCH v2 18/28] arm64/sve: Preserve SVE registers around EFI runtime service calls

2017-08-31 Thread Dave Martin
must be saved and restored too. No attempt is made to restore the restore the vector length after a call, for now. It is deemed rather insane for EFI to change it, and contemporary EFI implementations certainly won't. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Ard Biesheuvel <ar

[PATCH v2 03/28] arm64: efi: Add missing Kconfig dependency on KERNEL_MODE_NEON

2017-08-31 Thread Dave Martin
dependency. This will aid bisection of the patches implementing support for the ARM Scalable Vector Extension (SVE). Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH v2 09/28] arm64/sve: Signal frame and context structure definition

2017-08-31 Thread Dave Martin
length, it is not possible to define a fixed C struct to describe all the registers. Instead, Macros are defined in sigcontext.h to facilitate access to the parts of the structure. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> --- Chan

[PATCH v2 04/28] arm64: Port deprecated instruction emulation to new sysctl interface

2017-08-31 Thread Dave Martin
rectories explicitly, which is ideal here. This patch ports register_insn_emulation_sysctl() over to the register_sysctl() interface and removes the redundant ctl_table for "abi". Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Alex Bennée <alex.ben...@lin

[PATCH v2 06/28] arm64/sve: System register and exception syndrome definitions

2017-08-31 Thread Dave Martin
The SVE architecture adds some system registers, ID register fields and a dedicated ESR exception class. This patch adds the appropriate definitions that will be needed by the kernel. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> --- Chan

[PATCH v2 05/28] arm64: fpsimd: Simplify uses of {set, clear}_ti_thread_flag()

2017-08-31 Thread Dave Martin
. This should have no impact on behaviour. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> Acked-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- arch/arm64/kernel/fpsimd.c | 6 ++ 1 file changed, 2 insertions(+), 4 deleti

Re: [PATCH v2 19/28] arm64/sve: ptrace and ELF coredump support

2017-09-08 Thread Dave Martin
On Thu, Sep 07, 2017 at 05:11:45AM +, Okamoto, Takayuki wrote: > Hi Dave, > > Thank you for your reply. > > > Your fix looks correct and seems to work. For stylistic reasons, I may > > write it like this instead, but the effect should be the same: > > > > header->max_vl = sve_max_vl; >

Re: [PATCH v2 19/28] arm64/sve: ptrace and ELF coredump support

2017-09-06 Thread Dave Martin
Your fix looks correct and seems to work. For stylistic reasons, I may write it like this instead, but the effect should be the same: header->max_vl = sve_max_vl; if (WARN_ON(!sve_vl_valid(sve_max_vl)) header->max_vl = header->vl; Cheers ---Dave > > > B

Re: [PATCH v2 14/28] arm64/sve: Backend logic for setting the vector length

2017-09-13 Thread Dave Martin
gt; > possibly sparse bitmap of available vector lengths at runtime, so > > that the best supported value can be chosen. > > > > Signed-off-by: Dave Martin <dave.mar...@arm.com> > > Cc: Alex Bennée <alex.ben...@linaro.org> > > Can this be merged with

Re: [PATCH v2 10/28] arm64/sve: Low-level CPU setup

2017-09-13 Thread Dave Martin
On Wed, Sep 13, 2017 at 06:32:06AM -0700, Catalin Marinas wrote: > On Thu, Aug 31, 2017 at 06:00:42PM +0100, Dave P Martin wrote: > > diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S > > index 877d42f..dd22ef2 100644 > > --- a/arch/arm64/mm/proc.S > > +++ b/arch/arm64/mm/proc.S > > @@

Re: [PATCH v2 11/28] arm64/sve: Core task context handling

2017-09-13 Thread Dave Martin
On Wed, Sep 13, 2017 at 10:26:05AM -0700, Catalin Marinas wrote: > On Thu, Aug 31, 2017 at 06:00:43PM +0100, Dave P Martin wrote: > > +el0_sve_acc: > > + /* > > +* Scalable Vector Extension access > > +*/ > > + enable_dbg > > + ct_user_exit > > + mov x0, x25 > > + mov x1,

Re: [PATCH v2 11/28] arm64/sve: Core task context handling

2017-09-14 Thread Dave Martin
On Wed, Sep 13, 2017 at 03:21:29PM -0700, Catalin Marinas wrote: > On Wed, Sep 13, 2017 at 08:17:07PM +0100, Dave P Martin wrote: > > On Wed, Sep 13, 2017 at 10:26:05AM -0700, Catalin Marinas wrote: > > > On Thu, Aug 31, 2017 at 06:00:43PM +0100, Dave P Martin wrote: > > > > +/* > > > > + *

Re: [PATCH v2 11/28] arm64/sve: Core task context handling

2017-09-14 Thread Dave Martin
On Wed, Sep 13, 2017 at 07:33:25AM -0700, Catalin Marinas wrote: > On Thu, Aug 31, 2017 at 06:00:43PM +0100, Dave P Martin wrote: > > +/* > > + * Handle SVE state across fork(): > > + * > > + * dst and src must not end up with aliases of the same sve_state. > > + * Because a task cannot fork

Re: [PATCH v2 02/28] arm64: KVM: Hide unsupported AArch64 CPU features from guests

2017-09-14 Thread Dave Martin
On Wed, Sep 13, 2017 at 03:37:42PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: [...] > > diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c > > index 945e79c..35a90b8 100644 > > --- a/arch/arm64/kvm/hyp/switch.

Re: [PATCH v2 09/28] arm64/sve: Signal frame and context structure definition

2017-09-13 Thread Dave Martin
On Wed, Sep 13, 2017 at 06:36:18AM -0700, Catalin Marinas wrote: > On Thu, Aug 31, 2017 at 06:00:41PM +0100, Dave P Martin wrote: > > +/* > > + * The SVE architecture leaves space for future expansion of the > > + * vector length beyond its initial architectural limit of 2048 bits > > + * (16

Re: [PATCH v2 14/28] arm64/sve: Backend logic for setting the vector length

2017-09-20 Thread Dave Martin
On Wed, Sep 20, 2017 at 10:59:55AM +, Alan Hayward wrote: > (Resending without disclaimer) > > > On 31 Aug 2017, at 18:00, Dave Martin <dave.mar...@arm.com> wrote: > > > > > +int sve_set_vector_length(struct task_struct *task, > > +

  1   2   >