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

2017-10-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:

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

2017-10-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&g

[PATCH v5 28/30] arm64/sve: Add documentation

2017-10-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> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Cc: Alan Hayward <alan.hayw...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.

[PATCH v5 20/30] arm64/sve: Preserve SVE registers around EFI runtime service calls

2017-10-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> Reviewed-by: Alex

[PATCH v5 26/30] arm64/sve: KVM: Hide SVE from CPU features exposed to guests

2017-10-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> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> Ac

[PATCH v5 11/30] arm64/sve: Signal frame and context structure definition

2017-10-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> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Cc:

[PATCH v5 13/30] arm64/sve: Core task context handling

2017-10-31 Thread Dave Martin
* fork and clone 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 <dave.mar...@arm.com> Reviewed-by: Catalin Marinas <catalin.mari...@ar

[PATCH v5 15/30] arm64/sve: Signal handling support

2017-10-31 Thread Dave Martin
fpsimd_signal_preserve_current_state() is added to update _both_ the FPSIMD and SVE views in the task struct, to make it easier to populate this information into the signal frame. Because of the redundancy between the two views of the state, only one is updated otherwise. Signed-off-by: Dave Martin <dave.mar...@arm.com&

[PATCH v5 16/30] arm64/sve: Backend logic for setting the vector length

2017-10-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> Reviewed-by: Catalin Marinas <cat

[PATCH v5 07/30] arm64: fpsimd: Simplify uses of {set, clear}_ti_thread_flag()

2017-10-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> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Ard Biesheuvel <ard.biesheu...@linaro.org> --- arch/arm64/kerne

[PATCH v5 14/30] arm64/sve: Support vector length resetting for new processes

2017-10-31 Thread Dave Martin
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> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> Reviewed-by: Cat

[PATCH v5 09/30] arm64/sve: Low-level SVE architectural state manipulation functions

2017-10-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 v5 21/30] arm64/sve: ptrace and ELF coredump support

2017-10-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 v5 22/30] arm64/sve: Add prctl controls for userspace vector length management

2017-10-31 Thread Dave Martin
instructions. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> --- **Dropped at v3** Reviewed-by: Alex Bennée <alex.ben...@linaro.org> See v3 posting for history. --- arch/arm64/incl

[PATCH v5 08/30] arm64/sve: System register and exception syndrome definitions

2017-10-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> Reviewed-by: Alex Bennée <alex.ben...@linaro.org&

[PATCH v5 17/30] arm64: cpufeature: Move sys_caps_initialised declarations

2017-10-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 used more widely. There doesn't seem to be a more obvious place to put it. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Alex

[PATCH v5 19/30] arm64/sve: Preserve SVE registers around kernel-mode NEON use

2017-10-31 Thread Dave Martin
. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Ard Biesheuvel <ard.biesheu...@linaro.org> Reviewed-by: Alex Bennée <alex.ben...@linaro.org> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/kernel/fpsimd.c | 6 -- 1 file changed, 4 in

[PATCH v5 10/30] arm64/sve: Kconfig update and conditional compilation support

2017-10-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> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/Kconfig | 11 +

[PATCH v5 12/30] arm64/sve: Low-level CPU setup

2017-10-31 Thread Dave Martin
the limit set by ZCR_EL2.) This patch makes the appropriate changes to the EL2 early setup code. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Cc: Alex Bennée <alex.ben...@linaro.org> --- **Dropped at v3** Reviewed-by: Ale

[PATCH v5 03/30] arm64: signal: Verify extra data is user-readable in sys_rt_sigreturn

2017-10-31 Thread Dave Martin
the potential for future surprises, this patch does an explicit access_ok() check on the extra data space when parsing an extra_context record. Fixes: 33f082614c34 ("arm64: signal: Allow expansion of the signal frame") Signed-off-by: Dave Martin <dave.mar...@arm.com> --- a

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

2017-10-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> Reviewed-by: Catalin Marinas <catalin.mari...@arm.com> Cc: Oleg Nesterov <o...@redhat.com> Cc: Alexander Viro <v...@zeniv.linux.org.uk> Cc: Thoma

[PATCH v5 05/30] arm64: efi: Add missing Kconfig dependency on KERNEL_MODE_NEON

2017-10-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> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Cc: Ard Biesh

