Re: [PATCH v3 09/20] KVM: arm/arm64: mask/unmask daif around VHE guests

2017-10-11 Thread Marc Zyngier
Hi James, On Thu, Oct 05 2017 at 8:18:01 pm BST, James Morse wrote: > Non-VHE systems take an exception to EL2 in order to world-switch into the > guest. When returning from the guest KVM implicitly restores the DAIF > flags when it returns to the kernel at EL1. > > With VHE none of this excepti

Re: [PATCH v3 26/28] arm64/sve: Add documentation

2017-10-11 Thread Szabolcs Nagy
On 10/10/17 19:38, Dave Martin wrote: > This patch adds basic documentation of the user/kernel interface > provided by the for SVE. > > Signed-off-by: Dave Martin > Cc: Alex Bennée > Cc: Mark Rutland > Cc: Alan Hayward > > --- > > Changes since v2 > > > Changes requested by

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

2017-10-11 Thread Szabolcs Nagy
On 10/10/17 19:38, Dave Martin wrote: > Stateful CPU architecture extensions may require the signal frame > to grow to a size that exceeds the arch's MINSIGSTKSZ #define. > However, changing this #define is an ABI break. > > To allow userspace the option of determining the signal frame size > in a

Re: [PATCH v3 19/20] KVM: arm64: Handle RAS SErrors from EL2 on guest exit

2017-10-11 Thread Marc Zyngier
On Thu, Oct 05 2017 at 8:18:11 pm BST, James Morse wrote: > We expect to have firmware-first handling of RAS SErrors, with errors > notified via an APEI method. For systems without firmware-first, add > some minimal handling to KVM. > > There are two ways KVM can take an SError due to a guest, ei

Re: [PATCH v3 26/28] arm64/sve: Add documentation

2017-10-11 Thread Dave Martin
On Wed, Oct 11, 2017 at 10:50:16AM +0100, Szabolcs Nagy wrote: > On 10/10/17 19:38, Dave Martin wrote: > > This patch adds basic documentation of the user/kernel interface > > provided by the for SVE. > > > > Signed-off-by: Dave Martin > > Cc: Alex Bennée > > Cc: Mark Rutland > > Cc: Alan Haywa

Re: [PATCH v3 26/28] arm64/sve: Add documentation

2017-10-11 Thread Szabolcs Nagy
On 11/10/17 12:08, Dave Martin wrote: > How does this look: > looks reasonable. ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

[PATCH v2 3/3] arm64: Introduce command line parameter to disable CNP

2017-10-11 Thread Vladimir Murzin
There are cases when activating of Common Not Private (CNP) feature might not be desirable; this patch allows to forcefully disable CNP even it is supported by hardware. Signed-off-by: Vladimir Murzin --- Documentation/admin-guide/kernel-parameters.txt | 4 arch/arm64/kernel/cpufeature.c

[PATCH v2 0/3] Support Common Not Private translations

2017-10-11 Thread Vladimir Murzin
Common Not Private (CNP) translations is a feature of ARMv8.2 extension which allows translation table entries to be shared between different PEs in the same inner shareable domain, so the hardware can use this fact to optimise the caching of such entries in the TLB. This patch set is an attempt t

[PATCH v2 1/3] arm64: mm: Support Common Not Private translations

2017-10-11 Thread Vladimir Murzin
Common Not Private (CNP) is a feature of ARMv8.2 extension which allows translation table entries to be shared between different PEs in the same inner shareable domain, so the hardware can use this fact to optimise the caching of such entries in the TLB. CNP occupies one bit in TTBRx_ELy and VTTBR

[PATCH v2 2/3] arm64: KVM: Support Common Not Private translations

2017-10-11 Thread Vladimir Murzin
We rely on cpufeature framework to detect and enable CNP so for KVM we need to patch hyp to set CNP bit just before TTBR0_EL2 gets written. For the guest it is enough to update VTTBR_EL2 with CNP bit just before it gets scheduled. Signed-off-by: Vladimir Murzin --- arch/arm64/kvm/hyp-init.S |

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

