Re: [PATCH 2/2] KVM: arm64: Remove use of ARM64_FEATURE_MASK()

2022-12-22 Thread Mark Brown
On Thu, Dec 22, 2022 at 12:23:49PM +, Marc Zyngier wrote: > Mark Brown wrote: > > the users to directly use the generated mask macros, writing > > > > #define ARM64_FEATURE_MASK(x) (x##_MASK) > > > > obviously looks redundant and if we look at the us

Re: [PATCH v4 2/7] arm64/sysreg: Convert CCSIDR_EL1 to automatic generation

2022-12-22 Thread Mark Brown
ong with improving the tooling: Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

[PATCH 2/2] KVM: arm64: Remove use of ARM64_FEATURE_MASK()

2022-12-21 Thread Mark Brown
st remove the users. This is a relatively large code change but very mechanical. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/sysreg.h| 3 - arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 106 - arch/arm64/kvm/hyp/nv

[PATCH 1/2] KVM: arm64: Convert non-GIC code to SYS_FIELD_{GET,PREP}

2022-12-21 Thread Mark Brown
these where the registers have already been converted, the remaining uses are in the GIC code and will need conversions of the GIC registers. No functional changes. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 14 - arch/arm64/kvm/hyp/nvhe/pkvm.c

[PATCH 0/2] KVM: arm64: syreg cleanups/fixes

2022-12-21 Thread Mark Brown
once that appears. To: Marc Zyngier To: James Morse To: Alexandru Elisei To: Suzuki K Poulose To: Oliver Upton To: Catalin Marinas To: Will Deacon Cc: linux-arm-ker...@lists.infradead.org Cc: kvm...@lists.linux.dev Cc: kvmarm@lists.cs.columbia.edu Cc: linux-ker...@vger.kernel.org Signed-off-by

