Re: [PATCH 0/4] Add agent coding assistant configuration to Linux kernel

2025-07-30 Thread Mark Brown
On Wed, Jul 30, 2025 at 07:04:13PM +0100, Lorenzo Stoakes wrote: > On Wed, Jul 30, 2025 at 01:32:20PM -0400, Steven Rostedt wrote: > > If the maintainer starts getting too many submissions, then they can update > > the MAINTAINERS file to say "stop all AI patches to me!". Just like we have > > an

Re: [PATCH 0/4] Add agent coding assistant configuration to Linux kernel

2025-07-30 Thread Mark Brown
On Wed, Jul 30, 2025 at 05:59:25PM +0100, Lorenzo Stoakes wrote: > On Wed, Jul 30, 2025 at 12:36:25PM -0400, Sasha Levin wrote: > > Some sort of a "traffic light" system: > > 1. Green: the subsystem is happy to receive patches from any source. > > 2. Yellow: "If you're unfamiliar with the subs

Re: Crediting test authors

2025-07-26 Thread Mark Brown
On Fri, Jul 25, 2025 at 11:37:13AM -0700, dan.j.willi...@intel.com wrote: > Jakub Kicinski wrote: > > So a tag would be ideal. But it's a hard nut to crack. Best I can come > > up with would be: > > Reproducer: test.case.path # 001122aabb (optimal) commit of the test case > That's true, more tha

Re: Crediting test authors

2025-07-25 Thread Mark Brown
On Fri, Jul 25, 2025 at 08:00:23AM -0700, Jakub Kicinski wrote: > Does anyone have ideas about crediting test authors or tests for bugs > discovered? We increasingly see situations where someone adds a test > then our subsystem CI uncovers a (1 in a 100 runs) bug using that test. > Using reporte

Re: [PATCH v5 00/15] kunit: Introduce UAPI testing framework

2025-07-17 Thread Mark Brown
On Thu, Jul 17, 2025 at 03:23:00PM +0200, Christoph Hellwig wrote: > On Thu, Jul 17, 2025 at 10:48:02AM +0200, Thomas Weißschuh wrote: > > If the kernel toolchain is not fit to > > produce userspace because of a missing libc, the kernel's own nolibc can > > be used instead. > Is nolibc enough to

Re: [PATCH v6 18/28] KVM: arm64: Support SME priority registers