[PATCH v5 04/30] arm64: KVM: Hide unsupported AArch64 CPU features from guests

2017-10-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> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Cc: Christoffer Dall <christoffer.d...@linaro

[PATCH v5 06/30] arm64: Port deprecated instruction emulation to new sysctl interface

2017-10-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...@l

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

2017-10-31 Thread Dave Martin
git://linux-arm.org/linux-dm.git sve/v4+fixes Dave Martin (30): regset: Add support for dynamically sized regsets arm64: fpsimd: Correctly annotate exception helpers called from asm arm64: signal: Verify extra data is user-readable in sys_rt_sigreturn arm64: KVM: Hide unsupported AA

[PATCH v5 02/30] arm64: fpsimd: Correctly annotate exception helpers called from asm

2017-10-31 Thread Dave Martin
asmlinkage annotations for do_fpsimd_acc() and do_fpsimd_exc(). Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/fpsimd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 5d547de..e85

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

2017-10-28 Thread Dave Martin
On Fri, Oct 27, 2017 at 06:52:50PM +0100, Alex Bennée wrote: > > Dave Martin <dave.mar...@arm.com> writes: > > > This patch adds two arm64-specific prctls, to permit userspace to > > control its vector length: > > > > * PR_SVE_SET_VL: set the thread's SVE

[PATCH v5 00/14] KVM: arm64: Optimise FPSIMD context switching

2018-05-04 Thread Dave Martin
kvm_arch_vcpu_run_pid_change Dave Martin (13): thread_info: Add update_thread_flag() helpers arm64: Use update{,_tsk}_thread_flag() KVM: arm64: Convert lazy FPSIMD context switch trap to C arm64: fpsimd: Generalise context saving for non-task contexts KVM: arm64: Optimise FPSIMD handling

[PATCH v5 07/14] arm64/sve: Move read_zcr_features() out of cpufeature.h

2018-05-04 Thread Dave Martin
. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/include/asm/cpufeature.h | 29 - arch/arm64/include/asm/fpsimd.h | 2 ++ arch/arm64/include/asm/processor.h

[PATCH v5 06/14] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-04 Thread Dave Martin
t's system registers. To avoid ABI churn, the redundant storage space in host_cpu_context is not removed for now. arch/arm is not addressed by this patch and continues to use its current save/restore logic. It could provide implementations of the helpers later if desired. Signed-off-by: Dave Martin

[PATCH v5 09/14] arm64/sve: Move sve_pffr() to fpsimd.h and make inline

2018-05-04 Thread Dave Martin
definitions. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/include/asm/fpsimd.h| 13 + arch/arm64/include/asm/processor.h | 3 ++- arch/arm64/kernel/fpsimd.c | 12 -

[PATCH v5 10/14] KVM: arm64: Save host SVE context as appropriate

2018-05-04 Thread Dave Martin
and refuses to create a VM. Doing this check at VM creation time avoids race issues between KVM and SVE initialisation. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Christoffer Dall <christoffer.d...@arm.com> --- arch/arm64/Kconfig | 7 +++ arch/arm64/

[PATCH v5 12/14] KVM: arm64: Remove redundant *exit_code changes in fpsimd_guest_exit()

2018-05-04 Thread Dave Martin
if- nesting that becomes trivial as a result. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kvm/hyp/switch.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c

[PATCH v5 13/14] KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()

2018-05-04 Thread Dave Martin
uif_trap and vgic_v3_cpuif_trap true simultaneously unless we have a GICv3 and GICv2 on the host: that sounds stupid, but I haven't satisfied myself that it can't happen. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kvm/hyp/switch.c | 11 +++ 1 file changed

[PATCH v5 14/14] KVM: arm64: Invoke FPSIMD context switch trap from C

2018-05-04 Thread Dave Martin
, but this allows it to be tail-called with a single return statement. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kvm/hyp/entry.S | 30 -- arch/arm64/kvm/hyp/hyp-entry.S | 19 --- arch/arm64/kvm/hyp/switch.c| 15 +-- 3

[PATCH v5 11/14] KVM: arm64: Remove eager host SVE state saving

2018-05-04 Thread Dave Martin
, the function and its dependencies are also deleted. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Christoffer Dall <christoffer.d...@arm.com> --- arch/arm/include/asm/kvm_host.h | 3 --- arch/arm64/include/asm/kvm_host.h | 10 -- arch/arm64/kernel/fpsimd.c