2017-10-11 Thread Dave P Martin
On Wed, Oct 11, 2017 at 11:19:03AM +0100, Szabolcs Nagy wrote: > On 10/10/17 19:38, Dave Martin wrote: > > Stateful CPU architecture extensions may require the signal frame > > to grow to a size that exceeds the arch's MINSIGSTKSZ #define. > > However, changing this #define is an ABI break. > > >

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:18PM +0100, Dave P Martin wrote: > Currently the regset API doesn't allow for the possibility that > regsets (or at least, the amount of meaningful data in a regset) > may change in size. > > In particular, this results in useless padding being added to > coredumps in

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:19PM +0100, Dave P 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 features that are present in the > hardware but the host doesn't understan

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:20PM +0100, Dave P Martin wrote: > The EFI runtime services ABI permits calls to EFI to clobber > certain FPSIMD/NEON registers, as per the AArch64 procedure call > standard. > > Saving/restoring the clobbered registers around such calls needs > KERNEL_MODE_NEON, but

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:21PM +0100, Dave P Martin wrote: > Currently, armv8_deprected.c takes charge of the "abi" sysctl > directory, which makes life difficult for other code that wants to > register sysctls in the same directory. > > There is a "new" [1] sysctl registration interface that

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:22PM +0100, Dave P Martin wrote: > The existing FPSIMD context switch code contains a couple of > instances of {set,clear}_ti_thread(task_thread_info(task)). Since > there are thread flag manipulators that operate directly on > task_struct, this verbosity isn't strict

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:23PM +0100, Dave P Martin wrote: > 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 > Review

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:24PM +0100, Dave P Martin wrote: > Manipulating the SVE architectural state, including the vector and > predicate registers, first-fault register and the vector length, > requires the use of dedicated instructions added by SVE. > > This patch adds suitable assembly fu

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:25PM +0100, Dave P Martin wrote: > This patch adds CONFIG_ARM64_SVE to control building of SVE support > into the kernel, and adds a stub predicate system_supports_sve() to > control conditional compilation and runtime SVE support. > > system_supports_sve() just retur

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:26PM +0100, Dave P Martin wrote: > This patch defines the representation that will be used for the SVE > register state in the signal frame, and implements support for > saving and restoring the SVE registers around signals. > > The same layout will also be used for t

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:27PM +0100, Dave P Martin wrote: > To enable the kernel to use SVE, SVE traps from EL1 to EL2 must be > disabled. To take maximum advantage of the hardware, the full > available vector length also needs to be enabled for EL1 by > programming ZCR_EL2.LEN. (The kernel

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

2017-10-11 Thread Dave Martin
On Wed, Oct 11, 2017 at 03:16:47PM +0100, Catalin Marinas wrote: > On Tue, Oct 10, 2017 at 07:38:20PM +0100, Dave P Martin wrote: > > The EFI runtime services ABI permits calls to EFI to clobber > > certain FPSIMD/NEON registers, as per the AArch64 procedure call > > standard. > > > > Saving/resto

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

2017-10-11 Thread Dave Martin
On Wed, Oct 11, 2017 at 03:28:19PM +0100, Catalin Marinas wrote: > On Tue, Oct 10, 2017 at 07:38:24PM +0100, Dave P Martin wrote: > > Manipulating the SVE architectural state, including the vector and > > predicate registers, first-fault register and the vector length, > > requires the use of dedic

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

2017-10-11 Thread Dave Martin
On Wed, Oct 11, 2017 at 03:14:10PM +0100, Catalin Marinas wrote: > On Tue, Oct 10, 2017 at 07:38:18PM +0100, Dave P Martin wrote: > > Currently the regset API doesn't allow for the possibility that > > regsets (or at least, the amount of meaningful data in a regset) > > may change in size. > > > >

Re: [PATCH v3 09/20] KVM: arm/arm64: mask/unmask daif around VHE guests

2017-10-11 Thread James Morse
Hi Marc, On 11/10/17 10:01, Marc Zyngier wrote: > On Thu, Oct 05 2017 at 8:18:01 pm BST, James Morse > wrote: >> Non-VHE systems take an exception to EL2 in order to world-switch into the >> guest. When returning from the guest KVM implicitly restores the DAIF >> flags when it returns to the ke

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:28PM +0100, Dave P Martin wrote: > diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm/fpsimd.h > index 026a7c7..b1409de 100644 > --- a/arch/arm64/include/asm/fpsimd.h > +++ b/arch/arm64/include/asm/fpsimd.h > @@ -72,6 +75,20 @@ extern void sve_load_s

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:29PM +0100, Dave P Martin wrote: > 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 > processes may or may not be SVE-aware. > > This patch tracks the desired post-exec vector length

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

2017-10-11 Thread Marc Zyngier
[+ Christoffer] On 10/10/17 19:38, 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 features that are present in the > hardware but the host doesn't understand or doe

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

2017-10-11 Thread Marc Zyngier
[+ Christoffer] On 10/10/17 19:38, 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 the > traps are disabled again on exit from the guest so that the host > can still us

Re: [PATCH v3 01/20] arm64: explicitly mask all exceptions

2017-10-11 Thread Julien Thierry
Hi James, On 05/10/17 20:17, James Morse wrote: There are a few places where we want to mask all exceptions. Today we do this in a piecemeal fashion, typically we expect the caller to have masked irqs and the arch code masks debug exceptions, ignoring SError which is probably masked. Make it cl

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

2017-10-11 Thread Marc Zyngier
[+ Christoffer] On 10/10/17 19:38, 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 > ID_AA64PFR0_EL1 may legitimately expect that SVE works and try to > use it. Instead of worki

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:30PM +0100, Dave P Martin wrote: > diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c > index aabeaee..fa4ed34 100644 > --- a/arch/arm64/kernel/fpsimd.c > +++ b/arch/arm64/kernel/fpsimd.c > @@ -310,6 +310,32 @@ static void fpsimd_to_sve(struct task_st

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:31PM +0100, Dave P Martin wrote: > 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 prctl frontends that are implemented in later patches. > > The SVE architecture permits, but

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:32PM +0100, Dave P Martin wrote: > update_cpu_features() currently cannot tell whether it is being > called during early or late secondary boot. This doesn't > desperately matter for anything it currently does. > > However, SVE will need to know here whether the set

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

2017-10-11 Thread Catalin Marinas
On Tue, Oct 10, 2017 at 07:38:33PM +0100, Dave P Martin wrote: > This patch uses the cpufeatures framework to determine common SVE > capabilities and vector lengths, and configures the runtime SVE > support code appropriately. > > ZCR_ELx is not really a feature register, but it is convenient to >

Re: [PATCH v3 02/20] arm64: introduce an order for exceptions

2017-10-11 Thread Julien Thierry
On 05/10/17 20:17, James Morse wrote: Currently SError is always masked in the kernel. To support RAS exceptions using SError on hardware with the v8.2 RAS Extensions we need to unmask SError as much as possible. Let's define an order for masking and unmasking exceptions. 'dai' is memorable an

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

2017-10-11 Thread Suzuki K Poulose
On 10/10/17 19:38, Dave Martin wrote: This patch enables detection of hardware SVE support via the cpufeatures framework, and reports its presence to the kernel and userspace via the new ARM64_SVE cpucap and HWCAP_SVE hwcap respectively. Userspace can also detect SVE using ID_AA64PFR0_EL1, using

Re: [PATCH v3 08/20] arm64: entry.S: convert elX_irq

2017-10-11 Thread Julien Thierry
On 05/10/17 20:18, James Morse wrote: Following our 'dai' order, irqs should be processed with debug and serror exceptions unmasked. > Add a helper to unmask these two, (and fiq for good measure). Signed-off-by: James Morse --- arch/arm64/include/asm/assembler.h | 4 arch/arm64/kerne