2025-07-03 Thread Mark Brown
On Sun, Jun 29, 2025 at 10:32:23AM +0100, Marc Zyngier wrote: > Mark Brown wrote: > > +++ b/arch/arm64/include/asm/kvm_host.h > > @@ -495,6 +495,7 @@ enum vcpu_sysreg { > > SVCR, > > FPMR, > > SMIDR_EL1, /* Streaming Mode Identificat

[PATCH v2 2/3] KVM: arm64: Expose FEAT_LSFE to guests

2025-07-03 Thread Mark Brown
FEAT_LSFE (Large System Float Extension), providing atomic floating point memory operations, is optional from v9.5. This feature adds no new architectural state, expose the relevant ID register field to guests so they can discover it. Signed-off-by: Mark Brown --- arch/arm64/kvm/sys_regs.c | 4

[PATCH v2 1/3] arm64/hwcap: Add hwcap for FEAT_LSFE

2025-07-03 Thread Mark Brown
: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 4 arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 2 ++ arch/arm64/kernel/cpuinfo.c | 1 + 5 files changed, 9 insertions(+) diff --git a

[PATCH v2 3/3] kselftest/arm64: Add lsfe to the hwcaps test

2025-07-03 Thread Mark Brown
This feature has no traps associated with it so the SIGILL is not reliable. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 21 + 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests

[PATCH v2 0/3] arm64: Support FEAT_LSFE (Large System Float Extension)

2025-07-03 Thread Mark Brown
FEAT_LSFE is optional from v9.5, it adds new instructions for atomic memory operations with floating point values. We have no immediate use for it in kernel, provide a hwcap so userspace can discover it and allow the ID register field to be exposed to KVM guests. Signed-off-by: Mark Brown

[PATCH 3/3] kselftest/arm64: Add lsfe to the hwcaps test

2025-06-27 Thread Mark Brown
This feature has no traps associated with it so the SIGILL is not reliable. Signed-off-by: Mark Brown --- tools/testing/selftests/arm64/abi/hwcap.c | 21 + 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests

[PATCH 2/3] KVM: arm64: Expose FEAT_LSFE to guests

2025-06-27 Thread Mark Brown
FEAT_LSFE (Large System Float Extension), providing atomic floating point memory operations, is optional from v9.5. This feature adds no new architectural state, expose the relevant ID register field to guests so they can discover it. Signed-off-by: Mark Brown --- arch/arm64/kvm/sys_regs.c | 4

[PATCH 1/3] arm64/hwcap: Add hwcap for FEAT_LSFE

2025-06-27 Thread Mark Brown
: Mark Brown --- Documentation/arch/arm64/elf_hwcaps.rst | 4 arch/arm64/include/asm/hwcap.h | 1 + arch/arm64/include/uapi/asm/hwcap.h | 1 + arch/arm64/kernel/cpufeature.c | 2 ++ arch/arm64/kernel/cpuinfo.c | 1 + 5 files changed, 9 insertions(+) diff --git a

[PATCH 0/3] arm64: Support FEAT_LSFE (Large System Float Extension)

2025-06-27 Thread Mark Brown
FEAT_LSFE is optional from v9.5, it adds new instructions for atomic memory operations with floating point values. We have no immediate use for it in kernel, provide a hwcap so userspace can discover it and allow the ID register field to be exposed to KVM guests. Signed-off-by: Mark Brown

[PATCH v6 12/28] KVM: arm64: Rename sve_state_reg_region

2025-06-25 Thread Mark Brown
As for SVE we will need to pull parts of dynamically sized registers out of a block of memory for SME so we will use a similar code pattern for this. Rename the current struct sve_state_reg_region in preparation for this. No functional change. Signed-off-by: Mark Brown --- arch/arm64/kvm

[PATCH v6 22/28] KVM: arm64: Expose SME specific state to userspace

2025-06-25 Thread Mark Brown
extensions adding more ZT registers. This encoding can readily support such an extension if one is introduced. Signed-off-by: Mark Brown --- arch/arm64/include/uapi/asm/kvm.h | 17 ++ arch/arm64/kvm/guest.c| 114 +- 2 files changed, 129 insertions

[PATCH v6 20/28] KVM: arm64: Support userspace access to streaming mode Z and P registers

2025-06-25 Thread Mark Brown
the guest floating point state may be accessed via the V registers. Any VMM that supports SME must be aware of the need to configure streaming mode prior to writing the floating point registers that this creates. Signed-off-by: Mark Brown --- arch/arm64/kvm/guest.c | 38

[PATCH v6 07/28] KVM: arm64: Pull ctxt_has_ helpers to start of sysreg-sr.h

2025-06-25 Thread Mark Brown
Rather than add earlier prototypes of specific ctxt_has_ helpers let's just pull all their definitions to the top of sysreg-sr.h so they're all available to all the individual save/restore functions. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/include/hyp/sysreg

[PATCH v6 16/28] KVM: arm64: Support TPIDR2_EL0

2025-06-25 Thread Mark Brown
purely software defined. Expose the register as a system register if the guest supports SME, context switching it along with the other EL0 TPIDRs. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 15

[PATCH v6 17/28] KVM: arm64: Support SME identification registers for guests

2025-06-25 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 46 +++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index

[PATCH v6 23/28] KVM: arm64: Context switch SME state for guests

2025-06-25 Thread Mark Brown
move the restore of the effective VL for nested guests to a separate restore function run after loading the floating point register state, along with the similar handling required for SME. The selection of which vector length to use is handled by vcpu_sve_pffr(). Signed-off-by: Mark Brown

[PATCH v6 02/28] arm64/fpsimd: Decide to save ZT0 and streaming mode FFR at bind time

2025-06-25 Thread Mark Brown
variable to the cpu_fp_state which uses the enable bits in SMCR_ELx to flag which features are enabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 10 -- arch/arm64/kvm/fpsimd.c | 1 + 3 files changed, 10 insertions

[PATCH v6 26/28] KVM: arm64: Provide interface for configuring and enabling SME for guests

2025-06-25 Thread Mark Brown
SVE or SME is finalised and the other not, avoiding complexity. SME is supported for normal and protected guests. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 12 +++- arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/arm.c | 10 arch/arm64/kvm

[PATCH v6 28/28] KVM: arm64: selftests: Add SME to set_id_regs test

2025-06-25 Thread Mark Brown
Add coverage of the SME ID registers to set_id_regs, ID_AA64PFR1_EL1.SME becomes writable and we add ID_AA64SMFR_EL1 and it's subfields. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/arm64/set_id_regs.c | 29 +++-- 1 file changed, 27 insertions(+), 2 dele

[PATCH v6 27/28] KVM: arm64: selftests: Add SME system registers to get-reg-list

2025-06-25 Thread Mark Brown
SME adds a number of new system registers, update get-reg-list to check for them based on the visibility of SME. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/arm64/get-reg-list.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools

[PATCH v6 03/28] arm64/fpsimd: Check enable bit for FA64 when saving EFI state

2025-06-25 Thread Mark Brown
-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 77f9dfaffe8b..de2897d6208c 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1908,6

[PATCH v6 11/28] KVM: arm64: Define internal features for SME

2025-06-25 Thread Mark Brown
h are configured via the normal ID register scheme. Also provide helpers which check if the vCPU is in streaming mode or has ZA enabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 35 ++- arch/arm64/kvm/sys_regs.c | 2 +- 2 files ch

[PATCH v6 10/28] KVM: arm64: Document the KVM ABI for SME

2025-06-25 Thread Mark Brown
. Signed-off-by: Mark Brown --- Documentation/virt/kvm/api.rst | 117 + 1 file changed, 82 insertions(+), 35 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 9abf93ee5f65..00195e837b5f 100644 --- a/Documentation

[PATCH v6 25/28] KVM: arm64: Expose SME to nested guests

2025-06-25 Thread Mark Brown
specific handling for the vector lengths already in place. TPIDR2_EL0 is context switched along with the other TPIDRs as part of the main guest register context switch. SME priority support is currently masked from all guests including nested ones. Signed-off-by: Mark Brown --- arch/arm64/kvm

[PATCH v6 24/28] KVM: arm64: Handle SME exceptions

2025-06-25 Thread Mark Brown
for FPSIMD and SVE. Signed-off-by: Mark Brown --- arch/arm64/kvm/handle_exit.c| 14 ++ arch/arm64/kvm/hyp/include/hyp/switch.h | 11 ++- arch/arm64/kvm/hyp/nvhe/switch.c| 4 +++- arch/arm64/kvm/hyp/vhe/switch.c | 17 - 4 files changed

[PATCH v6 04/28] arm64/fpsimd: Determine maximum virtualisable SME vector length

2025-06-25 Thread Mark Brown
happens with a maximum vector length of -1. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index de2897d6208c..fbc586813f6a 100644 --- a/arch

[PATCH v6 21/28] KVM: arm64: Flush register state on writes to SVCR.SM and SVCR.ZA

2025-06-25 Thread Mark Brown
PSTATE.ZA to 0 causes ZA and ZT0 to become inaccesible so no reset is needed. Any change in PSTATE.SM causes the V, Z, P, FFR and FPMR registers to be reset to 0 and FPSR to be reset to 0x89f. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 24 arch

[PATCH v6 19/28] KVM: arm64: Provide assembly for SME register access

2025-06-25 Thread Mark Brown
Provide versions of the SME state save and restore functions for the hypervisor to allow it to restore ZA and ZT for guests. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_hyp.h | 3 +++ arch/arm64/kvm/hyp/fpsimd.S | 26 ++ 2 files changed, 29 insertions

[PATCH v6 18/28] KVM: arm64: Support SME priority registers

2025-06-25 Thread Mark Brown
when priority configuration is not supported but has no specific traps available. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/vncr_mapping.h | 1 + arch/arm64/kvm/sys_regs.c | 23 ++- 3 files change

[PATCH v6 14/28] KVM: arm64: Implement SME vector length configuration

2025-06-25 Thread Mark Brown
registers stub register access functions are provided that only allow VL configuration. These will be extended as the SME specific registers, as for SVE. Since vq_available() is currently only defined for CONFIG_SVE add a stub for builds where that is disabled. Signed-off-by: Mark Brown

[PATCH v6 15/28] KVM: arm64: Support SME control registers

2025-06-25 Thread Mark Brown
as part of the general floating point context switch, as is done for the equivalent SVE registers. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/vncr_mapping.h | 1 + arch/arm64/kvm/sys_regs.c | 37

[PATCH v6 13/28] KVM: arm64: Store vector lengths in an array

2025-06-25 Thread Mark Brown
clean as might be. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 17 +++-- arch/arm64/include/asm/kvm_hyp.h| 2 +- arch/arm64/include/asm/kvm_pkvm.h | 2 +- arch/arm64/kvm/fpsimd.c | 2 +- arch/arm64/kvm

[PATCH v6 08/28] KVM: arm64: Move SVE state access macros after feature test macros

2025-06-25 Thread Mark Brown
In preparation for SME support move the macros used to access SVE state after the feature test macros, we will need to test for SME subfeatures to determine the size of the SME state. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 50 +++ 1

[PATCH v6 09/28] KVM: arm64: Rename SVE finalization constants to be more general

2025-06-25 Thread Mark Brown
the existing KVM_ARM_VCPU_SVE capability, existing code which does not enable SME will be unaffected and any SME only code will not need to use SVE constants. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 8 +--- arch/arm64/include/uapi/asm/kvm.h

[PATCH v6 06/28] KVM: arm64: Pay attention to FFR parameter in SVE save and load

2025-06-25 Thread Mark Brown
FFR is always present for SVE but will be important for SME. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/fpsimd.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/fpsimd.S b/arch/arm64/kvm/hyp/fpsimd.S index e950875e31ce..6e16cbfc5df2 100644 --- a/arch/arm64/kvm/hyp

[PATCH v6 05/28] KVM: arm64: Introduce non-UNDEF FGT control

2025-06-25 Thread Mark Brown
g the overwhelmingly common case). Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/kvm/hyp/include/hyp/switch.h | 7 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_h

[PATCH v6 01/28] arm64/fpsimd: Update FA64 and ZT0 enables when loading SME state

2025-06-25 Thread Mark Brown
this should be negligable in the context of the state load or access trap. In order to avoid compiler warnings due to unused variables in !CONFIG_ARM64_SME cases we avoid storing the vector length in temporary variables. Signed-off-by: Mark Brown df --- arch/arm64/include/asm/fpsimd.h

[PATCH v6 00/28] KVM: arm64: Implement support for SME

2025-06-25 Thread Mark Brown
ossible feature combinations has been rejected. I will post a separate series which does that restructuring. Signed-off-by: Mark Brown --- Changes in v6: - Rebase onto v6.16-rc3. - Link to v5: https://lore.kernel.org/r/20250417-kvm-arm64-sme-v5-0-f469a2d5f...@kernel.org Changes in v5: - Rebase

[PATCH v5 24/28] KVM: arm64: Handle SME exceptions

2025-04-18 Thread Mark Brown
-off-by: Mark Brown squash ctxtsync --- arch/arm64/kvm/handle_exit.c | 14 + arch/arm64/kvm/hyp/nvhe/hyp-main.c | 22 - arch/arm64/kvm/hyp/nvhe/switch.c | 40 +++--- arch/arm64/kvm/hyp/vhe/switch.c| 29

[PATCH v5 20/28] KVM: arm64: Support userspace access to streaming mode Z and P registers

2025-04-17 Thread Mark Brown
the guest floating point state may be accessed via the V registers. Any VMM that supports SME must be aware of the need to configure streaming mode prior to writing the floating point registers that this creates. Signed-off-by: Mark Brown --- arch/arm64/kvm/guest.c | 38

[PATCH v5 00/28] KVM: arm64: Implement support for SME

2025-04-16 Thread Mark Brown
psimd: Avoid RES0 bits in the SME trap handler" which changes the defines for ESR decode, but also due to the assistance in testing. Signed-off-by: Mark Brown --- Changes in v5: - Rebase onto v6.15-rc2. - Add pKVM guest support. - Always restore SVCR. - Link to v4: https://lore.kernel.org

[PATCH v5 26/28] KVM: arm64: Provide interface for configuring and enabling SME for guests

2025-04-16 Thread Mark Brown
SVE or SME is finalised and the other not, avoiding complexity. SME is supported for normal and protected guests. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 9 +-- arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/arm.c | 10 arch/arm64/kvm

[PATCH v5 27/28] KVM: arm64: selftests: Add SME system registers to get-reg-list

2025-04-16 Thread Mark Brown
SME adds a number of new system registers, update get-reg-list to check for them based on the visibility of SME. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/arm64/get-reg-list.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools

[PATCH v5 23/28] KVM: arm64: Context switch SME state for guests

2025-04-16 Thread Mark Brown
need to move the restore of the effective VL for nested guests to a separate restore function run after loading the floating point register state, along with the similar handling required for SME. The selection of which vector length to use is handled by vcpu_sve_pffr(). Signed-off-by: Mark Brown

[PATCH v5 15/28] KVM: arm64: Support SME control registers

2025-04-16 Thread Mark Brown
as part of the general floating point context switch, as is done for the equivalent SVE registers. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/vncr_mapping.h | 1 + arch/arm64/kvm/sys_regs.c | 37

[PATCH v5 02/28] arm64/fpsimd: Decide to save ZT0 and streaming mode FFR at bind time

2025-04-16 Thread Mark Brown
variable to the cpu_fp_state which uses the enable bits in SMCR_ELx to flag which features are enabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 10 -- arch/arm64/kvm/fpsimd.c | 1 + 3 files changed, 10 insertions

[PATCH v5 14/28] KVM: arm64: Implement SME vector length configuration

2025-04-16 Thread Mark Brown
registers stub register access functions are provided that only allow VL configuration. These will be extended as the SME specific registers, as for SVE. Since vq_available() is currently only defined for CONFIG_SVE add a stub for builds where that is disabled. Signed-off-by: Mark Brown

[PATCH v5 25/28] KVM: arm64: Expose SME to nested guests

2025-04-16 Thread Mark Brown
specific handling for the vector lengths already in place. TPIDR2_EL0 is context switched along with the other TPIDRs as part of the main guest register context switch. SME priority support is currently masked from all guests including nested ones. Signed-off-by: Mark Brown --- arch/arm64/kvm

[PATCH v5 28/28] KVM: arm64: selftests: Add SME to set_id_regs test

2025-04-16 Thread Mark Brown
Add coverage of the SME ID registers to set_id_regs, ID_AA64PFR1_EL1.SME becomes writable and we add ID_AA64SMFR_EL1 and it's subfields. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/arm64/set_id_regs.c | 30 +++-- 1 file changed, 28 insertions(+), 2 dele

[PATCH v5 06/28] KVM: arm64: Pay attention to FFR parameter in SVE save and load

2025-04-16 Thread Mark Brown
FFR is always present for SVE but will be important for SME. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/fpsimd.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/fpsimd.S b/arch/arm64/kvm/hyp/fpsimd.S index e950875e31ce..6e16cbfc5df2 100644 --- a/arch/arm64/kvm/hyp

[PATCH v5 22/28] KVM: arm64: Expose SME specific state to userspace

2025-04-16 Thread Mark Brown
extensions adding more ZT registers. This encoding can readily support such an extension if one is introduced. Signed-off-by: Mark Brown --- arch/arm64/include/uapi/asm/kvm.h | 17 ++ arch/arm64/kvm/guest.c| 114 +- 2 files changed, 129 insertions

[PATCH v5 21/28] KVM: arm64: Flush register state on writes to SVCR.SM and SVCR.ZA

2025-04-16 Thread Mark Brown
PSTATE.ZA to 0 causes ZA and ZT0 to become inaccesible so no reset is needed. Any change in PSTATE.SM causes the V, Z, P, FFR and FPMR registers to be reset to 0 and FPSR to be reset to 0x89f. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 18 ++ arch/arm64

[PATCH v5 19/28] KVM: arm64: Provide assembly for SME register access

2025-04-16 Thread Mark Brown
Provide versions of the SME state save and restore functions for the hypervisor to allow it to restore ZA and ZT for guests. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_hyp.h | 3 +++ arch/arm64/kvm/hyp/fpsimd.S | 26 ++ 2 files changed, 29 insertions

[PATCH v5 18/28] KVM: arm64: Support SME priority registers

2025-04-16 Thread Mark Brown
r frequent accesses. There is also an EL2 register SMPRIMAP_EL2 for virtualisation of priorities, this is RES0 when priority configuration is not supported but has no specific traps available. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/vncr

[PATCH v5 17/28] KVM: arm64: Support SME identification registers for guests

2025-04-16 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 46 +++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index

[PATCH v5 16/28] KVM: arm64: Support TPIDR2_EL0

2025-04-16 Thread Mark Brown
purely software defined. Expose the register as a system register if the guest supports SME, context switching it along with the other EL0 TPIDRs. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 15

[PATCH v5 13/28] KVM: arm64: Store vector lengths in an array

2025-04-16 Thread Mark Brown
clean as might be. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 17 +++-- arch/arm64/include/asm/kvm_hyp.h| 2 +- arch/arm64/include/asm/kvm_pkvm.h | 2 +- arch/arm64/kvm/fpsimd.c | 2 +- arch/arm64/kvm

[PATCH v5 11/28] KVM: arm64: Define internal features for SME

2025-04-16 Thread Mark Brown
h are configured via the normal ID register scheme. Also provide helpers which check if the vCPU is in streaming mode or has ZA enabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 37 +++-- arch/arm64/kvm/sys_regs.c | 2 +- 2

[PATCH v5 12/28] KVM: arm64: Rename sve_state_reg_region

2025-04-16 Thread Mark Brown
As for SVE we will need to pull parts of dynamically sized registers out of a block of memory for SME so we will use a similar code pattern for this. Rename the current struct sve_state_reg_region in preparation for this. No functional change. Signed-off-by: Mark Brown --- arch/arm64/kvm

[PATCH v5 10/28] KVM: arm64: Document the KVM ABI for SME

2025-04-16 Thread Mark Brown
. Signed-off-by: Mark Brown --- Documentation/virt/kvm/api.rst | 117 + 1 file changed, 82 insertions(+), 35 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 47c7c3f92314..5cc30a93fdd7 100644 --- a/Documentation

[PATCH v5 09/28] KVM: arm64: Rename SVE finalization constants to be more general

2025-04-16 Thread Mark Brown
the existing KVM_ARM_VCPU_SVE capability, existing code which does not enable SME will be unaffected and any SME only code will not need to use SVE constants. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 8 +--- arch/arm64/include/uapi/asm/kvm.h

[PATCH v5 08/28] KVM: arm64: Move SVE state access macros after feature test macros

2025-04-16 Thread Mark Brown
In preparation for SME support move the macros used to access SVE state after the feature test macros, we will need to test for SME subfeatures to determine the size of the SME state. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 46 +++ 1

[PATCH v5 07/28] KVM: arm64: Pull ctxt_has_ helpers to start of sysreg-sr.h

2025-04-16 Thread Mark Brown
Rather than add earlier prototypes of specific ctxt_has_ helpers let's just pull all their definitions to the top of sysreg-sr.h so they're all available to all the individual save/restore functions. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/include/hyp/sysreg

[PATCH v5 05/28] KVM: arm64: Introduce non-UNDEF FGT control

2025-04-16 Thread Mark Brown
g the overwhelmingly common case). Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/kvm/hyp/include/hyp/switch.h | 7 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_h

[PATCH v5 04/28] arm64/fpsimd: Determine maximum virtualisable SME vector length

2025-04-16 Thread Mark Brown
happens with a maximum vector length of -1. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 83a4f8d3e895..31b3ca061bb2 100644 --- a/arch

[PATCH v5 03/28] arm64/fpsimd: Check enable bit for FA64 when saving EFI state

2025-04-16 Thread Mark Brown
-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 266ce7a9f195..83a4f8d3e895 100644 --- a/arch/arm64/kernel/fpsimd.c +++ b/arch/arm64/kernel/fpsimd.c @@ -1913,6

[PATCH v5 01/28] arm64/fpsimd: Update FA64 and ZT0 enables when loading SME state

2025-04-16 Thread Mark Brown
this should be negligable in the context of the state load or access trap. In order to avoid compiler warnings due to unused variables in !CONFIG_ARM64_SME cases we avoid storing the vector length in temporary variables. Signed-off-by: Mark Brown df --- arch/arm64/include/asm/fpsimd.h

Re: [PATCH v4 00/27] KVM: arm64: Implement support for SME in non-protected guests

2025-02-18 Thread Mark Brown
On Mon, Feb 17, 2025 at 09:37:26AM +, Marc Zyngier wrote: > Mark Brown wrote: > > On Fri, Feb 14, 2025 at 09:24:03AM +, Marc Zyngier wrote: > > > Why SVCR? This isn't a register, just an architected accessor to > > > PSTATE.{ZA,SM}. Userspace already h

Re: [PATCH v4 00/27] KVM: arm64: Implement support for SME in non-protected guests

2025-02-14 Thread Mark Brown
On Fri, Feb 14, 2025 at 09:24:03AM +, Marc Zyngier wrote: > Mark Brown wrote: > Just to be clear: I do not intend to review a series that doesn't > cover the full gamut of KVM from day 1. Protected mode is an absolute > requirement. It is the largest KVM deployment, and A

[PATCH v4 11/27] KVM: arm64: Define internal features for SME

2025-02-13 Thread Mark Brown
h are configured via the normal ID register scheme. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 31 +-- arch/arm64/kvm/sys_regs.c | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b

[PATCH v4 17/27] KVM: arm64: Support SME identification registers for guests

2025-02-13 Thread Mark Brown
. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/sys_regs.c | 46 +++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index

[PATCH v4 18/27] KVM: arm64: Support SME priority registers

2025-02-13 Thread Mark Brown
r frequent accesses. There is also an EL2 register SMPRIMAP_EL2 for virtualisation of priorities, this is RES0 when priority configuration is not supported but has no specific traps available. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/vncr

[PATCH v4 27/27] KVM: arm64: selftests: Add SME to set_id_regs test

2025-02-13 Thread Mark Brown
Add coverage of the SME ID registers to set_id_regs, ID_AA64PFR1_EL1.SME becomes writable and we add ID_AA64SMFR_EL1 and it's subfields. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/arm64/set_id_regs.c | 29 +++-- 1 file changed, 27 insertions(+), 2 dele

[PATCH v4 25/27] KVM: arm64: Provide interface for configuring and enabling SME for guests

2025-02-13 Thread Mark Brown
SVE or SME is finalised and the other not, avoiding complexity. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 5 +- arch/arm64/include/uapi/asm/kvm.h | 1 + arch/arm64/kvm/arm.c | 10 arch/arm64/kvm/reset.c| 114

[PATCH v4 26/27] KVM: arm64: selftests: Add SME system registers to get-reg-list

2025-02-13 Thread Mark Brown
SME adds a number of new system registers, update get-reg-list to check for them based on the visibility of SME. Signed-off-by: Mark Brown --- tools/testing/selftests/kvm/arm64/get-reg-list.c | 32 +++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tools

[PATCH v4 24/27] KVM: arm64: Expose SME to nested guests

2025-02-13 Thread Mark Brown
specific handling for the vector lengths already in place. TPIDR2_EL0 is context switched along with the other TPIDRs as part of the main guest register context switch. SME priority support is currently masked from all guests including nested ones. Signed-off-by: Mark Brown --- arch/arm64/kvm

[PATCH v4 23/27] KVM: arm64: Handle SME exceptions

2025-02-13 Thread Mark Brown
streaming mode before running the guest. This ensures that guests do not receive unexpected SME exceptions. Signed-off-by: Mark Brown --- arch/arm64/kvm/handle_exit.c | 14 ++ arch/arm64/kvm/hyp/nvhe/switch.c | 11 ++- arch/arm64/kvm/hyp/vhe/switch.c | 21 - 3

[PATCH v4 22/27] KVM: arm64: Context switch SME state for normal guests

2025-02-13 Thread Mark Brown
need to move the restore of the effective VL for nested guests to a separate restore function run after loading the floating point register state, along with the similar handling required for SME. The selection of which vector length to use is handled by vcpu_sve_pffr(). Signed-off-by: Mark Brown

[PATCH v4 21/27] KVM: arm64: Expose SME specific state to userspace

2025-02-13 Thread Mark Brown
extensions adding more ZT registers. This encoding can readily support such an extension if one is introduced. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 21 +++ arch/arm64/include/uapi/asm/kvm.h | 17 ++ arch/arm64/kvm/guest.c| 114

[PATCH v4 20/27] KVM: arm64: Support userspace access to streaming mode Z and P registers

2025-02-13 Thread Mark Brown
the guest floating point state may be accessed via the V registers. Any VMM that supports SME must be aware of the need to configure streaming mode prior to writing the floating point registers that this creates. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 3 +++ arch/arm64

[PATCH v4 19/27] KVM: arm64: Provide assembly for SME state restore

2025-02-13 Thread Mark Brown
Provide a __sme_restore_state() for the hypervisor to allow it to restore ZA and ZT for guests. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_hyp.h | 2 ++ arch/arm64/kvm/hyp/fpsimd.S | 16 2 files changed, 18 insertions(+) diff --git a/arch/arm64/include/asm

[PATCH v4 16/27] KVM: arm64: Support TPIDR2_EL0

2025-02-13 Thread Mark Brown
purely software defined. Expose the register as a system register if the guest supports SME, context switching it along with the other EL0 TPIDRs. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 1 + arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 15

[PATCH v4 13/27] KVM: arm64: Store vector lengths in an array

2025-02-13 Thread Mark Brown
clean as might be. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 17 +++-- arch/arm64/include/asm/kvm_hyp.h| 2 +- arch/arm64/include/asm/kvm_pkvm.h | 2 +- arch/arm64/kvm/fpsimd.c | 2 +- arch/arm64/kvm

[PATCH v4 14/27] KVM: arm64: Implement SME vector length configuration

2025-02-13 Thread Mark Brown
registers stub register access functions are provided that only allow VL configuration. These will be extended as the SME specific registers, as for SVE. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 11 + arch/arm64/include/uapi/asm/kvm.h | 9 arch/arm64/kvm

[PATCH v4 15/27] KVM: arm64: Support SME control registers

2025-02-13 Thread Mark Brown
as part of the general floating point context switch, as is done for the equivalent SVE registers. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/include/asm/vncr_mapping.h | 1 + arch/arm64/kvm/sys_regs.c | 37

[PATCH v4 10/27] KVM: arm64: Document the KVM ABI for SME

2025-02-13 Thread Mark Brown
. Signed-off-by: Mark Brown --- Documentation/virt/kvm/api.rst | 117 + 1 file changed, 82 insertions(+), 35 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 2b52eb77e29cba146b64489cfb1a267e7bb9b597

[PATCH v4 12/27] KVM: arm64: Rename sve_state_reg_region

2025-02-13 Thread Mark Brown
As for SVE we will need to pull parts of dynamically sized registers out of a block of memory for SME so we will use a similar code pattern for this. Rename the current struct sve_state_reg_region in preparation for this. No functional change. Signed-off-by: Mark Brown --- arch/arm64/kvm

[PATCH v4 08/27] KVM: arm64: Move SVE state access macros after feature test macros

2025-02-13 Thread Mark Brown
In preparation for SME support move the macros used to access SVE state after the feature test macros, we will need to test for SME subfeatures to determine the size of the SME state. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 46 +++ 1

[PATCH v4 09/27] KVM: arm64: Rename SVE finalization constants to be more general

2025-02-13 Thread Mark Brown
the existing KVM_ARM_VCPU_SVE capability, existing code which does not enable SME will be unaffected and any SME only code will not need to use SVE constants. No functional change. Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 6 -- arch/arm64/include/uapi/asm/kvm.h | 6

[PATCH v4 07/27] KVM: arm64: Pull ctxt_has_ helpers to start of sysreg-sr.h

2025-02-13 Thread Mark Brown
Rather than add earlier prototypes of specific ctxt_has_ helpers let's just pull all their definitions to the top of sysreg-sr.h so they're all available to all the individual save/restore functions. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/include/hyp/sysreg

[PATCH v4 06/27] KVM: arm64: Pay attention to FFR parameter in SVE save and load

2025-02-13 Thread Mark Brown
FFR is always present for SVE but will be important for SME. Signed-off-by: Mark Brown --- arch/arm64/kvm/hyp/fpsimd.S | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/fpsimd.S b/arch/arm64/kvm/hyp/fpsimd.S index e950875e31cee4df58d041519b7584356463c91b

[PATCH v4 05/27] KVM: arm64: Introduce non-UNDEF FGT control

2025-02-13 Thread Mark Brown
g the overwhelmingly common case). Signed-off-by: Mark Brown --- arch/arm64/include/asm/kvm_host.h | 6 ++ arch/arm64/kvm/hyp/include/hyp/switch.h | 7 --- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_h

[PATCH v4 03/27] arm64/fpsimd: Check enable bit for FA64 when saving EFI state

2025-02-13 Thread Mark Brown
-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index 446a379d87539bb37a9d4eb7466a73d8819afc56..a97af9daea472cc57bafc0564fdfe4e327924db1 100644 --- a/arch/arm64

[PATCH v4 04/27] arm64/fpsimd: Determine maximum virtualisable SME vector length

2025-02-13 Thread Mark Brown
happens with a maximum vector length of -1. Signed-off-by: Mark Brown --- arch/arm64/kernel/fpsimd.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/fpsimd.c b/arch/arm64/kernel/fpsimd.c index a97af9daea472cc57bafc0564fdfe4e327924db1

[PATCH v4 02/27] arm64/fpsimd: Decide to save ZT0 and streaming mode FFR at bind time

2025-02-13 Thread Mark Brown
variable to the cpu_fp_state which uses the enable bits in SMCR_ELx to flag which features are enabled. Signed-off-by: Mark Brown --- arch/arm64/include/asm/fpsimd.h | 1 + arch/arm64/kernel/fpsimd.c | 10 -- arch/arm64/kvm/fpsimd.c | 1 + 3 files changed, 10 insertions

  1   2   3   >