[PATCH v5 05/14] arm64: fpsimd: Generalise context saving for non-task contexts

2018-05-04 Thread Dave Martin
storage for the loaded context. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- New patch since RFC v4: (Split from KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing, with no functional change.) Changes since RFC v4: * task_fpsimd_save() r

[PATCH v5 02/14] arm64: Use update{,_tsk}_thread_flag()

2018-05-04 Thread Dave Martin
This patch uses the new update_thread_flag() helpers to simplify a couple of if () set; else clear; constructs. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Catalin Marinas <catalin.mari...@arm.com> Cc: Will Deacon <will.dea...@arm.com> ---

[PATCH v5 04/14] KVM: arm64: Convert lazy FPSIMD context switch trap to C

2018-05-04 Thread Dave Martin
To make the lazy FPSIMD context switch trap code easier to hack on, this patch converts it to C. This is not amazingly efficient, but the trap should typically only be taken once per host context switch. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- Changes since RFCv4:

[PATCH v5 03/14] KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change

2018-05-04 Thread Dave Martin
; Signed-off-by: Dave Martin <dave.mar...@arm.com> --- Changes since RFCv4: Back out the arm64 implementation of the new hook, which is replaced by a subsequent patch (and not useful before that patch). --- include/linux/kvm_host.h | 9 + virt/kvm/Kconfig | 3 +++ virt/kvm/k

[PATCH v5 01/14] thread_info: Add update_thread_flag() helpers

2018-05-04 Thread Dave Martin
, cond) which do the equivalent of: if (cond) set*_thread_flag([...,] flag); else clear*_thread_flag([...,] flag); Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Ingo Molnar <mi...@redhat.com> Cc: Peter Zijlstra <pet...@infradead.

[PATCH v5 08/14] arm64/sve: Switch sve_pffr() argument from task to thread

2018-05-04 Thread Dave Martin
in preparation for moving this function to a header, where we do not want to have to include due to the consequent circular #include problems. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/kernel/f

Re: [PATCH v6 07/15] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 10:46:11AM +0100, Marc Zyngier wrote: > On 09/05/18 10:17, Dave Martin wrote: > > On Wed, May 09, 2018 at 09:24:36AM +0100, Marc Zyngier wrote: > >> On 08/05/18 17:44, Dave Martin wrote: > >>> This patch refactors KVM to align the host and g

Re: [PATCH v6 11/15] KVM: arm64: Save host SVE context as appropriate

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 09:50:26AM +0100, Marc Zyngier wrote: > On 08/05/18 17:44, Dave Martin wrote: > > This patch adds SVE context saving to the hyp FPSIMD context switch > > path. This means that it is no longer necessary to save the host > > SVE state in advance of ent

Re: [PATCH v6 07/15] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 09:24:36AM +0100, Marc Zyngier wrote: > On 08/05/18 17:44, Dave Martin wrote: > > This patch refactors KVM to align the host and guest FPSIMD > > save/restore logic with each other for arm64. This reduces the [...] > > diff --git a/arch/arm64/include

Re: [PATCH v5 06/14] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-08 Thread Dave Martin
On Tue, May 08, 2018 at 10:58:04AM +0100, Marc Zyngier wrote: > On 04/05/18 17:05, Dave Martin wrote: > > This patch refactors KVM to align the host and guest FPSIMD > > save/restore logic with each other for arm64. This reduces the > > number of redundant save/restore opera

[PATCH v7 08/16] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-09 Thread Dave Martin
t's system registers. To avoid ABI churn, the redundant storage space in host_cpu_context is not removed for now. arch/arm is not addressed by this patch and continues to use its current save/restore logic. It could provide implementations of the helpers later if desired. Signed-off-by: D

[PATCH v7 06/16] arm64/sve: Refactor user SVE trap maintenance for external use

2018-05-09 Thread Dave Martin
I consider this a reasonable price to pay for a slightly cleaner interface. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/arm64/kernel/fpsimd.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kerne

[PATCH v7 07/16] KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags

2018-05-09 Thread Dave Martin
gets rid of that too. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- Changes since v6: * Move vcpu_arch flags definitions to kvm_host.h. These are not used from asm any more, so it makes sense for them to be

[PATCH v7 09/16] arm64/sve: Move read_zcr_features() out of cpufeature.h