Re: [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out

2022-12-21 Thread Mark Brown
; Synchronization is needed before reading SVCR later in > > fpsimd_save, or it may cause sync exception which can not be > > handled by host. Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing

Re: [PATCH v3 1/7] arm64/sysreg: Convert CCSIDR_EL1 to automatic generation

2022-12-19 Thread Mark Brown
On Mon, Dec 19, 2022 at 03:27:17PM +, Marc Zyngier wrote: > Mark Brown wrote: > > fully represent everything in the spec yet. For things like the > > registers with multiple possible views it's much more effort which > > shouldn't get in the way of progress

Re: [PATCH v3 2/7] arm64/sysreg: Add CCSIDR2_EL1

2022-12-19 Thread Mark Brown
On Sun, Dec 18, 2022 at 02:14:07PM +0900, Akihiko Odaki wrote: > CCSIDR2_EL1 was added with FEAT_CCIDX. > > Signed-off-by: Akihiko Odaki Reviewed-by: Mark Brown This matches DDI0487I.a. signature.asc Description: PGP signature ___ kvmar

Re: [PATCH v3 1/7] arm64/sysreg: Convert CCSIDR_EL1 to automatic generation

2022-12-19 Thread Mark Brown
pted to spell out Unknown fully since Unkn is not such a common abbreviation but I can see the desire to keep the name shorter and it doesn't really matter so either way: Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvma

Re: [PATCH 1/3] arm64/sysreg: Add CCSIDR2_EL1

2022-12-19 Thread Mark Brown
On Mon, Dec 19, 2022 at 02:47:25PM +, Marc Zyngier wrote: > Since you're reviewing some of this, please have a look at v3[1], > which outlined a limitation of the sysreg generation tool as well > as a potential fix. Hrm, would've been nice to be CCed on stuff for the tool :/ signature.asc D

Re: [PATCH 1/3] arm64/sysreg: Add CCSIDR2_EL1

2022-12-19 Thread Mark Brown
On Sun, Dec 11, 2022 at 02:16:58PM +0900, Akihiko Odaki wrote: > CCSIDR2_EL1 was added with FEAT_CCIDX. This corresponds to the definition in DDI0487I.a. Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list kvm

Re: [PATCH v14 16/39] arm64/sme: Implement traps and syscall handling for SME

2022-12-07 Thread Mark Brown
On Wed, Dec 07, 2022 at 10:00:17PM +0800, Zenghui Yu wrote: > On 2022/4/19 19:22, Mark Brown wrote: > > + /* > > +* If SME is active then exit streaming mode. If ZA is active > > +* then flush the SVE registers but leave userspace access to > > +

Re: [GIT PULL] KVM/arm64 updates for 6.2

2022-12-06 Thread Mark Brown
On Tue, Dec 06, 2022 at 06:10:32PM +, Sean Christopherson wrote: > Alternatively, we could have a dedicated selftests/kvm tree (or branch)? > I almost suggested doing that on multiple occasions this cycle, but ultimately > decided not to because it would effectively mean splitting series that

Re: [PATCH v3 3/8] arm64/sysreg: Convert SPE registers to automatic generation

2022-11-07 Thread Mark Brown
t as the automatic generation > has no way to create multiple names for the same register bits. The > meaning of the MSS field depends on other bits. Reviewed-by: Mark Brown > +Sysreg PMSNEVFR_EL13 0 9 9 1 > +Field63:0E > +EndSysreg JFTR as n

Re: [PATCH v2 3/7] arm64/sysreg: Convert SPE registers to automatic generation

2022-10-21 Thread Mark Brown
On Thu, Oct 20, 2022 at 02:51:02PM -0500, Rob Herring wrote: > On Thu, Oct 20, 2022 at 9:33 AM Mark Brown wrote: > > > +Field11:8EA > > This looks like it should be described as an enum. > 0bNot_Described > 0b0001Ignored > 0b0

Re: [PATCH v2 3/7] arm64/sysreg: Convert SPE registers to automatic generation

2022-10-20 Thread Mark Brown
On Wed, Oct 19, 2022 at 02:11:26PM -0500, Rob Herring wrote: > Convert all the SPE register defines to automatic generation. No > functional changes. > > New registers and fields for SPEv1.2 are added with the conversion. > > Some of the PMBSR MSS field defines are kept as the automatic generatio

Re: [PATCH v3 3/7] arm64/fpsimd: Have KVM explicitly say which FP registers to save

2022-09-22 Thread Mark Brown
On Wed, Sep 21, 2022 at 06:47:21PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > It means that using FP_STATE_TASK as a value for the fp_type > > member of the task struck recording what type of state is > > currently stored for the task is not valid, one of the

Re: [PATCH v3 1/7] KVM: arm64: Discard any SVE state when entering KVM guests

2022-09-22 Thread Mark Brown
On Wed, Sep 21, 2022 at 06:31:28PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > There's no use for that hook now though. > Care to clarify? We don't do anything for SME even if we were to support SME with no FP properly. signature.asc Desc

Re: [PATCH v3 1/7] KVM: arm64: Discard any SVE state when entering KVM guests

2022-09-20 Thread Mark Brown
On Tue, Sep 20, 2022 at 05:44:01PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) > > { > > BUG_ON(!current->mm); > > - BUG_ON(test_thread_flag(TIF_SVE)); > > + > > + fpsimd_kvm_prepare(); &

Re: [PATCH v3 5/7] arm64/fpsimd: Load FP state based on recorded data type

2022-09-20 Thread Mark Brown
On Tue, Sep 20, 2022 at 07:19:57PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > Now that we are recording the type of floating point register state we > > are saving when we save it we can use that information when we load to > > decide which register state is r

Re: [PATCH v3 4/7] arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM

2022-09-20 Thread Mark Brown
On Tue, Sep 20, 2022 at 07:04:24PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > - switch (last->to_save) { > > - case FP_STATE_TASK: > > - break; > > - case FP_STATE_FPSIMD: > > - WARN_ON_ONCE(save_sve_regs); > > -

Re: [PATCH v3 3/7] arm64/fpsimd: Have KVM explicitly say which FP registers to save

2022-09-20 Thread Mark Brown
On Tue, Sep 20, 2022 at 06:52:59PM +0100, Marc Zyngier wrote: > On Mon, 15 Aug 2022 23:55:25 +0100, > Mark Brown wrote: > > enum fp_state { > > + FP_STATE_TASK, /* Save based on current, invalid as fp_type */ > How is that related to the FP_TYPE_TASK in the

Re: [PATCH v3 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-09-20 Thread Mark Brown
On Tue, Sep 20, 2022 at 06:14:13PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > When we save the state for the floating point registers this can be done > > in the form visible through either the FPSIMD V registers or the SVE Z and > > P registers. At present we

[PATCH v3 7/7] arm64/sve: Leave SVE enabled on syscall if we don't context switch

2022-08-15 Thread Mark Brown
, this means that there is still some overhead for syscalls when SVE is in use but it is much reduced. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 8 +++- arch/arm64/kernel/syscall.c | 19 +-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arch

[PATCH v3 6/7] arm64/fpsimd: SME no longer requires SVE register state

2022-08-15 Thread Mark Brown
Now that we track the type of register state stored separately to tracking what is active in the task it is valid to have FPSIMD register state stored while in streaming mode so remove the special case handling for SME when setting FPSIMD register state. Signed-off-by: Mark Brown --- arch/arm64

[PATCH v3 5/7] arm64/fpsimd: Load FP state based on recorded data type

2022-08-15 Thread Mark Brown
directly in the saved SVCR and handled based on the information there. Since we are not changing any of the save paths there should be no functional change from this patch, further patches will make use of this to optimise and clarify the code. Signed-off-by: Mark Brown --- arch/arm64/kernel

[PATCH v3 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-08-15 Thread Mark Brown
state, future patches will introduce functional changes. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h| 2 +- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/processor.h | 6 arch/arm64/kernel/fpsimd.c | 58 ++ arch

[PATCH v3 4/7] arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM

2022-08-15 Thread Mark Brown
ensure we save the correct data for it. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 22 -- arch/arm64/kvm/fpsimd.c| 3 --- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index

[PATCH v3 3/7] arm64/fpsimd: Have KVM explicitly say which FP registers to save

2022-08-15 Thread Mark Brown
ght be required this patch does not actually update any of the decision making about what to save, it merely starts tracking the new information and warns if the requested state is not what we would otherwise have decided to save. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h

[PATCH v3 0/7] arm64/sve: Clean up KVM integration and optimise syscalls

2022-08-15 Thread Mark Brown
not shared with FPSIMD untouched, keep the unconditional flush. v2: - Rebase onto v5.19-rc3. - Don't warn when restoring streaming mode SVE without TIF_SVE. Mark Brown (7): KVM: arm64: Discard any SVE state when entering KVM guests arm64/fpsimd: Track the saved FPSIMD state type s

[PATCH v3 1/7] KVM: arm64: Discard any SVE state when entering KVM guests

2022-08-15 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 23 +++ arch/arm64/kvm/fpsimd.c | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm

Re: [PATCH 3/6] KVM: arm64: Make unwind()/on_accessible_stack() per-unwinder functions

2022-07-27 Thread Mark Brown
unwind_next_common() (which is the only common > code here) Reviewed-by: Mark Brown It feels like more of the accessibility stuff *should* be sharable, but yeah. signature.asc Description: PGP signature ___ kvmarm mailing list kvmarm@lists.cs.c

Re: [PATCH v6 06/17] arm64: stacktrace: Add description of stacktrace/common.h

2022-07-26 Thread Mark Brown
On Tue, Jul 26, 2022 at 12:37:39AM -0700, Kalesh Singh wrote: > Add brief description on how to use stacktrace/common.h to implement > a stack unwinder. Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list

Re: [PATCH v6 04/17] arm64: stacktrace: Handle frame pointer from different address spaces

2022-07-26 Thread Mark Brown
t be able to translate HYP stack > addresses to kernel addresses. > > Add a callback (stack_trace_translate_fp_fn) to allow specifying > the translation function. Reviewed-by: Mark Brown with or without one very minor thing: > static inline int unwind_next_common

Re: [PATCH v5 05/17] arm64: stacktrace: Factor out common unwind()

2022-07-25 Thread Mark Brown
On Wed, Jul 20, 2022 at 10:57:16PM -0700, Kalesh Singh wrote: > Move unwind() to stacktrace/common.h, and as a result > the kernel unwind_next() to asm/stacktrace.h. This allow > reusing unwind() in the implementation of the nVHE HYP > stack unwinder, later in the series. Reviewed-by

Re: [PATCH v2 7/7] arm64/sve: Don't zero non-FPSIMD register state on syscall by default

2022-07-20 Thread Mark Brown
On Wed, Jul 20, 2022 at 10:29:56AM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > it. Marc Zyngier has previously noted publicly the current behaviour > > being a consideration in the context of discusion of optimisation ideas > > like this one, I was a bit surprised th

Re: [PATCH v2 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-07-20 Thread Mark Brown
On Wed, Jul 20, 2022 at 10:40:03AM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > Yes, someone might forget to update the state type but my experience > > with this code is that it's a lot easier to spot "this is writing new > > state, did it update the state t

Re: [PATCH v2 7/7] arm64/sve: Don't zero non-FPSIMD register state on syscall by default

2022-07-20 Thread Mark Brown
On Wed, Jul 20, 2022 at 10:20:23AM +0100, Will Deacon wrote: > On Tue, Jul 19, 2022 at 08:35:46PM +0100, Mark Brown wrote: > > On Tue, Jul 19, 2022 at 06:35:37PM +0100, Catalin Marinas wrote: > > > > The sysctl is disabled by default since it is anticipated that the risk >

Re: [PATCH v2 7/7] arm64/sve: Don't zero non-FPSIMD register state on syscall by default

2022-07-19 Thread Mark Brown
On Tue, Jul 19, 2022 at 06:35:37PM +0100, Catalin Marinas wrote: > On Mon, Jun 20, 2022 at 01:41:58PM +0100, Mark Brown wrote: > > The documented syscall ABI specifies that the SVE state not shared with > > FPSIMD is undefined after a syscall. Currently we implement this by >

Re: [PATCH v4 03/18] arm64: stacktrace: Factor out unwind_next_common()

2022-07-15 Thread Mark Brown
On Thu, Jul 14, 2022 at 11:10:12PM -0700, Kalesh Singh wrote: > Move common unwind_next logic to stacktrace/common.h. This allows > reusing the code in the implementation the nVHE hypervisor stack > unwinder, later in this series. Reviewed-by: Mark Brown signature.asc Descrip

Re: [PATCH v4 02/18] arm64: stacktrace: Factor out on_accessible_stack_common()

2022-07-15 Thread Mark Brown
ly access per-cpu stacks from current in a non-preemptible > * context. Random perfectly fine but unrelated whitespace change here. Otherwise Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list kvmarm@

Re: [PATCH v4 01/18] arm64: stacktrace: Add shared header for common stack unwinding code

2022-07-15 Thread Mark Brown
nst kernel code, so we > make use of the shared header to avoid duplicated logic later in > this series. Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs

Re: [PATCH v2 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-07-11 Thread Mark Brown
On Mon, Jul 11, 2022 at 03:33:51PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > On Mon, Jul 11, 2022 at 10:40:50AM +0100, Marc Zyngier wrote: > > > Mark Brown wrote: > > > > + enum fp_state *type; > > > For consistency: s/type/fp_type/ ? &g

Re: [PATCH v2 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-07-11 Thread Mark Brown
On Mon, Jul 11, 2022 at 10:40:50AM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > + enum fp_state *type; > For consistency: s/type/fp_type/ ? Sure if nobody else wants a different bikeshed. It really needs a longer name like fp_state_t or something but that had it's

[PATCH v2 7/7] arm64/sve: Don't zero non-FPSIMD register state on syscall by default

2022-06-20 Thread Mark Brown
hand coded assembly which directly invokes syscalls. The new behaviour is also what is currently implemented by qemu user mode emulation. Signed-off-by: Mark Brown --- arch/arm64/kernel/syscall.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git

[PATCH v2 6/7] arm64/sve: Leave SVE enabled on syscall if we don't context switch

2022-06-20 Thread Mark Brown
, this means that there is still some overhead for syscalls when SVE is in use but it is much reduced. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 8 +++- arch/arm64/kernel/syscall.c | 19 +-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arch

[PATCH v2 5/7] arm64/fpsimd: Load FP state based on recorded data type

2022-06-20 Thread Mark Brown
directly in the saved SVCR and handled based on the information there. Since we are not changing any of the save paths there should be no functional change from this patch, further patches will make use of this to optimise and clarify the code. Signed-off-by: Mark Brown --- arch/arm64/kernel

[PATCH v2 4/7] arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM

2022-06-20 Thread Mark Brown
ensure we save the correct data for it. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 22 -- arch/arm64/kvm/fpsimd.c| 3 --- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index

[PATCH v2 3/7] arm64/fpsimd: Have KVM explicitly say which FP registers to save

2022-06-20 Thread Mark Brown
ght be required this patch does not actually update any of the decision making about what to save, it merely starts tracking the new information and warns if the requested state is not what we would otherwise have decided to save. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h

[PATCH v2 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-06-20 Thread Mark Brown
state, future patches will introduce functional changes. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h| 2 +- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/processor.h | 6 arch/arm64/kernel/fpsimd.c | 57 ++ arch

[PATCH v2 1/7] KVM: arm64: Discard any SVE state when entering KVM guests

2022-06-20 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 23 +++ arch/arm64/kvm/fpsimd.c | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm

[PATCH v2 0/7] arm64/sve: Clean up KVM integration and optimise syscalls

2022-06-20 Thread Mark Brown
tighten it. v2: - Rebase onto v5.19-rc3. - Don't warn when restoring streaming mode SVE without TIF_SVE. Mark Brown (7): KVM: arm64: Discard any SVE state when entering KVM guests arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE arm64/fpsimd: Have KVM exp

[PATCH v1 7/7] arm64/sve: Don't zero non-FPSIMD register state on syscall by default

2022-06-07 Thread Mark Brown
hand coded assembly which directly invokes syscalls. The new behaviour is also what is currently implemented by qemu user mode emulation. Signed-off-by: Mark Brown --- arch/arm64/kernel/syscall.c | 36 +++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git

[PATCH v1 4/7] arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM

2022-06-07 Thread Mark Brown
ensure we save the correct data for it. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 22 -- arch/arm64/kvm/fpsimd.c| 3 --- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index

[PATCH v1 6/7] arm64/sve: Leave SVE enabled on syscall if we don't context switch

2022-06-07 Thread Mark Brown
, this means that there is still some overhead for syscalls when SVE is in use but it is much reduced. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 8 +++- arch/arm64/kernel/syscall.c | 19 +-- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/arch

[PATCH v1 5/7] arm64/fpsimd: Load FP state based on recorded data type

2022-06-07 Thread Mark Brown
directly in the saved SVCR and handled based on the information there. Since we are not changing any of the save paths there should be no functional change from this patch, further patches will make use of this to optimise and clarify the code. Signed-off-by: Mark Brown --- arch/arm64/kernel

[PATCH v1 3/7] arm64/fpsimd: Have KVM explicitly say which FP registers to save

2022-06-07 Thread Mark Brown
ght be required this patch does not actually update any of the decision making about what to save, it merely starts tracking the new information and warns if the requested state is not what we would otherwise have decided to save. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h

[PATCH v1 2/7] arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE

2022-06-07 Thread Mark Brown
state, future patches will introduce functional changes. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h| 2 +- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/include/asm/processor.h | 6 +++ arch/arm64/kernel/fpsimd.c | 63 +- arch

[PATCH v1 0/7] arm64/sve: Clean up KVM integration and optimise syscalls

2022-06-07 Thread Mark Brown
t to tighten it. Mark Brown (7): KVM: arm64: Discard any SVE state when entering KVM guests arm64/fpsimd: Track the saved FPSIMD state type separately to TIF_SVE arm64/fpsimd: Have KVM explicitly say which FP registers to save arm64/fpsimd: Stop using TIF_SVE to manage register saving in KVM

[PATCH v1 1/7] KVM: arm64: Discard any SVE state when entering KVM guests

2022-06-07 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 23 +++ arch/arm64/kvm/fpsimd.c | 3 ++- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/fpsimd.h b/arch/arm64/include/asm

Re: [PATCH 01/18] KVM: arm64: Always start with clearing SVE flag on load

2022-06-06 Thread Mark Brown
On Mon, Jun 06, 2022 at 12:28:32PM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > On Sat, May 28, 2022 at 12:38:11PM +0100, Marc Zyngier wrote: > > > We probably never saw the issue because no VMM uses SVE, but > > > that's still pretty bad. Unconditionally

Re: [PATCH 04/18] KVM: arm64: Move FP state ownership from flag to a tristate

2022-06-06 Thread Mark Brown
On Mon, Jun 06, 2022 at 09:41:52AM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > On Sat, May 28, 2022 at 12:38:14PM +0100, Marc Zyngier wrote: > > > - FP_STATE_CLEAN > > > - FP_STATE_HOST_DIRTY > > > - FP_STATE_GUEST_DIRTY > > I had to think a bit

Re: [PATCH 04/18] KVM: arm64: Move FP state ownership from flag to a tristate

2022-06-03 Thread Mark Brown
N > - FP_STATE_HOST_DIRTY > - FP_STATE_GUEST_DIRTY I had to think a bit more than I liked about the _DIRTY in the names of the host and guest flags, but that's really just bikeshedding and not a meaningful issue. Reviewed-by: Mark Brown signature.asc Description: PGP signature __

Re: [PATCH 03/18] KVM: arm64: Drop FP_FOREIGN_STATE from the hypervisor code

2022-06-03 Thread Mark Brown
r not by updating the rest of the FP flags. Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Re: [PATCH 02/18] KVM: arm64: Always start with clearing SME flag on load

2022-05-30 Thread Mark Brown
On Sat, May 28, 2022 at 12:38:12PM +0100, Marc Zyngier wrote: > On each vcpu load, we set the KVM_ARM64_HOST_SME_ENABLED > flag if SVE is enabled for EL0 on the host. This is used to > restore the correct state on vpcu put. s/SVE/SME/ but otherwise Reviwed-by: Mark Brown sign

Re: [PATCH 01/18] KVM: arm64: Always start with clearing SVE flag on load

2022-05-30 Thread Mark Brown
lag. Once > set, it will stick until the vcpu is destroyed, which has the > potential to spuriously enable SVE for userspace. Oh dear. Reviewed-by: Mark Brown > We probably never saw the issue because no VMM uses SVE, but > that's still pretty bad. Unconditionally clearing the f

Re: [PATCH v2 2/5] KVM: arm64: Compile stacktrace.nvhe.o

2022-05-04 Thread Mark Brown
STACK_TYPES > }; I don't immediately see a problem with it but I'm curious as to why STACK_TYPE_UNKNOWN got moved to the end of the list here? It does mean that zeroed memory will default to STACK_TYPE_TASK but we're not actually relying on that. Otherwise Reviwe

Re: [PATCH v2 1/5] KVM: arm64: Factor out common stack unwinding logic

2022-05-04 Thread Mark Brown
On Mon, May 02, 2022 at 12:12:01PM -0700, Kalesh Singh wrote: > Factor out the stack unwinding logic common to both the host kernel and > the nVHE hypersivor into __unwind_next(). This allows for reuse in the > nVHE hypervisor stack unwinding (later in this series). Reviewed-by: M

Re: [PATCH v14 00/39] arm64/sme: Initial support for the Scalable Matrix Extension

2022-05-03 Thread Mark Brown
On Tue, May 03, 2022 at 06:23:40PM -0400, Qian Cai wrote: > On Tue, Apr 19, 2022 at 12:22:08PM +0100, Mark Brown wrote: > > This series provides initial support for the ARMv9 Scalable Matrix > > Extension (SME). SME takes the approach used for vectors in SVE and > > ex

Re: [PATCH 4/4] KVM: arm64: Unwind and dump nVHE hypervisor stacktrace

2022-04-29 Thread Mark Brown
2.056417] kvm [380]: end of nVHE HYP call trace This will be really helpful! Reviewed-by: Mark Brown signature.asc Description: PGP signature ___ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Re: [PATCH 1/4] KVM: arm64: Compile stacktrace.nvhe.o

2022-04-29 Thread Mark Brown
On Wed, Apr 27, 2022 at 11:46:56AM -0700, Kalesh Singh wrote: > Recompile stack unwinding code for use with the nVHE hypervisor. This is > a preparatory patch that will allow reusing most of the kernel unwinding > logic in the nVHE hypervisor. This is substantially more than just the build change

Re: [PATCH v14 00/39] arm64/sme: Initial support for the Scalable Matrix Extension

2022-04-27 Thread Mark Brown
On Wed, Apr 27, 2022 at 05:08:00PM -0400, Qian Cai wrote: > On Wed, Apr 27, 2022 at 06:14:31PM +0100, Mark Brown wrote: > > Can you try with > >https://lore.kernel.org/r/20220427130828.162615-1-broo...@kernel.org > > please? > Yes, it works fine so far. Gr

Re: [PATCH v14 00/39] arm64/sme: Initial support for the Scalable Matrix Extension

2022-04-27 Thread Mark Brown
On Wed, Apr 27, 2022 at 01:08:58PM -0400, Qian Cai wrote: > On Tue, Apr 19, 2022 at 12:22:08PM +0100, Mark Brown wrote: > > but not SVE, SME is an ARMv9 feature and SVE is mandatory for ARMv9. > > The code attempts to handle any such systems that are encountered but > > th

Re: [PATCH v14 27/39] arm64/sme: Provide Kconfig for SME

2022-04-27 Thread Mark Brown
On Wed, Apr 27, 2022 at 12:14:32AM +0200, Marek Szyprowski wrote: > This patchset landed in linux next-20220426. By default SME is enabled > and it breaks CPU hot-plug on all my arm64 test systems. Bisect points > this patch, because it finally enables this feature. Here is a report > from QEMU

[PATCH v14 39/39] selftests/arm64: Add a testcase for handling of ZA on clone()

2022-04-19 Thread Mark Brown
sure that ZA is still enabled and it looks like the data got copied. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/fp/.gitignore | 1 + tools/testing/selftests/arm64/fp/Makefile | 9 +- .../testing/selftests/arm64/fp/za-fork-asm.S | 61 +++ tools/testing/selftests/a

[PATCH v14 38/39] kselftest/arm64: Add SME support to syscall ABI test

2022-04-19 Thread Mark Brown
store instructions will handle the vector length for us. We log if the system supports FA64 and only try to set FFR in streaming mode if it does. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- .../selftests/arm64/abi/syscall-abi-asm.S | 79 ++- .../testing/self

[PATCH v14 37/39] kselftest/arm64: Add coverage for the ZA ptrace interface

2022-04-19 Thread Mark Brown
validate that both the vector size and data are being read and written as expected when the process runs. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/fp/.gitignore | 1 + tools/testing/selftests/arm64/fp/Makefile| 3 +- tools

[PATCH v14 35/39] kselftest/arm64: signal: Add SME signal handling tests

2022-04-19 Thread Mark Brown
. - Lack of support for changing vector length. - Presence and size of register state for streaming SVE and ZA. As with the SVE tests we do not yet have any validation of register contents. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- .../testing/selftests

[PATCH v14 36/39] kselftest/arm64: Add streaming SVE to SVE ptrace tests

2022-04-19 Thread Mark Brown
regsets. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/fp/sve-ptrace.c | 11 +++ 1 file changed, 11 insertions(+) diff --git a/tools/testing/selftests/arm64/fp/sve-ptrace.c b/tools/testing/selftests/arm64/fp/sve-ptrace.c

[PATCH v14 34/39] kselftest/arm64: Add stress test for SME ZA context switching

2022-04-19 Thread Mark Brown
ually assemble the SME instructions since at present no released toolchain has SME support integrated. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/fp/.gitignore | 1 + tools/testing/selftests/arm64/fp/Makefile | 3 + tools/te

[PATCH v14 33/39] kselftest/arm64: signal: Handle ZA signal context in core code

2022-04-19 Thread Mark Brown
As part of the generic code for signal handling test cases we parse all signal frames to make sure they have at least the basic form we expect and that there are no unexpected frames present in the signal context. Add coverage of the ZA signal frame to this code. Signed-off-by: Mark Brown

[PATCH v14 32/39] kselftest/arm64: sme: Provide streaming mode SVE stress test

2022-04-19 Thread Mark Brown
n for controlling the few small differences needed: - Enter streaming mode immediately on starting the program. - In streaming mode FFR is removed so skip reading and writing FFR. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/fp/.giti

[PATCH v14 30/39] kselftest/arm64: Add tests for TPIDR2

2022-04-19 Thread Mark Brown
g hwcap support to nolibc seems like disproportionate effort and didn't feel entirely idiomatic for what nolibc is trying to do. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/abi/.gitignore | 1 + tools/testing/selftest

[PATCH v14 31/39] kselftest/arm64: Extend vector configuration API tests to cover SME

2022-04-19 Thread Mark Brown
Provide RDVL helpers for SME and extend the main vector configuration tests to cover SME. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/fp/.gitignore | 1 + tools/testing/selftests/arm64/fp/Makefile | 3 ++- tools/testing

[PATCH v14 29/39] kselftest/arm64: sme: Add SME support to vlset

2022-04-19 Thread Mark Brown
The Scalable Matrix Extenions (SME) introduces additional register state with configurable vector lengths, similar to SVE but configured separately. Extend vlset to support configuring this state with a --sme or -s command line option. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by

[PATCH v14 28/39] kselftest/arm64: Add manual encodings for SME instructions

2022-04-19 Thread Mark Brown
As for the kernel so that we don't have ambitious toolchain requirements to build the tests manually encode some of the SVE instructions. Signed-off-by: Mark Brown Reviewed-by: Shuah Khan Acked-by: Catalin Marinas --- tools/testing/selftests/arm64/fp/sme-inst.h | 51 +++

[PATCH v14 27/39] arm64/sme: Provide Kconfig for SME

2022-04-19 Thread Mark Brown
with normal SVE so depend on SVE. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/Kconfig | 11 +++ 1 file changed, 11 insertions(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 57c4c995965f..0897984918e8 100644 --- a/arch/arm64/Kconfig +++ b/arch/

[PATCH v14 26/39] KVM: arm64: Handle SME host state when running guests

2022-04-19 Thread Mark Brown
ms with SME and even there only if streaming mode or ZA are enabled. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/fpsimd.c | 36 +++ 2 files changed, 37 insertions(+) diff --git a/arch/ar

[PATCH v14 25/39] KVM: arm64: Trap SME usage in guest

2022-04-19 Thread Mark Brown
ement callbacks, along with SCTLR_EL2.EnTPIDR2. There is no existing dynamic management of SCTLR_EL2. For nVHE manage TSM in activate_traps() along with the fine grained traps for TPIDR2 and SMPRI. There is no existing dynamic management of fine grained traps. Signed-off-by: Mark Brown Reviewed-by: Ca

[PATCH v14 23/39] arm64/sme: Save and restore streaming mode over EFI runtime calls

2022-04-19 Thread Mark Brown
runtime services, the specification is not yet finalised so this may need updating if that changes. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/kernel/fpsimd.c | 48 +- 1 file changed, 42 insertions(+), 6 deletions(-) diff --git a/arch

[PATCH v14 24/39] KVM: arm64: Hide SME system registers from guests

2022-04-19 Thread Mark Brown
mask out the SME bitfield in SYS_ID_AA64PFR1. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/kvm/sys_regs.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c index 7b45c040cc27..689e53dd4cb1

[PATCH v14 22/39] arm64/sme: Disable streaming mode and ZA when flushing CPU state

2022-04-19 Thread Mark Brown
idle and after flushing the state a reload is always required anyway. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/kernel/fpsimd.c | 9 + 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 94f06e9d37cf

[PATCH v14 21/39] arm64/sme: Add ptrace support for ZA

2022-04-19 Thread Mark Brown
-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/include/uapi/asm/ptrace.h | 56 +++ arch/arm64/kernel/ptrace.c | 144 +++ include/uapi/linux/elf.h | 1 + 3 files changed, 201 insertions(+) diff --git a/arch/arm64/include/uapi/asm

[PATCH v14 20/39] arm64/sme: Implement ptrace support for streaming mode SVE registers

2022-04-19 Thread Mark Brown
SVE registers, though users can provide no register data as an alternative mechanism for doing so. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/include/uapi/asm/ptrace.h | 13 +- arch/arm64/kernel/fpsimd.c | 31

[PATCH v14 19/39] arm64/sme: Implement ZA signal handling

2022-04-19 Thread Mark Brown
in the endinanness independent format used for vectors. As with SVE we do not allow changes in the vector length during signal return but we do allow ZA to be enabled or disabled. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/include/uapi/asm/sigcontext.h | 41

[PATCH v14 18/39] arm64/sme: Implement streaming SVE signal handling

2022-04-19 Thread Mark Brown
identify a case that is clearly better than any other - they all have cases where they could cause unexpected register corruption or faults. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/processor.h | 8 + arch/arm64/include/uapi/asm/sigcontext.h | 16

[PATCH v14 17/39] arm64/sme: Disable ZA and streaming mode when handling signals

2022-04-19 Thread Mark Brown
The ABI requires that streaming mode and ZA are disabled when invoking signal handlers, do this in setup_return() when we prepare the task state for the signal handler. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/kernel/signal.c | 7 +++ 1 file changed, 7

[PATCH v14 16/39] arm64/sme: Implement traps and syscall handling for SME

2022-04-19 Thread Mark Brown
through to normal handling of SVE. Signed-off-by: Mark Brown --- arch/arm64/include/asm/esr.h | 1 + arch/arm64/include/asm/exception.h | 1 + arch/arm64/include/asm/fpsimd.h| 39 +++ arch/arm64/kernel/entry-common.c | 11 ++ arch/arm64/kernel/fpsimd.c | 167

[PATCH v14 15/39] arm64/sme: Implement ZA context switching

2022-04-19 Thread Mark Brown
issues in shared SMCU implementations. Since ZA is architecturally guaranteed to be zeroed when enabled we do not need to explicitly zero ZA, either we will be restoring from a saved copy or trapping on first use of SME so we know that ZA must be disabled. Signed-off-by: Mark Brown Reviewed-by

[PATCH v14 14/39] arm64/sme: Implement streaming SVE context switching

2022-04-19 Thread Mark Brown
precedence. This does not handle use of streaming SVE state with KVM, ptrace or signals. This will be updated in further patches. Signed-off-by: Mark Brown Reviewed-by: Catalin Marinas --- arch/arm64/include/asm/fpsimd.h | 22 +- arch/arm64/include/asm/fpsimdmacros.h | 11 +++ arch

  1   2   3   4   5   >