2018-05-09 Thread Dave Martin
. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/include/asm/cpufeature.h | 29 - arch/arm64/include/asm/fpsimd.h

[PATCH v7 10/16] arm64/sve: Switch sve_pffr() argument from task to thread

2018-05-09 Thread Dave Martin
in preparation for moving this function to a header, where we do not want to have to include due to the consequent circular #include problems. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Marc Zyngier <marc.

[PATCH v7 11/16] arm64/sve: Move sve_pffr() to fpsimd.h and make inline

2018-05-09 Thread Dave Martin
definitions. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/include/asm/fpsimd.h| 13 + arch/arm64/include/asm/processor.h | 3 ++-

[PATCH v7 12/16] KVM: arm64: Save host SVE context as appropriate

2018-05-09 Thread Dave Martin
then KVM will be disabled. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Christoffer Dall <christoffer.d...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/Kconfig | 7 +++ arch/arm64/kvm/fpsimd.c | 1 - arch/arm64/kvm

[PATCH v7 15/16] KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()

2018-05-09 Thread Dave Martin
uif_trap and vgic_v3_cpuif_trap true simultaneously unless we have a GICv3 and GICv2 on the host: that sounds stupid, but I haven't satisfied myself that it can't happen. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/ar

[PATCH v7 00/16] KVM: arm64: Optimise FPSIMD context switching

2018-05-09 Thread Dave Martin
/2018-May/thread.html Christoffer Dall (1): KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave Martin (15): thread_info: Add update_thread_flag() helpers arm64: Use update{,_tsk}_thread_flag() KVM: arm64: Convert lazy FPSIMD context switch trap to C arm64: fpsimd: Generalise

[PATCH v7 05/16] arm64: fpsimd: Generalise context saving for non-task contexts

2018-05-09 Thread Dave Martin
storage for the loaded context. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/kernel/fpsimd.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/arm64/ker

[PATCH v7 04/16] KVM: arm64: Convert lazy FPSIMD context switch trap to C

2018-05-09 Thread Dave Martin
To make the lazy FPSIMD context switch trap code easier to hack on, this patch converts it to C. This is not amazingly efficient, but the trap should typically only be taken once per host context switch. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <

[PATCH v7 01/16] thread_info: Add update_thread_flag() helpers

2018-05-09 Thread Dave Martin
, cond) which do the equivalent of: if (cond) set*_thread_flag([...,] flag); else clear*_thread_flag([...,] flag); Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Steven Rostedt (VMware) <rost...@goodmis.org> Acked-by:

[PATCH v7 03/16] KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change

2018-05-09 Thread Dave Martin
; Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- include/linux/kvm_host.h | 9 + virt/kvm/Kconfig | 3 +++ virt/kvm/kvm_main.c | 7 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/li

[PATCH v7 02/16] arm64: Use update{,_tsk}_thread_flag()

2018-05-09 Thread Dave Martin
This patch uses the new update_thread_flag() helpers to simplify a couple of if () set; else clear; constructs. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> Cc: Catalin Marinas <catalin.mari...@arm.com&g

[PATCH v7 13/16] KVM: arm64: Remove eager host SVE state saving

2018-05-09 Thread Dave Martin
, the function and its dependencies are also deleted. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Christoffer Dall <christoffer.d...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm/include/asm/kvm_host.h | 3 --- arch/arm64/include/a

[PATCH v7 14/16] KVM: arm64: Remove redundant *exit_code changes in fpsimd_guest_exit()

2018-05-09 Thread Dave Martin
if-nesting that becomes trivial as a result. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/kvm/hyp/switch.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/a

[PATCH v7 16/16] KVM: arm64: Invoke FPSIMD context switch trap from C

2018-05-09 Thread Dave Martin
, but this allows it to be tail-called with a single return statement. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/kvm/hyp/entry.S | 30 -- arch/arm64/kvm/hyp/hyp-entry.S | 19 --- ar

Re: [PATCH v7 06/16] arm64/sve: Refactor user SVE trap maintenance for external use

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 05:36:30PM +0100, Marc Zyngier wrote: > On 09/05/18 17:12, Dave Martin wrote: > > In preparation for optimising the way KVM manages switching the > > guest and host FPSIMD state, it is necessary to provide a means for > > code outside arch/arm64/kerne

Re: [PATCH v7 02/16] arm64: Use update{,_tsk}_thread_flag()

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 05:17:28PM +0100, Will Deacon wrote: > Hi Dave, > > On Wed, May 09, 2018 at 05:12:51PM +0100, Dave Martin wrote: > > This patch uses the new update_thread_flag() helpers to simplify a > > couple of if () set; else clear; constructs. > >

Re: [PATCH v7 08/16] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 05:54:25PM +0100, Marc Zyngier wrote: > On 09/05/18 17:12, Dave Martin wrote: > > This patch refactors KVM to align the host and guest FPSIMD > > save/restore logic with each other for arm64. This reduces the > > number of redundant save/restore opera

Re: [PATCH v7 02/16] arm64: Use update{,_tsk}_thread_flag()

2018-05-09 Thread Dave Martin
On Wed, May 09, 2018 at 05:55:51PM +0100, Marc Zyngier wrote: > On 09/05/18 17:27, Dave Martin wrote: > > On Wed, May 09, 2018 at 05:17:28PM +0100, Will Deacon wrote: > >> Hi Dave, > >> > >> On Wed, May 09, 2018 at 05:12:51PM +0100, Dave Martin

Re: [PATCH v5 13/14] KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()

2018-05-08 Thread Dave Martin
On Tue, May 08, 2018 at 11:59:25AM +0100, Marc Zyngier wrote: > On 04/05/18 17:05, Dave Martin wrote: > > The entire tail of fixup_guest_exit() is contained in if statements > > of the form if (x && *exit_code == ARM_EXCEPTION_TRAP). As a result, > > we can

Re: [PATCH v5 10/14] KVM: arm64: Save host SVE context as appropriate

2018-05-08 Thread Dave Martin
On Tue, May 08, 2018 at 11:38:05AM +0100, Marc Zyngier wrote: > On 04/05/18 17:05, Dave Martin wrote: > > This patch adds SVE context saving to the hyp FPSIMD context switch > > path. This means that it is no longer necessary to save the host > > SVE state in advance of ent

Re: [PATCH v5 13/14] KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()

2018-05-08 Thread Dave Martin
On Tue, May 08, 2018 at 12:59:39PM +0100, Marc Zyngier wrote: > On 08/05/18 12:30, Dave Martin wrote: > > On Tue, May 08, 2018 at 11:59:25AM +0100, Marc Zyngier wrote: > >> On 04/05/18 17:05, Dave Martin wrote: [...] > >>> diff --git a/arch/arm64/kvm/hyp/switch.c

Re: [PATCH v5 10/14] KVM: arm64: Save host SVE context as appropriate

2018-05-08 Thread Dave Martin
On Tue, May 08, 2018 at 12:57:56PM +0100, Marc Zyngier wrote: > On 08/05/18 12:25, Dave Martin wrote: > > On Tue, May 08, 2018 at 11:38:05AM +0100, Marc Zyngier wrote: > >> On 04/05/18 17:05, Dave Martin wrote: > >>> This patch adds SVE context saving to the hyp FP

[PATCH v6 00/15] KVM: arm64: Optimise FPSIMD context switching

2018-05-08 Thread Dave Martin
] [RFC PATCH 0/6] Simplify setting thread flags to a particular value https://lkml.org/lkml/2018/4/19/225 [3] linux-arm-kernel archive http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/thread.html Christoffer Dall (1): KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave

[PATCH v6 07/15] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-08 Thread Dave Martin
t's system registers. To avoid ABI churn, the redundant storage space in host_cpu_context is not removed for now. arch/arm is not addressed by this patch and continues to use its current save/restore logic. It could provide implementations of the helpers later if desired. Signed-off-by: D

[PATCH v6 08/15] arm64/sve: Move read_zcr_features() out of cpufeature.h

2018-05-08 Thread Dave Martin
. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/include/asm/cpufeature.h | 29 - arch/arm64/include/asm/fpsimd.h | 2 ++ arch/arm64/include/asm/processor.h

[PATCH v6 10/15] arm64/sve: Move sve_pffr() to fpsimd.h and make inline

2018-05-08 Thread Dave Martin
definitions. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/include/asm/fpsimd.h| 13 + arch/arm64/include/asm/processor.h | 3 ++- arch/arm64/kernel/fpsimd.c | 12 -

[PATCH v6 09/15] arm64/sve: Switch sve_pffr() argument from task to thread

2018-05-08 Thread Dave Martin
in preparation for moving this function to a header, where we do not want to have to include due to the consequent circular #include problems. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> --- arch/arm64/kernel/f

[PATCH v6 02/15] arm64: Use update{,_tsk}_thread_flag()

2018-05-08 Thread Dave Martin
This patch uses the new update_thread_flag() helpers to simplify a couple of if () set; else clear; constructs. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Catalin Marinas <catalin.mari...@arm.com> Cc: Will Deacon <will.dea...@arm.com> ---

[PATCH v6 04/15] KVM: arm64: Convert lazy FPSIMD context switch trap to C

2018-05-08 Thread Dave Martin
To make the lazy FPSIMD context switch trap code easier to hack on, this patch converts it to C. This is not amazingly efficient, but the trap should typically only be taken once per host context switch. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <

[PATCH v6 03/15] KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change

2018-05-08 Thread Dave Martin
; Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- include/linux/kvm_host.h | 9 + virt/kvm/Kconfig | 3 +++ virt/kvm/kvm_main.c | 7 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/li

[PATCH v6 01/15] thread_info: Add update_thread_flag() helpers

2018-05-08 Thread Dave Martin
, cond) which do the equivalent of: if (cond) set*_thread_flag([...,] flag); else clear*_thread_flag([...,] flag); Signed-off-by: Dave Martin <dave.mar...@arm.com> Cc: Ingo Molnar <mi...@redhat.com> Cc: Peter Zijlstra <pet...@infradead.

[PATCH v6 14/15] KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()

2018-05-08 Thread Dave Martin
uif_trap and vgic_v3_cpuif_trap true simultaneously unless we have a GICv3 and GICv2 on the host: that sounds stupid, but I haven't satisfied myself that it can't happen. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- Changes since v5: Requested by Marc Zyngier: * M

[PATCH v6 15/15] KVM: arm64: Invoke FPSIMD context switch trap from C

2018-05-08 Thread Dave Martin
, but this allows it to be tail-called with a single return statement. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/kvm/hyp/entry.S | 30 -- arch/arm64/kvm/hyp/hyp-entry.S | 19 --- ar

[PATCH v6 05/15] arm64: fpsimd: Generalise context saving for non-task contexts

2018-05-08 Thread Dave Martin
storage for the loaded context. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/kernel/fpsimd.c | 25 + 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/arch/arm64/ker

[PATCH v6 06/15] KVM: arm64: Repurpose vcpu_arch.debug_flags for general-purpose flags

2018-05-08 Thread Dave Martin
flag defined so far, there is plenty of free space for expansion. In preparation for adding more flags, this patch renames the debug_flags field to simply "flags", and updates comments appropriately. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> --- arch/a

[PATCH v6 11/15] KVM: arm64: Save host SVE context as appropriate

2018-05-08 Thread Dave Martin
and refuses to create a VM. Doing this check at VM creation time avoids race issues between KVM and SVE initialisation. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Christoffer Dall <christoffer.d...@arm.com> --- Changes since v5: Requested by Marc Zyngier: * Migrate

[PATCH v6 13/15] KVM: arm64: Remove redundant *exit_code changes in fpsimd_guest_exit()

2018-05-08 Thread Dave Martin
if- nesting that becomes trivial as a result. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/kvm/hyp/switch.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/arch/a

[PATCH v6 12/15] KVM: arm64: Remove eager host SVE state saving

2018-05-08 Thread Dave Martin
, the function and its dependencies are also deleted. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Christoffer Dall <christoffer.d...@arm.com> --- arch/arm/include/asm/kvm_host.h | 3 --- arch/arm64/include/asm/kvm_host.h | 10 -- arch/arm64/kernel/fpsimd.c

Re: [PATCH v7 08/16] KVM: arm64: Optimise FPSIMD handling to reduce guest/host thrashing

2018-05-15 Thread Dave Martin
On Tue, May 15, 2018 at 12:55:23PM +0200, Christoffer Dall wrote: > On Wed, May 09, 2018 at 05:12:57PM +0100, Dave Martin wrote: > > This patch refactors KVM to align the host and guest FPSIMD > > save/restore logic with each other for arm64. This reduces the > > number of r

[PULL v8] KVM: arm64: Optimise FPSIMD context switching

2018-05-16 Thread Dave Martin
): KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave Martin (15): thread_info: Add update_thread_flag() helpers arm64: Use update{,_tsk}_thread_flag() KVM: arm64: Convert lazy FPSIMD context switch trap to C arm64: fpsimd: Generalise context saving for non-task

Re: [PATCH] arm64: KVM: reduce guest fpsimd trap

2018-05-16 Thread Dave Martin
On Wed, May 16, 2018 at 10:25:40AM +0100, Marc Zyngier wrote: > [+Dave] > > Hi Nianyao, > > On 16/05/18 10:08, Tangnianyao (ICT) wrote: > > Add last_fpsimd_trap to notify if guest last exit reason is handling > > fpsimd. If guest is using fpsimd frequently, save host's fpsimd state and > >

[PATCH v9 03/16] KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change

2018-05-21 Thread Dave Martin
; Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- include/linux/kvm_host.h | 9 + virt/kvm/Kconfig | 3 +++ virt/kvm/kvm_main.c | 7 ++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/include/li

[PATCH v9 04/16] KVM: arm64: Convert lazy FPSIMD context switch trap to C

2018-05-21 Thread Dave Martin
To make the lazy FPSIMD context switch trap code easier to hack on, this patch converts it to C. This is not amazingly efficient, but the trap should typically only be taken once per host context switch. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <

[PATCH v9 02/16] arm64: Use update{,_tsk}_thread_flag()

2018-05-21 Thread Dave Martin
This patch uses the new update_thread_flag() helpers to simplify a couple of if () set; else clear; constructs. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com&g

[PATCH v9 10/16] arm64/sve: Switch sve_pffr() argument from task to thread

2018-05-21 Thread Dave Martin
in preparation for moving this function to a header, where we do not want to have to include due to the consequent circular #include problems. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Marc Zyngier <marc.

[PATCH v9 11/16] arm64/sve: Move sve_pffr() to fpsimd.h and make inline

2018-05-21 Thread Dave Martin
definitions. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/include/asm/fpsimd.h| 13 + arch/arm64/include/asm/processor.h | 3 ++-

[PATCH v9 09/16] arm64/sve: Move read_zcr_features() out of cpufeature.h

2018-05-21 Thread Dave Martin
. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Acked-by: Catalin Marinas <catalin.mari...@arm.com> Acked-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/arm64/include/asm/cpufeature.h | 29 - arch/arm64/include/asm/fpsimd.h

[PATCH v9 00/16] KVM: arm64: Optimise FPSIMD context switching

2018-05-21 Thread Dave Martin
context switching http://lists.infradead.org/pipermail/linux-arm-kernel/2018-May/579353.html Christoffer Dall (1): KVM: arm/arm64: Introduce kvm_arch_vcpu_run_pid_change Dave Martin (15): thread_info: Add update_thread_flag() helpers arm64: Use update{,_tsk}_thread_flag() KVM: arm64: Convert

[PATCH v9 15/16] KVM: arm64: Fold redundant exit code checks out of fixup_guest_exit()

2018-05-21 Thread Dave Martin
uif_trap and vgic_v3_cpuif_trap true simultaneously unless we have a GICv3 and GICv2 on the host: that sounds stupid, but I haven't satisfied myself that it can't happen. No functional change. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> --- arch/ar

[PATCH v9 16/16] KVM: arm64: Invoke FPSIMD context switch trap from C

2018-05-21 Thread Dave Martin
, but this allows it to be tail-called with a single return statement. Signed-off-by: Dave Martin <dave.mar...@arm.com> Reviewed-by: Marc Zyngier <marc.zyng...@arm.com> Reviewed-by: Christoffer Dall <christoffer.d...@arm.com> --- arch/arm64/kvm/hyp/entry.S | 30

Re: [PATCH v9 12/16] KVM: arm64: Save host SVE context as appropriate

2018-05-21 Thread Dave Martin
On Mon, May 21, 2018 at 03:40:02PM +0100, Marc Zyngier wrote: > On 21/05/18 15:17, Dave Martin wrote: > > This patch adds SVE context saving to the hyp FPSIMD context switch > > path. This means that it is no longer necessary to save the host > > SVE state in advance of ent

<    1   2   3   4   5   6   7   8   9   10   >