KVM/arm64: Refactoring the vcpu flags
Subsystems (4)
Marc Zyngier
maintainerv2 cover KVM/arm64: Refactoring the vcpu flags
This is a iteration on [1], which aims at making the vcpu flags suck a bit less.
* From v1 [1]:
- Rebased onto v5.19-rc1
- Took the first two patches into kvmarm-fixes, included here for completeness
- Additional patch to move system_supports_fpsimd() outside of the run path (Reiji)
- Expanded on comments (Reiji)
- New kvm_pend_exception() accessor (Fuad)
- Various bracketing fixups (Reiji)
- Some renaming (Reiji, Broonie)
- Collected RBs, with thanks
[1] https://lore.kernel.org/r/[email protected]
Marc Zyngier (19):
KVM: arm64: Always start with clearing SVE flag on load
KVM: arm64: Always start with clearing SME flag on load
KVM: arm64: Drop FP_FOREIGN_STATE from the hypervisor code
KVM: arm64: Move FP state ownership from flag to a tristate
KVM: arm64: Add helpers to manipulate vcpu flags among a set
KVM: arm64: Add three sets of flags to the vcpu state
KVM: arm64: Move vcpu configuration flags into their own set
KVM: arm64: Move vcpu PC/Exception flags to the input flag set
KVM: arm64: Move vcpu debug/SPE/TRBE flags to the input flag set
KVM: arm64: Move vcpu SVE/SME flags to the state flag set
KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set
KVM: arm64: Move vcpu WFIT flag to the state flag set
KVM: arm64: Kill unused vcpu flags field
KVM: arm64: Convert vcpu sysregs_loaded_on_cpu to a state flag
KVM: arm64: Warn when PENDING_EXCEPTION and INCREMENT_PC are set
together
KVM: arm64: Add build-time sanity checks for flags
KVM: arm64: Reduce the size of the vcpu flag members
KVM: arm64: Document why pause cannot be turned into a flag
KVM: arm64: Move the handling of !FP outside of the fast path
arch/arm64/include/asm/kvm_emulate.h | 11 +- arch/arm64/include/asm/kvm_host.h | 203 +++++++++++++++------ arch/arm64/kvm/arch_timer.c | 2 +- arch/arm64/kvm/arm.c | 12 +- arch/arm64/kvm/debug.c | 25 ++- arch/arm64/kvm/fpsimd.c | 37 ++-- arch/arm64/kvm/handle_exit.c | 2 +- arch/arm64/kvm/hyp/exception.c | 23 ++- arch/arm64/kvm/hyp/include/hyp/debug-sr.h | 6 +- arch/arm64/kvm/hyp/include/hyp/switch.h | 24 +-- arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 4 +- arch/arm64/kvm/hyp/nvhe/debug-sr.c | 8 +- arch/arm64/kvm/hyp/nvhe/switch.c | 6 +- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 4 +- arch/arm64/kvm/hyp/vhe/switch.c | 4 +- arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 4 +- arch/arm64/kvm/inject_fault.c | 17 +- arch/arm64/kvm/reset.c | 6 +- arch/arm64/kvm/sys_regs.c | 12 +- 19 files changed, 248 insertions(+), 162 deletions(-)
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 1/19 KVM: arm64: Always start with clearing SVE flag on load
On each vcpu load, we set the KVM_ARM64_HOST_SVE_ENABLED flag if SVE is enabled for EL0 on the host. This is used to restore the correct state on vpcu put.
However, it appears that nothing ever clears this flag. Once set, it will stick until the vcpu is destroyed, which has the potential to spuriously enable SVE for userspace.
We probably never saw the issue because no VMM uses SVE, but that's still pretty bad. Unconditionally clearing the flag on vcpu load addresses the issue.
--- arch/arm64/kvm/fpsimd.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kvm/fpsimd.c +1 -0
@@ -80,6 +80,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) vcpu->arch.flags &= ~KVM_ARM64_FP_ENABLED ; vcpu->arch.flags |=KVM_ARM64_FP_HOST ; + vcpu->arch.flags &= ~KVM_ARM64_HOST_SVE_ENABLED ;if (read_sysreg (cpacr_el1) &CPACR_EL1_ZEN_EL0EN ) vcpu->arch.flags |=KVM_ARM64_HOST_SVE_ENABLED ;
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 2/19 KVM: arm64: Always start with clearing SME flag on load
In reply to Marc ZyngierOn each vcpu load, we set the KVM_ARM64_HOST_SME_ENABLED flag if SME is enabled for EL0 on the host. This is used to restore the correct state on vpcu put.
However, it appears that nothing ever clears this flag. Once set, it will stick until the vcpu is destroyed, which has the potential to spuriously enable SME for userspace. As it turns out, this is due to the SME code being more or less copied from SVE, and inheriting the same shortcomings.
We never saw the issue because nothing uses SME, and the amount of testing is probably still pretty low.
--- arch/arm64/kvm/fpsimd.c | 1 + 1 file changed, 1 insertion(+)
arch/arm64/kvm/fpsimd.c +1 -0
@@ -94,6 +94,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)* operations. Do this for ZA as well for now for simplicity. */ if (system_supports_sme ()) { + vcpu->arch.flags &= ~KVM_ARM64_HOST_SME_ENABLED ;if (read_sysreg (cpacr_el1) &CPACR_EL1_SMEN_EL0EN ) vcpu->arch.flags |=KVM_ARM64_HOST_SME_ENABLED ;
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 3/19 KVM: arm64: Drop FP_FOREIGN_STATE from the hypervisor code
In reply to Marc ZyngierThe vcpu KVM_ARM64_FP_FOREIGN_FPSTATE flag tracks the thread's own TIF_FOREIGN_FPSTATE so that we can evaluate just before running the vcpu whether it the FP regs contain something that is owned by the vcpu or not by updating the rest of the FP flags.
We do this in the hypervisor code in order to make sure we're in a context where we are not interruptible. But we already have a hook in the run loop to generate this flag. We may as well update the FP flags directly and save the pointless flag tracking.
Whilst we're at it, rename update_fp_enabled() to guest_owns_fp_regs() to indicate what the leftover of this helper actually do.
--- arch/arm64/include/asm/kvm_host.h | 1 - arch/arm64/kvm/fpsimd.c | 17 ++++++++++------- arch/arm64/kvm/hyp/include/hyp/switch.h | 16 ++-------------- arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- 5 files changed, 14 insertions(+), 24 deletions(-)
arch/arm64/include/asm/kvm_host.h +0 -1
@@ -462,7 +462,6 @@ struct kvm_vcpu_arch {#define KVM_ARM64_DEBUG_STATE_SAVE_SPE (1 << 12)/* Save SPE context if active */ #define KVM_ARM64_DEBUG_STATE_SAVE_TRBE (1 << 13)/* Save TRBE context if active */ -#define KVM_ARM64_FP_FOREIGN_FPSTATE (1 << 14)#define KVM_ARM64_ON_UNSUPPORTED_CPU (1 << 15)/* Physical CPU not in supported_cpus */ #define KVM_ARM64_HOST_SME_ENABLED (1 << 16)/* SME enabled for EL0 */ #define KVM_ARM64_WFIT (1 << 17)/* WFIT instruction trapped */
arch/arm64/kvm/fpsimd.c +10 -7
@@ -107,16 +107,19 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) }/* -* Called just before entering the guest once we are no longer -* preemptable. Syncs the host's TIF_FOREIGN_FPSTATE with the KVM -* mirror of the flag used by the hypervisor. +* Called just before entering the guest once we are no longer preemptable +* and interrupts are disabled. If we have managed to run anything using +* FP while we were preemptible (such as off the back of an interrupt), +* then neither the host nor the guest own the FP hardware (and it was the +* responsibility of the code that used FP to save the existing state). +* +* Note that not supporting FP is basically the same thing as far as the +* hypervisor is concerned (nothing to save). */ void kvm_arch_vcpu_ctxflush_fp (struct kvm_vcpu *vcpu) { -if (test_thread_flag (TIF_FOREIGN_FPSTATE )) - vcpu->arch.flags |=KVM_ARM64_FP_FOREIGN_FPSTATE ; -else - vcpu->arch.flags &= ~KVM_ARM64_FP_FOREIGN_FPSTATE ; +if (!system_supports_fpsimd () ||test_thread_flag (TIF_FOREIGN_FPSTATE )) + vcpu->arch.flags &= ~(KVM_ARM64_FP_ENABLED |KVM_ARM64_FP_HOST ); }/*
arch/arm64/kvm/hyp/include/hyp/switch.h +2 -14
@@ -37,21 +37,9 @@ struct kvm_exception_table_entry {extern struct kvm_exception_table_entry __start___kvm_ex_table;extern struct kvm_exception_table_entry __stop___kvm_ex_table; -/* Check whether the FP regs were dirtied while in the host-side run loop: */ -static inline bool update_fp_enabled (struct kvm_vcpu *vcpu) +/* Check whether the FP regs are owned by the guest */ +static inline bool guest_owns_fp_regs (struct kvm_vcpu *vcpu) { -/* -* When the system doesn't support FP/SIMD, we cannot rely on -* the _TIF_FOREIGN_FPSTATE flag. However, we always inject an -* abort on the very first access to FP and thus we should never -* see KVM_ARM64_FP_ENABLED. For added safety, make sure we always -* trap the accesses. -*/ -if (!system_supports_fpsimd () || - vcpu->arch.flags &KVM_ARM64_FP_FOREIGN_FPSTATE ) - vcpu->arch.flags &= ~(KVM_ARM64_FP_ENABLED | -KVM_ARM64_FP_HOST ); -return !!(vcpu->arch.flags &KVM_ARM64_FP_ENABLED ); }
arch/arm64/kvm/hyp/nvhe/switch.c +1 -1
@@ -43,7 +43,7 @@ static void __activate_traps(struct kvm_vcpu *vcpu) val = vcpu->arch.cptr_el2; val |=CPTR_EL2_TTA |CPTR_EL2_TAM ; -if (!update_fp_enabled (vcpu)) { +if (!guest_owns_fp_regs (vcpu)) { val |=CPTR_EL2_TFP |CPTR_EL2_TZ ;__activate_traps_fpsimd32 (vcpu); }
arch/arm64/kvm/hyp/vhe/switch.c +1 -1
@@ -55,7 +55,7 @@ static void __activate_traps(struct kvm_vcpu *vcpu) val |=CPTR_EL2_TAM ; -if (update_fp_enabled (vcpu)) { +if (guest_owns_fp_regs (vcpu)) {if (vcpu_has_sve (vcpu)) val |=CPACR_EL1_ZEN_EL0EN |CPACR_EL1_ZEN_EL1EN ; }else {
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 4/19 KVM: arm64: Move FP state ownership from flag to a tristate
In reply to Marc ZyngierThe KVM FP code uses a pair of flags to denote three states:
- FP_ENABLED set: the guest owns the FP state
- FP_HOST set: the host owns the FP state
- FP_ENABLED and FP_HOST clear: nobody owns the FP state at all
and both flags set is an illegal state, which nothing ever checks for...
As it turns out, this isn't really a good match for flags, and we'd be better off if this was a simpler tristate, each state having a name that actually reflect the state:
- FP_STATE_FREE
- FP_STATE_HOST_OWNED
- FP_STATE_GUEST_OWNED
Kill the two flags, and move over to an enum encoding these three states. This results in less confusing code, and less risk of ending up in the uncharted territory of a 4th state if we forget to clear one of the two flags.
--- arch/arm64/include/asm/kvm_host.h | 9 +++++++-- arch/arm64/kvm/fpsimd.c | 14 ++++++-------- arch/arm64/kvm/hyp/include/hyp/switch.h | 8 +++----- arch/arm64/kvm/hyp/nvhe/switch.c | 4 ++-- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- 5 files changed, 19 insertions(+), 18 deletions(-)
arch/arm64/include/asm/kvm_host.h +7 -2
@@ -325,6 +325,13 @@ struct kvm_vcpu_arch {/* Exception Information */ struct kvm_vcpu_fault_info fault; +/* Ownership of the FP regs */ +enum { +FP_STATE_FREE , +FP_STATE_HOST_OWNED , +FP_STATE_GUEST_OWNED , + } fp_state; +/* Miscellaneous vcpu state flags */ u64 flags;
@@ -430,8 +437,6 @@ struct kvm_vcpu_arch {/* vcpu_arch flags field values: */ #define KVM_ARM64_DEBUG_DIRTY (1 << 0) -#define KVM_ARM64_FP_ENABLED (1 << 1)/* guest FP regs loaded */ -#define KVM_ARM64_FP_HOST (1 << 2)/* host FP regs loaded */ #define KVM_ARM64_HOST_SVE_ENABLED (1 << 4)/* SVE enabled for EL0 */ #define KVM_ARM64_GUEST_HAS_SVE (1 << 5)/* SVE exposed to guest */ #define KVM_ARM64_VCPU_SVE_FINALIZED (1 << 6)/* SVE config completed */
arch/arm64/kvm/fpsimd.c +6 -8
@@ -77,8 +77,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)BUG_ON (!current->mm);BUG_ON (test_thread_flag (TIF_SVE )); - vcpu->arch.flags &= ~KVM_ARM64_FP_ENABLED ; - vcpu->arch.flags |=KVM_ARM64_FP_HOST ; + vcpu->arch.fp_state =FP_STATE_HOST_OWNED ; vcpu->arch.flags &= ~KVM_ARM64_HOST_SVE_ENABLED ;if (read_sysreg (cpacr_el1) &CPACR_EL1_ZEN_EL0EN )
@@ -98,9 +97,8 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)if (read_sysreg (cpacr_el1) &CPACR_EL1_SMEN_EL0EN ) vcpu->arch.flags |=KVM_ARM64_HOST_SME_ENABLED ; -if (read_sysreg_s (SYS_SVCR ) & - (SVCR_SM_MASK |SVCR_ZA_MASK )) { - vcpu->arch.flags &= ~KVM_ARM64_FP_HOST ; +if (read_sysreg_s (SYS_SVCR ) & (SVCR_SM_MASK |SVCR_ZA_MASK )) { + vcpu->arch.fp_state =FP_STATE_FREE ;fpsimd_save_and_flush_cpu_state (); } }
@@ -119,7 +117,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)void kvm_arch_vcpu_ctxflush_fp (struct kvm_vcpu *vcpu) {if (!system_supports_fpsimd () ||test_thread_flag (TIF_FOREIGN_FPSTATE )) - vcpu->arch.flags &= ~(KVM_ARM64_FP_ENABLED |KVM_ARM64_FP_HOST ); + vcpu->arch.fp_state =FP_STATE_FREE ; }/*
@@ -133,7 +131,7 @@ void kvm_arch_vcpu_ctxsync_fp(struct kvm_vcpu *vcpu) {WARN_ON_ONCE (!irqs_disabled ()); -if (vcpu->arch.flags &KVM_ARM64_FP_ENABLED ) { +if (vcpu->arch.fp_state ==FP_STATE_GUEST_OWNED ) {/* * Currently we do not support SME guests so SVCR is * always 0 and we just need a variable to point to.
@@ -176,7 +174,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu) CPACR_EL1_SMEN_EL1EN); } -if (vcpu->arch.flags &KVM_ARM64_FP_ENABLED ) { +if (vcpu->arch.fp_state ==FP_STATE_GUEST_OWNED ) {if (vcpu_has_sve (vcpu)) {__vcpu_sys_reg (vcpu,ZCR_EL1 ) =read_sysreg_el1 (SYS_ZCR );
arch/arm64/kvm/hyp/include/hyp/switch.h +3 -5
@@ -40,7 +40,7 @@ extern struct kvm_exception_table_entry __stop___kvm_ex_table;/* Check whether the FP regs are owned by the guest */ static inline bool guest_owns_fp_regs (struct kvm_vcpu *vcpu) { -return !!(vcpu->arch.flags &KVM_ARM64_FP_ENABLED ); +return vcpu->arch.fp_state ==FP_STATE_GUEST_OWNED ; }/* Save the 32-bit only FPSIMD system register state */
@@ -179,10 +179,8 @@ static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)isb ();/* Write out the host state if it's in the registers */ -if (vcpu->arch.flags &KVM_ARM64_FP_HOST ) { +if (vcpu->arch.fp_state ==FP_STATE_HOST_OWNED )__fpsimd_save_state (vcpu->arch.host_fpsimd_state); - vcpu->arch.flags &= ~KVM_ARM64_FP_HOST ; - }/* Restore the guest state */ if (sve_guest)
@@ -194,7 +192,7 @@ static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code)if (!(read_sysreg (hcr_el2) &HCR_RW ))write_sysreg (__vcpu_sys_reg (vcpu,FPEXC32_EL2 ), fpexc32_el2); - vcpu->arch.flags |=KVM_ARM64_FP_ENABLED ; + vcpu->arch.fp_state =FP_STATE_GUEST_OWNED ;return true; }
arch/arm64/kvm/hyp/nvhe/switch.c +2 -2
@@ -123,7 +123,7 @@ static void __deactivate_traps(struct kvm_vcpu *vcpu) } cptr =CPTR_EL2_DEFAULT ; -if (vcpu_has_sve (vcpu) && (vcpu->arch.flags &KVM_ARM64_FP_ENABLED )) +if (vcpu_has_sve (vcpu) && (vcpu->arch.fp_state ==FP_STATE_GUEST_OWNED )) cptr |=CPTR_EL2_TZ ;if (cpus_have_final_cap (ARM64_SME )) cptr &= ~CPTR_EL2_TSM ;
@@ -335,7 +335,7 @@ int __kvm_vcpu_run(struct kvm_vcpu *vcpu)__sysreg_restore_state_nvhe (host_ctxt); -if (vcpu->arch.flags &KVM_ARM64_FP_ENABLED ) +if (vcpu->arch.fp_state ==FP_STATE_GUEST_OWNED )__fpsimd_save_fpexc32 (vcpu);__debug_switch_to_host (vcpu);
arch/arm64/kvm/hyp/vhe/switch.c +1 -1
@@ -175,7 +175,7 @@ static int __kvm_vcpu_run_vhe(struct kvm_vcpu *vcpu)sysreg_restore_host_state_vhe (host_ctxt); -if (vcpu->arch.flags &KVM_ARM64_FP_ENABLED ) +if (vcpu->arch.fp_state ==FP_STATE_GUEST_OWNED )__fpsimd_save_fpexc32 (vcpu);__debug_switch_to_host (vcpu);
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 5/19 KVM: arm64: Add helpers to manipulate vcpu flags among a set
In reply to Marc ZyngierCareful analysis of the vcpu flags show that this is a mix of configuration, communication between the host and the hypervisor, as well as anciliary state that has no consistency. It'd be a lot better if we could split these flags into consistent categories.
However, even if we split these flags apart, we want to make sure that each flag can only be applied to its own set, and not across sets.
To achieve this, use a preprocessor hack so that each flag is always associated with:
- the set that contains it,
- a mask that describe all the bits that contain it (for a simple flag, this is the same thing as the flag itself, but we will eventually have values that cover multiple bits at once).
Each flag is thus a triplet that is not directly usable as a value, but used by three helpers that allow the flag to be set, cleared, and fetched. By mandating the use of such helper, we can easily enforce that a flag can only be used with the set it belongs to.
Finally, one last helper "unpacks" the raw value from the triplet that represents a flag, which is useful for multi-bit values that need to be enumerated (in a switch statement, for example).
Further patches will start making use of this infrastructure.
--- arch/arm64/include/asm/kvm_host.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
arch/arm64/include/asm/kvm_host.h +44 -0
@@ -415,6 +415,50 @@ struct kvm_vcpu_arch { } steal; }; +/* +* Each 'flag' is composed of a comma-separated triplet: +* +* - the flag-set it belongs to in the vcpu->arch structure +* - the value for that flag +* - the mask for that flag +* +* __vcpu_single_flag() builds such a triplet for a single-bit flag. +* unpack_vcpu_flag() extract the flag value from the triplet for +* direct use outside of the flag accessors. +*/ +#define __vcpu_single_flag (_set, _f) _set, (_f), (_f) + +#define __unpack_flag (_set, _f, _m) _f +#define unpack_vcpu_flag (...) __unpack_flag(__VA_ARGS__) + +#define __vcpu_get_flag (v, flagset, f, m) \ + ({ \ + v->arch.flagset & (m); \ + }) + +#define __vcpu_set_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + if (HWEIGHT(m) > 1) \ + *fset &= ~(m); \ + *fset |= (f); \ + } while (0) + +#define __vcpu_clear_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + *fset &= ~(m); \ + } while (0) + +#define vcpu_get_flag (v, ...) __vcpu_get_flag((v), __VA_ARGS__) +#define vcpu_set_flag (v, ...) __vcpu_set_flag((v), __VA_ARGS__) +#define vcpu_clear_flag (v, ...) __vcpu_clear_flag((v), __VA_ARGS__) + +/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \ sve_ffr_offset((vcpu)->arch.sve_max_vl))
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v2 05/19] KVM: arm64: Add helpers to manipulate vcpu flags among a set
Hi Marc,
Quoted 80 lines · Marc Zyngier
Careful analysis of the vcpu flags show that this is a mix of configuration, communication between the host and the hypervisor, as well as anciliary state that has no consistency. It'd be a lot better if we could split these flags into consistent categories.
However, even if we split these flags apart, we want to make sure that each flag can only be applied to its own set, and not across sets.
To achieve this, use a preprocessor hack so that each flag is always associated with:
- the set that contains it,
- a mask that describe all the bits that contain it (for a simple flag, this is the same thing as the flag itself, but we will eventually have values that cover multiple bits at once).
Each flag is thus a triplet that is not directly usable as a value, but used by three helpers that allow the flag to be set, cleared, and fetched. By mandating the use of such helper, we can easily enforce that a flag can only be used with the set it belongs to.
Finally, one last helper "unpacks" the raw value from the triplet that represents a flag, which is useful for multi-bit values that need to be enumerated (in a switch statement, for example).
Further patches will start making use of this infrastructure.
Signed-off-by Marc Zyngier <[email protected]>--- arch/arm64/include/asm/kvm_host.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)arch/arm64/include/asm/kvm_host.h +37
-0@@ -415,6 +415,50 @@ struct kvm_vcpu_arch { } steal; }; +/* +* Each 'flag' is composed of a comma-separated triplet: +* +* - the flag-set it belongs to in the vcpu->arch structure +* - the value for that flag +* - the mask for that flag +* +* __vcpu_single_flag() builds such a triplet for a single-bit flag. +* unpack_vcpu_flag() extract the flag value from the triplet for +* direct use outside of the flag accessors. +*/ +#define __vcpu_single_flag (_set, _f) _set, (_f), (_f) + +#define __unpack_flag (_set, _f, _m) _f +#define unpack_vcpu_flag (...) __unpack_flag(__VA_ARGS__) + +#define __vcpu_get_flag (v, flagset, f, m) \ + ({ \ + v->arch.flagset & (m); \ + }) + +#define __vcpu_set_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + if (HWEIGHT(m) > 1) \ + *fset &= ~(m); \ + *fset |= (f); \ + } while (0) + +#define __vcpu_clear_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + *fset &= ~(m); \
arch/arm64/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 464
Quoted 10 lines
arch/arm64/include/asm/kvm_host.h +7
-0+ } while (0) + +#define vcpu_get_flag (v, ...) __vcpu_get_flag((v), __VA_ARGS__) +#define vcpu_set_flag (v, ...) __vcpu_set_flag((v), __VA_ARGS__) +#define vcpu_clear_flag (v, ...) __vcpu_clear_flag((v), __VA_ARGS__) + +/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \ sve_ffr_offset((vcpu)->arch.sve_max_vl))
A bit of macro magic going on here, but with some help I think I've wrapped my head around it. With that
Cheers,
/fuad
Quoted 3 lines
--
2.34.1
Re: [PATCH v2 05/19] KVM: arm64: Add helpers to manipulate vcpu flags among a set
In reply to Marc ZyngierQuoted 71 lines · Marc Zyngier
Careful analysis of the vcpu flags show that this is a mix of configuration, communication between the host and the hypervisor, as well as anciliary state that has no consistency. It'd be a lot better if we could split these flags into consistent categories.
However, even if we split these flags apart, we want to make sure that each flag can only be applied to its own set, and not across sets.
To achieve this, use a preprocessor hack so that each flag is always associated with:
- the set that contains it,
- a mask that describe all the bits that contain it (for a simple flag, this is the same thing as the flag itself, but we will eventually have values that cover multiple bits at once).
Each flag is thus a triplet that is not directly usable as a value, but used by three helpers that allow the flag to be set, cleared, and fetched. By mandating the use of such helper, we can easily enforce that a flag can only be used with the set it belongs to.
Finally, one last helper "unpacks" the raw value from the triplet that represents a flag, which is useful for multi-bit values that need to be enumerated (in a switch statement, for example).
Further patches will start making use of this infrastructure.
Signed-off-by Marc Zyngier <[email protected]>--- arch/arm64/include/asm/kvm_host.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)arch/arm64/include/asm/kvm_host.h +28
-0@@ -415,6 +415,50 @@ struct kvm_vcpu_arch { } steal; }; +/* +* Each 'flag' is composed of a comma-separated triplet: +* +* - the flag-set it belongs to in the vcpu->arch structure +* - the value for that flag +* - the mask for that flag +* +* __vcpu_single_flag() builds such a triplet for a single-bit flag. +* unpack_vcpu_flag() extract the flag value from the triplet for +* direct use outside of the flag accessors. +*/ +#define __vcpu_single_flag (_set, _f) _set, (_f), (_f) + +#define __unpack_flag (_set, _f, _m) _f +#define unpack_vcpu_flag (...) __unpack_flag(__VA_ARGS__) + +#define __vcpu_get_flag (v, flagset, f, m) \ + ({ \ + v->arch.flagset & (m); \ + }) + +#define __vcpu_set_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + if (HWEIGHT(m) > 1) \ + *fset &= ~(m); \
arch/arm64/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 455
Quoted 10 lines
arch/arm64/include/asm/kvm_host.h +10
-0+ *fset |= (f); \ + } while (0) + +#define __vcpu_clear_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + *fset &= ~(m); \ + } while (0)
IMHO I would prefer to have 'v' enclosed in parentheses in the implementation of __vcpu_{get,set,clear}_flag rather than in the implementation of vcpu_{get,set,clear}_flag though. (That was what I meant in my comment for v1)
Thanks,
Reiji
Quoted 11 lines
arch/arm64/include/asm/kvm_host.h +5
-1+#define vcpu_get_flag (v, ...) __vcpu_get_flag((v), __VA_ARGS__) +#define vcpu_set_flag (v, ...) __vcpu_set_flag((v), __VA_ARGS__) +#define vcpu_clear_flag (v, ...) __vcpu_clear_flag((v), __VA_ARGS__) + +/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \ sve_ffr_offset((vcpu)->arch.sve_max_vl)) --2.34.1
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerRe: [PATCH v2 05/19] KVM: arm64: Add helpers to manipulate vcpu flags among a set
Quoted 86 lines · Reiji Watanabe
Quoted 71 lines · Marc Zyngier
Careful analysis of the vcpu flags show that this is a mix of configuration, communication between the host and the hypervisor, as well as anciliary state that has no consistency. It'd be a lot better if we could split these flags into consistent categories.
However, even if we split these flags apart, we want to make sure that each flag can only be applied to its own set, and not across sets.
To achieve this, use a preprocessor hack so that each flag is always associated with:
- the set that contains it,
- a mask that describe all the bits that contain it (for a simple flag, this is the same thing as the flag itself, but we will eventually have values that cover multiple bits at once).
Each flag is thus a triplet that is not directly usable as a value, but used by three helpers that allow the flag to be set, cleared, and fetched. By mandating the use of such helper, we can easily enforce that a flag can only be used with the set it belongs to.
Finally, one last helper "unpacks" the raw value from the triplet that represents a flag, which is useful for multi-bit values that need to be enumerated (in a switch statement, for example).
Further patches will start making use of this infrastructure.
Signed-off-by Marc Zyngier <[email protected]>--- arch/arm64/include/asm/kvm_host.h | 44 +++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)arch/arm64/include/asm/kvm_host.h +28
-0@@ -415,6 +415,50 @@ struct kvm_vcpu_arch { } steal; }; +/* +* Each 'flag' is composed of a comma-separated triplet: +* +* - the flag-set it belongs to in the vcpu->arch structure +* - the value for that flag +* - the mask for that flag +* +* __vcpu_single_flag() builds such a triplet for a single-bit flag. +* unpack_vcpu_flag() extract the flag value from the triplet for +* direct use outside of the flag accessors. +*/ +#define __vcpu_single_flag (_set, _f) _set, (_f), (_f) + +#define __unpack_flag (_set, _f, _m) _f +#define unpack_vcpu_flag (...) __unpack_flag(__VA_ARGS__) + +#define __vcpu_get_flag (v, flagset, f, m) \ + ({ \ + v->arch.flagset & (m); \ + }) + +#define __vcpu_set_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + if (HWEIGHT(m) > 1) \ + *fset &= ~(m); \arch/arm64/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 455
Quoted 10 lines
arch/arm64/include/asm/kvm_host.h +10
-0+ *fset |= (f); \ + } while (0) + +#define __vcpu_clear_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *fset; \ + \ + fset = &v->arch.flagset; \ + *fset &= ~(m); \ + } while (0)Reviewed-by Reiji Watanabe <[email protected]>
Quoted 4 lines
IMHO I would prefer to have 'v' enclosed in parentheses in the implementation of __vcpu_{get,set,clear}_flag rather than in the implementation of vcpu_{get,set,clear}_flag though. (That was what I meant in my comment for v1)
I understood what you were asking the first place, but I don't think this has any advantage over what is above. __vcpu_{get,set,clear}_flag are not meant to be used directly, and adding extra bracketing to these only makes them more painful to read.
If you can show a case where it breaks, I'll be happy to revisit this.
Thanks,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Marc Zyngier
maintainerPATCH v2 6/19 KVM: arm64: Add three sets of flags to the vcpu state
In reply to Marc ZyngierIt so appears that each of the vcpu flags is really belonging to one of three categories:
- a configuration flag, set once and for all
- an input flag generated by the kernel for the hypervisor to use
- a state flag that is only for the kernel's own bookkeeping
As we are going to split all the existing flags into these three sets, introduce all three in one go.
No functional change other than a bit of bloat...
--- arch/arm64/include/asm/kvm_host.h | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm64/include/asm/kvm_host.h +9 -0
@@ -335,6 +335,15 @@ struct kvm_vcpu_arch {/* Miscellaneous vcpu state flags */ u64 flags; +/* Configuration flags, set once and for all before the vcpu can run */ +u64 cflags; + +/* Input flags to the hypervisor code, potentially cleared after use */ +u64 iflags; + +/* State flags for kernel bookkeeping, unused by the hypervisor code */ +u64 sflags; +/* * We maintain more than a single set of debug registers to support * debugging the guest from the host and to maintain separate host and
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v2 06/19] KVM: arm64: Add three sets of flags to the vcpu state
Quoted 25 lines · Marc Zyngier
It so appears that each of the vcpu flags is really belonging to one of three categories:
- a configuration flag, set once and for all
- an input flag generated by the kernel for the hypervisor to use
- a state flag that is only for the kernel's own bookkeepingAs we are going to split all the existing flags into these three sets, introduce all three in one go.
No functional change other than a bit of bloat...
Reviewed-by Fuad Tabba <[email protected]>Signed-off-by Marc Zyngier <[email protected]>--- arch/arm64/include/asm/kvm_host.h | 9 +++++++++ 1 file changed, 9 insertions(+)arch/arm64/include/asm/kvm_host.h +0
-0@@ -335,6 +335,15 @@ struct kvm_vcpu_arch {/* Miscellaneous vcpu state flags */
arch/arm64/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 345
Quoted 10 lines
arch/arm64/include/asm/kvm_host.h +8
-0u64 flags; +/* Configuration flags, set once and for all before the vcpu can run */ +u64 cflags; + +/* Input flags to the hypervisor code, potentially cleared after use */ +u64 iflags; + +/* State flags for kernel bookkeeping, unused by the hypervisor code */ +u64 sflags;
Thank you, those comments are more clear to me now.
Thanks,
Reiji
Quoted 7 lines
arch/arm64/include/asm/kvm_host.h +1
-1+/* * We maintain more than a single set of debug registers to support * debugging the guest from the host and to maintain separate host and -- 2.34.1
Marc Zyngier
maintainerPATCH v2 7/19 KVM: arm64: Move vcpu configuration flags into their own set
In reply to Marc ZyngierThe KVM_ARM64_{GUEST_HAS_SVE,VCPU_SVE_FINALIZED,GUEST_HAS_PTRAUTH} flags are purely configuration flags. Once set, they are never cleared, but evaluated all over the code base.
Move these three flags into the configuration set in one go, using the new accessors, and take this opportunity to drop the KVM_ARM64_ prefix which doesn't provide any help.
--- arch/arm64/include/asm/kvm_host.h | 17 ++++++++++------- arch/arm64/kvm/reset.c | 6 +++--- 2 files changed, 13 insertions(+), 10 deletions(-)
arch/arm64/include/asm/kvm_host.h +10 -7
@@ -467,6 +467,13 @@ struct kvm_vcpu_arch {#define vcpu_set_flag (v, ...) __vcpu_set_flag((v), __VA_ARGS__)#define vcpu_clear_flag (v, ...) __vcpu_clear_flag((v), __VA_ARGS__) +/* SVE exposed to guest */ +#define GUEST_HAS_SVE __vcpu_single_flag(cflags, BIT(0)) +/* SVE config completed */ +#define VCPU_SVE_FINALIZED __vcpu_single_flag(cflags, BIT(1)) +/* PTRAUTH exposed to guest */ +#define GUEST_HAS_PTRAUTH __vcpu_single_flag(cflags, BIT(2)) +/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \
@@ -491,9 +498,6 @@ struct kvm_vcpu_arch {/* vcpu_arch flags field values: */ #define KVM_ARM64_DEBUG_DIRTY (1 << 0)#define KVM_ARM64_HOST_SVE_ENABLED (1 << 4)/* SVE enabled for EL0 */ -#define KVM_ARM64_GUEST_HAS_SVE (1 << 5)/* SVE exposed to guest */ -#define KVM_ARM64_VCPU_SVE_FINALIZED (1 << 6)/* SVE config completed */ -#define KVM_ARM64_GUEST_HAS_PTRAUTH (1 << 7)/* PTRAUTH exposed to guest */ #define KVM_ARM64_PENDING_EXCEPTION (1 << 8)/* Exception pending */ /* * Overlaps with KVM_ARM64_EXCEPT_MASK on purpose so that it can't be
@@ -530,13 +534,13 @@ struct kvm_vcpu_arch { KVM_GUESTDBG_SINGLESTEP)#define vcpu_has_sve (vcpu) (system_supports_sve() && \ - ((vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_SVE)) + vcpu_get_flag(vcpu, GUEST_HAS_SVE))#ifdef CONFIG_ARM64_PTR_AUTH #define vcpu_has_ptrauth (vcpu) \ ((cpus_have_final_cap(ARM64_HAS_ADDRESS_AUTH) || \ cpus_have_final_cap(ARM64_HAS_GENERIC_AUTH)) && \ - (vcpu)->arch.flags & KVM_ARM64_GUEST_HAS_PTRAUTH) + vcpu_get_flag(vcpu, GUEST_HAS_PTRAUTH))#else #define vcpu_has_ptrauth (vcpu) false#endif
@@ -893,8 +897,7 @@ void kvm_init_protected_traps(struct kvm_vcpu *vcpu);int kvm_arm_vcpu_finalize (struct kvm_vcpu *vcpu,int feature);bool kvm_arm_vcpu_is_finalized (struct kvm_vcpu *vcpu); -#define kvm_arm_vcpu_sve_finalized (vcpu) \ - ((vcpu)->arch.flags & KVM_ARM64_VCPU_SVE_FINALIZED) +#define kvm_arm_vcpu_sve_finalized (vcpu) vcpu_get_flag(vcpu, VCPU_SVE_FINALIZED)#define kvm_has_mte (kvm) \ (system_supports_mte() && \
arch/arm64/kvm/reset.c +3 -3
@@ -81,7 +81,7 @@ static int kvm_vcpu_enable_sve(struct kvm_vcpu *vcpu)* KVM_REG_ARM64_SVE_VLS. Allocation is deferred until * kvm_arm_vcpu_finalize(), which freezes the configuration. */ - vcpu->arch.flags |=KVM_ARM64_GUEST_HAS_SVE ; +vcpu_set_flag (vcpu,GUEST_HAS_SVE );return 0 ; }
@@ -120,7 +120,7 @@ static int kvm_vcpu_finalize_sve(struct kvm_vcpu *vcpu) } vcpu->arch.sve_state = buf; - vcpu->arch.flags |=KVM_ARM64_VCPU_SVE_FINALIZED ; +vcpu_set_flag (vcpu,VCPU_SVE_FINALIZED );return 0 ; }
@@ -177,7 +177,7 @@ static int kvm_vcpu_enable_ptrauth(struct kvm_vcpu *vcpu) !system_has_full_ptr_auth())return -EINVAL ; - vcpu->arch.flags |=KVM_ARM64_GUEST_HAS_PTRAUTH ; +vcpu_set_flag (vcpu,GUEST_HAS_PTRAUTH );return 0 ; }
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 8/19 KVM: arm64: Move vcpu PC/Exception flags to the input flag set
In reply to Marc ZyngierThe PC update flags (which also deal with exception injection) is one of the most complicated use of the flag we have. Make it more fool prof by:
- moving it over to the new accessors and assign it to the input flag set
- turn the combination of generic ELx flags with another flag indicating the target EL itself into an explicit set of flags for each EL and vector combination
- add a new accessor to pend the exception
This is otherwise a pretty straightformward conversion.
--- arch/arm64/include/asm/kvm_emulate.h | 9 ++++- arch/arm64/include/asm/kvm_host.h | 58 ++++++++++++++++------------ arch/arm64/kvm/arm.c | 4 +- arch/arm64/kvm/hyp/exception.c | 23 ++++++----- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 4 +- arch/arm64/kvm/inject_fault.c | 17 +++----- 6 files changed, 61 insertions(+), 54 deletions(-)
arch/arm64/include/asm/kvm_emulate.h +8 -1
@@ -473,9 +473,16 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu, static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu) { - vcpu->arch.flags |=KVM_ARM64_INCREMENT_PC ; +vcpu_set_flag (vcpu,INCREMENT_PC ); } +#define kvm_pend_exception (v, e) \ + do { \ + vcpu_set_flag((v), PENDING_EXCEPTION); \ + vcpu_set_flag((v), e); \ + } while (0) + +static inline bool vcpu_has_feature (struct kvm_vcpu *vcpu,int feature) {return test_bit (feature, vcpu->arch.features);
arch/arm64/include/asm/kvm_host.h +34 -24
70 lines not on this page · raw message
arch/arm64/kvm/arm.c +2 -2
@@ -1013,8 +1013,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)* the vcpu state. Note that this relies on __kvm_adjust_pc() * being preempt-safe on VHE. */ -if (unlikely (vcpu->arch.flags & (KVM_ARM64_PENDING_EXCEPTION | -KVM_ARM64_INCREMENT_PC ))) +if (unlikely (vcpu_get_flag (vcpu,PENDING_EXCEPTION ) || +vcpu_get_flag (vcpu,INCREMENT_PC )))kvm_call_hyp (__kvm_adjust_pc, vcpu);vcpu_put (vcpu);
arch/arm64/kvm/hyp/exception.c +11 -12
@@ -303,14 +303,14 @@ static void enter_exception32(struct kvm_vcpu *vcpu, u32 mode, u32 vect_offset)static void kvm_inject_exception (struct kvm_vcpu *vcpu) {if (vcpu_el1_is_32bit (vcpu)) { -switch (vcpu->arch.flags &KVM_ARM64_EXCEPT_MASK ) { -case KVM_ARM64_EXCEPT_AA32_UND : +switch (vcpu_get_flag (vcpu,EXCEPT_MASK )) { +case unpack_vcpu_flag (EXCEPT_AA32_UND ):enter_exception32 (vcpu,PSR_AA32_MODE_UND ,4 );break ; -case KVM_ARM64_EXCEPT_AA32_IABT : +case unpack_vcpu_flag (EXCEPT_AA32_IABT ):enter_exception32 (vcpu,PSR_AA32_MODE_ABT ,12 );break ; -case KVM_ARM64_EXCEPT_AA32_DABT : +case unpack_vcpu_flag (EXCEPT_AA32_DABT ):enter_exception32 (vcpu,PSR_AA32_MODE_ABT ,16 );break ;default :
@@ -318,9 +318,8 @@ static void kvm_inject_exception(struct kvm_vcpu *vcpu)break ; } }else { -switch (vcpu->arch.flags &KVM_ARM64_EXCEPT_MASK ) { -case (KVM_ARM64_EXCEPT_AA64_ELx_SYNC | -KVM_ARM64_EXCEPT_AA64_EL1 ): +switch (vcpu_get_flag (vcpu,EXCEPT_MASK )) { +case unpack_vcpu_flag (EXCEPT_AA64_EL1_SYNC ):enter_exception64 (vcpu, PSR_MODE_EL1h, except_type_sync);break ;default :
@@ -340,12 +339,12 @@ static void kvm_inject_exception(struct kvm_vcpu *vcpu)*/ void __kvm_adjust_pc (struct kvm_vcpu *vcpu) { -if (vcpu->arch.flags &KVM_ARM64_PENDING_EXCEPTION ) { +if (vcpu_get_flag (vcpu,PENDING_EXCEPTION )) {kvm_inject_exception (vcpu); - vcpu->arch.flags &= ~(KVM_ARM64_PENDING_EXCEPTION | -KVM_ARM64_EXCEPT_MASK ); - }else if (vcpu->arch.flags &KVM_ARM64_INCREMENT_PC ) { +vcpu_clear_flag (vcpu,PENDING_EXCEPTION ); +vcpu_clear_flag (vcpu,EXCEPT_MASK ); + }else if (vcpu_get_flag (vcpu,INCREMENT_PC )) {kvm_skip_instr (vcpu); - vcpu->arch.flags &= ~KVM_ARM64_INCREMENT_PC ; +vcpu_clear_flag (vcpu,INCREMENT_PC ); } }
arch/arm64/kvm/hyp/nvhe/sys_regs.c +1 -3
@@ -38,9 +38,7 @@ static void inject_undef64(struct kvm_vcpu *vcpu) *vcpu_pc (vcpu) =read_sysreg_el2 (SYS_ELR ); *vcpu_cpsr (vcpu) =read_sysreg_el2 (SYS_SPSR ); - vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA64_EL1 | - KVM_ARM64_EXCEPT_AA64_ELx_SYNC | -KVM_ARM64_PENDING_EXCEPTION ); +kvm_pend_exception (vcpu,EXCEPT_AA64_EL1_SYNC );__kvm_adjust_pc (vcpu);
arch/arm64/kvm/inject_fault.c +5 -12
@@ -20,9 +20,7 @@ static void inject_abt64(struct kvm_vcpu *vcpu, bool is_iabt, unsigned long addrbool is_aarch32 =vcpu_mode_is_32bit (vcpu);u64 esr =0 ; - vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA64_EL1 | - KVM_ARM64_EXCEPT_AA64_ELx_SYNC | -KVM_ARM64_PENDING_EXCEPTION ); +kvm_pend_exception (vcpu,EXCEPT_AA64_EL1_SYNC );vcpu_write_sys_reg (vcpu, addr,FAR_EL1 );
@@ -52,9 +50,7 @@ static void inject_undef64(struct kvm_vcpu *vcpu) {u64 esr = (ESR_ELx_EC_UNKNOWN << ESR_ELx_EC_SHIFT); - vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA64_EL1 | - KVM_ARM64_EXCEPT_AA64_ELx_SYNC | -KVM_ARM64_PENDING_EXCEPTION ); +kvm_pend_exception (vcpu,EXCEPT_AA64_EL1_SYNC );/* * Build an unknown exception, depending on the instruction
@@ -73,8 +69,7 @@ static void inject_undef64(struct kvm_vcpu *vcpu)static void inject_undef32 (struct kvm_vcpu *vcpu) { - vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA32_UND | -KVM_ARM64_PENDING_EXCEPTION ); +kvm_pend_exception (vcpu,EXCEPT_AA32_UND ); }/*
@@ -97,14 +92,12 @@ static void inject_abt32(struct kvm_vcpu *vcpu, bool is_pabt, u32 addr) far =vcpu_read_sys_reg (vcpu,FAR_EL1 );if (is_pabt) { - vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA32_IABT | -KVM_ARM64_PENDING_EXCEPTION ); +kvm_pend_exception (vcpu,EXCEPT_AA32_IABT ); far &=GENMASK (31 ,0 ); far |= (u64 )addr <<32 ;vcpu_write_sys_reg (vcpu, fsr,IFSR32_EL2 ); }else {/* !iabt */ - vcpu->arch.flags |= (KVM_ARM64_EXCEPT_AA32_DABT | -KVM_ARM64_PENDING_EXCEPTION ); +kvm_pend_exception (vcpu,EXCEPT_AA32_DABT ); far &=GENMASK (63 ,32 ); far |= addr;vcpu_write_sys_reg (vcpu, fsr,ESR_EL1 );
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 9/19 KVM: arm64: Move vcpu debug/SPE/TRBE flags to the input flag set
In reply to Marc ZyngierThe three debug flags (which deal with the debug registers, SPE and TRBE) all are input flags to the hypervisor code.
Move them into the input set and convert them to the new accessors.
--- arch/arm64/include/asm/kvm_host.h | 9 +++++--- arch/arm64/kvm/debug.c | 25 +++++++++++----------- arch/arm64/kvm/hyp/include/hyp/debug-sr.h | 6 +++--- arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h | 4 ++-- arch/arm64/kvm/hyp/nvhe/debug-sr.c | 8 +++---- arch/arm64/kvm/sys_regs.c | 8 +++---- 6 files changed, 31 insertions(+), 29 deletions(-)
arch/arm64/include/asm/kvm_host.h +6 -3
@@ -508,6 +508,12 @@ struct kvm_vcpu_arch {#define EXCEPT_AA64_EL2_IRQ __vcpu_except_flags(5)#define EXCEPT_AA64_EL2_FIQ __vcpu_except_flags(6)#define EXCEPT_AA64_EL2_SERR __vcpu_except_flags(7) +/* Guest debug is live */ +#define DEBUG_DIRTY __vcpu_single_flag(iflags, BIT(4)) +/* Save SPE context if active */ +#define DEBUG_STATE_SAVE_SPE __vcpu_single_flag(iflags, BIT(5)) +/* Save TRBE context if active */ +#define DEBUG_STATE_SAVE_TRBE __vcpu_single_flag(iflags, BIT(6))/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \
@@ -530,10 +536,7 @@ struct kvm_vcpu_arch { })/* vcpu_arch flags field values: */ -#define KVM_ARM64_DEBUG_DIRTY (1 << 0)#define KVM_ARM64_HOST_SVE_ENABLED (1 << 4)/* SVE enabled for EL0 */ -#define KVM_ARM64_DEBUG_STATE_SAVE_SPE (1 << 12)/* Save SPE context if active */ -#define KVM_ARM64_DEBUG_STATE_SAVE_TRBE (1 << 13)/* Save TRBE context if active */ #define KVM_ARM64_ON_UNSUPPORTED_CPU (1 << 15)/* Physical CPU not in supported_cpus */ #define KVM_ARM64_HOST_SME_ENABLED (1 << 16)/* SME enabled for EL0 */ #define KVM_ARM64_WFIT (1 << 17)/* WFIT instruction trapped */
arch/arm64/kvm/debug.c +12 -13
@@ -104,11 +104,11 @@ static void kvm_arm_setup_mdcr_el2(struct kvm_vcpu *vcpu)* Trap debug register access when one of the following is true: * - Userspace is using the hardware to debug the guest * (KVM_GUESTDBG_USE_HW is set). -* - The guest is not using debug (KVM_ARM64_DEBUG_DIRTY is clear). +* - The guest is not using debug (DEBUG_DIRTY clear). * - The guest has enabled the OS Lock (debug exceptions are blocked). */ if ((vcpu->guest_debug &KVM_GUESTDBG_USE_HW ) || - !(vcpu->arch.flags &KVM_ARM64_DEBUG_DIRTY ) || + !vcpu_get_flag (vcpu,DEBUG_DIRTY ) ||kvm_vcpu_os_lock_enabled (vcpu)) vcpu->arch.mdcr_el2 |=MDCR_EL2_TDA ;
@@ -147,8 +147,8 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)* debug related registers. * * Additionally, KVM only traps guest accesses to the debug registers if -* the guest is not actively using them (see the KVM_ARM64_DEBUG_DIRTY -* flag on vcpu->arch.flags). Since the guest must not interfere +* the guest is not actively using them (see the DEBUG_DIRTY +* flag on vcpu->arch.iflags). Since the guest must not interfere * with the hardware state when debugging the guest, we must ensure that * trapping is enabled whenever we are debugging the guest using the * debug registers.
@@ -205,9 +205,8 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)* * We simply switch the debug_ptr to point to our new * external_debug_state which has been populated by the -* debug ioctl. The existing KVM_ARM64_DEBUG_DIRTY -* mechanism ensures the registers are updated on the -* world switch. +* debug ioctl. The existing DEBUG_DIRTY mechanism ensures +* the registers are updated on the world switch. */ if (vcpu->guest_debug &KVM_GUESTDBG_USE_HW ) {/* Enable breakpoints/watchpoints */
@@ -216,7 +215,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)vcpu_write_sys_reg (vcpu, mdscr,MDSCR_EL1 ); vcpu->arch.debug_ptr = &vcpu->arch.external_debug_state; - vcpu->arch.flags |=KVM_ARM64_DEBUG_DIRTY ; +vcpu_set_flag (vcpu,DEBUG_DIRTY ); trace_kvm_arm_set_regset("BKPTS", get_num_brps(), &vcpu->arch.debug_ptr->dbg_bcr[0],
@@ -246,7 +245,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)/* If KDE or MDE are set, perform a full save/restore cycle. */ if (vcpu_read_sys_reg (vcpu,MDSCR_EL1 ) & (DBG_MDSCR_KDE |DBG_MDSCR_MDE )) - vcpu->arch.flags |=KVM_ARM64_DEBUG_DIRTY ; +vcpu_set_flag (vcpu,DEBUG_DIRTY );/* Write mdcr_el2 changes since vcpu_load on VHE systems */ if (has_vhe () && orig_mdcr_el2 != vcpu->arch.mdcr_el2)
@@ -298,16 +297,16 @@ void kvm_arch_vcpu_load_debug_state_flags(struct kvm_vcpu *vcpu)*/ if (cpuid_feature_extract_unsigned_field (dfr0,ID_AA64DFR0_PMSVER_SHIFT ) && !(read_sysreg_s (SYS_PMBIDR_EL1 ) &BIT (SYS_PMBIDR_EL1_P_SHIFT ))) - vcpu->arch.flags |=KVM_ARM64_DEBUG_STATE_SAVE_SPE ; +vcpu_set_flag (vcpu,DEBUG_STATE_SAVE_SPE );/* Check if we have TRBE implemented and available at the host */ if (cpuid_feature_extract_unsigned_field (dfr0,ID_AA64DFR0_TRBE_SHIFT ) && !(read_sysreg_s (SYS_TRBIDR_EL1 ) &TRBIDR_PROG )) - vcpu->arch.flags |=KVM_ARM64_DEBUG_STATE_SAVE_TRBE ; +vcpu_set_flag (vcpu,DEBUG_STATE_SAVE_TRBE ); }void kvm_arch_vcpu_put_debug_state_flags (struct kvm_vcpu *vcpu) { - vcpu->arch.flags &= ~(KVM_ARM64_DEBUG_STATE_SAVE_SPE | -KVM_ARM64_DEBUG_STATE_SAVE_TRBE ); +vcpu_clear_flag (vcpu,DEBUG_STATE_SAVE_SPE ); +vcpu_clear_flag (vcpu,DEBUG_STATE_SAVE_TRBE ); }
arch/arm64/kvm/hyp/include/hyp/debug-sr.h +3 -3
@@ -132,7 +132,7 @@ static inline void __debug_switch_to_guest_common(struct kvm_vcpu *vcpu)struct kvm_guest_debug_arch *host_dbg;struct kvm_guest_debug_arch *guest_dbg; -if (!(vcpu->arch.flags &KVM_ARM64_DEBUG_DIRTY )) +if (!vcpu_get_flag (vcpu,DEBUG_DIRTY ))return ; host_ctxt = &this_cpu_ptr (&kvm_host_data)->host_ctxt;
@@ -151,7 +151,7 @@ static inline void __debug_switch_to_host_common(struct kvm_vcpu *vcpu)struct kvm_guest_debug_arch *host_dbg;struct kvm_guest_debug_arch *guest_dbg; -if (!(vcpu->arch.flags &KVM_ARM64_DEBUG_DIRTY )) +if (!vcpu_get_flag (vcpu,DEBUG_DIRTY ))return ; host_ctxt = &this_cpu_ptr (&kvm_host_data)->host_ctxt;
@@ -162,7 +162,7 @@ static inline void __debug_switch_to_host_common(struct kvm_vcpu *vcpu)__debug_save_state (guest_dbg, guest_ctxt);__debug_restore_state (host_dbg, host_ctxt); - vcpu->arch.flags &= ~KVM_ARM64_DEBUG_DIRTY; + vcpu_clear_flag(vcpu, DEBUG_DIRTY); }#endif /* __ARM64_KVM_HYP_DEBUG_SR_H__ */
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h +2 -2
@@ -195,7 +195,7 @@ static inline void __sysreg32_save_state(struct kvm_vcpu *vcpu)__vcpu_sys_reg (vcpu,DACR32_EL2 ) =read_sysreg (dacr32_el2);__vcpu_sys_reg (vcpu,IFSR32_EL2 ) =read_sysreg (ifsr32_el2); -if (has_vhe () || vcpu->arch.flags &KVM_ARM64_DEBUG_DIRTY ) +if (has_vhe () ||vcpu_get_flag (vcpu,DEBUG_DIRTY ))__vcpu_sys_reg (vcpu,DBGVCR32_EL2 ) =read_sysreg (dbgvcr32_el2); }
@@ -212,7 +212,7 @@ static inline void __sysreg32_restore_state(struct kvm_vcpu *vcpu)write_sysreg (__vcpu_sys_reg (vcpu,DACR32_EL2 ), dacr32_el2);write_sysreg (__vcpu_sys_reg (vcpu,IFSR32_EL2 ), ifsr32_el2); -if (has_vhe () || vcpu->arch.flags &KVM_ARM64_DEBUG_DIRTY ) +if (has_vhe () ||vcpu_get_flag (vcpu,DEBUG_DIRTY ))write_sysreg (__vcpu_sys_reg (vcpu,DBGVCR32_EL2 ), dbgvcr32_el2); }
arch/arm64/kvm/hyp/nvhe/debug-sr.c +4 -4
@@ -84,10 +84,10 @@ static void __debug_restore_trace(u64 trfcr_el1)void __debug_save_host_buffers_nvhe (struct kvm_vcpu *vcpu) {/* Disable and flush SPE data generation */ -if (vcpu->arch.flags &KVM_ARM64_DEBUG_STATE_SAVE_SPE ) +if (vcpu_get_flag (vcpu,DEBUG_STATE_SAVE_SPE ))__debug_save_spe (&vcpu->arch.host_debug_state.pmscr_el1);/* Disable and flush Self-Hosted Trace generation */ -if (vcpu->arch.flags &KVM_ARM64_DEBUG_STATE_SAVE_TRBE ) +if (vcpu_get_flag (vcpu,DEBUG_STATE_SAVE_TRBE ))__debug_save_trace (&vcpu->arch.host_debug_state.trfcr_el1); }
@@ -98,9 +98,9 @@ void __debug_switch_to_guest(struct kvm_vcpu *vcpu)void __debug_restore_host_buffers_nvhe (struct kvm_vcpu *vcpu) { -if (vcpu->arch.flags &KVM_ARM64_DEBUG_STATE_SAVE_SPE ) +if (vcpu_get_flag (vcpu,DEBUG_STATE_SAVE_SPE ))__debug_restore_spe (vcpu->arch.host_debug_state.pmscr_el1); -if (vcpu->arch.flags &KVM_ARM64_DEBUG_STATE_SAVE_TRBE ) +if (vcpu_get_flag (vcpu,DEBUG_STATE_SAVE_TRBE ))__debug_restore_trace (vcpu->arch.host_debug_state.trfcr_el1); }
arch/arm64/kvm/sys_regs.c +4 -4
@@ -387,7 +387,7 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu, {if (p->is_write) {vcpu_write_sys_reg (vcpu, p->regval, r->reg); - vcpu->arch.flags |=KVM_ARM64_DEBUG_DIRTY ; +vcpu_set_flag (vcpu,DEBUG_DIRTY ); }else { p->regval =vcpu_read_sys_reg (vcpu, r->reg); }
@@ -403,8 +403,8 @@ static bool trap_debug_regs(struct kvm_vcpu *vcpu,* A 32 bit write to a debug register leave top bits alone * A 32 bit read from a debug register only returns the bottom bits * -* All writes will set the KVM_ARM64_DEBUG_DIRTY flag to ensure the -* hyp.S code switches between host and guest values in future. +* All writes will set the DEBUG_DIRTY flag to ensure the hyp code +* switches between host and guest values in future. */ static void reg_to_dbg(struct kvm_vcpu *vcpu, struct sys_reg_params *p,
@@ -420,7 +420,7 @@ static void reg_to_dbg(struct kvm_vcpu *vcpu, val |= (p->regval & (mask >> shift)) << shift; *dbg_reg = val; - vcpu->arch.flags |=KVM_ARM64_DEBUG_DIRTY ; +vcpu_set_flag (vcpu,DEBUG_DIRTY ); } static void dbg_to_reg(struct kvm_vcpu *vcpu,
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 10/19 KVM: arm64: Move vcpu SVE/SME flags to the state flag set
In reply to Marc ZyngierThe two HOST_{SVE,SME}_ENABLED are only used for the host kernel to track its own state across a vcpu run so that it can be fully restored.
Move these flags to the so called state set.
--- arch/arm64/include/asm/kvm_host.h | 8 +++++--- arch/arm64/kvm/fpsimd.c | 12 ++++++------ 2 files changed, 11 insertions(+), 9 deletions(-)
arch/arm64/include/asm/kvm_host.h +5 -3
@@ -515,6 +515,11 @@ struct kvm_vcpu_arch {/* Save TRBE context if active */ #define DEBUG_STATE_SAVE_TRBE __vcpu_single_flag(iflags, BIT(6)) +/* SVE enabled for host EL0 */ +#define HOST_SVE_ENABLED __vcpu_single_flag(sflags, BIT(0)) +/* SME enabled for EL0 */ +#define HOST_SME_ENABLED __vcpu_single_flag(sflags, BIT(1)) +/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \ sve_ffr_offset((vcpu)->arch.sve_max_vl))
@@ -536,11 +541,8 @@ struct kvm_vcpu_arch { })/* vcpu_arch flags field values: */ -#define KVM_ARM64_HOST_SVE_ENABLED (1 << 4)/* SVE enabled for EL0 */ #define KVM_ARM64_ON_UNSUPPORTED_CPU (1 << 15)/* Physical CPU not in supported_cpus */ -#define KVM_ARM64_HOST_SME_ENABLED (1 << 16)/* SME enabled for EL0 */ #define KVM_ARM64_WFIT (1 << 17)/* WFIT instruction trapped */ -#define KVM_GUESTDBG_VALID_MASK (KVM_GUESTDBG_ENABLE | \ KVM_GUESTDBG_USE_SW_BP | \ KVM_GUESTDBG_USE_HW | \
arch/arm64/kvm/fpsimd.c +6 -6
@@ -79,9 +79,9 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu) vcpu->arch.fp_state =FP_STATE_HOST_OWNED ; - vcpu->arch.flags &= ~KVM_ARM64_HOST_SVE_ENABLED ; +vcpu_clear_flag (vcpu,HOST_SVE_ENABLED );if (read_sysreg (cpacr_el1) &CPACR_EL1_ZEN_EL0EN ) - vcpu->arch.flags |=KVM_ARM64_HOST_SVE_ENABLED ; +vcpu_set_flag (vcpu,HOST_SVE_ENABLED );/* * We don't currently support SME guests but if we leave
@@ -93,9 +93,9 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)* operations. Do this for ZA as well for now for simplicity. */ if (system_supports_sme ()) { - vcpu->arch.flags &= ~KVM_ARM64_HOST_SME_ENABLED ; +vcpu_clear_flag (vcpu,HOST_SME_ENABLED );if (read_sysreg (cpacr_el1) &CPACR_EL1_SMEN_EL0EN ) - vcpu->arch.flags |=KVM_ARM64_HOST_SME_ENABLED ; +vcpu_set_flag (vcpu,HOST_SME_ENABLED );if (read_sysreg_s (SYS_SVCR ) & (SVCR_SM_MASK |SVCR_ZA_MASK )) { vcpu->arch.fp_state =FP_STATE_FREE ;
@@ -164,7 +164,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)*/ if (has_vhe () &&system_supports_sme ()) {/* Also restore EL0 state seen on entry */ -if (vcpu->arch.flags &KVM_ARM64_HOST_SME_ENABLED ) +if (vcpu_get_flag (vcpu,HOST_SME_ENABLED ))sysreg_clear_set (CPACR_EL1 ,0 ,CPACR_EL1_SMEN_EL0EN |CPACR_EL1_SMEN_EL1EN );
@@ -193,7 +193,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)* for EL0. To avoid spurious traps, restore the trap state * seen by kvm_arch_vcpu_load_fp(): */ -if (vcpu->arch.flags &KVM_ARM64_HOST_SVE_ENABLED ) +if (vcpu_get_flag (vcpu,HOST_SVE_ENABLED ))sysreg_clear_set (CPACR_EL1 ,0 ,CPACR_EL1_ZEN_EL0EN );else sysreg_clear_set (CPACR_EL1 ,CPACR_EL1_ZEN_EL0EN ,0 );
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 11/19 KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set
In reply to Marc ZyngierThe ON_UNSUPPORTED_CPU flag is only there to track the sad fact that we have ended-up on a CPU where we cannot really run.
Since this is only for the host kernel's use, move it to the state set.
--- arch/arm64/include/asm/kvm_host.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arm64/include/asm/kvm_host.h +5 -4
@@ -519,6 +519,8 @@ struct kvm_vcpu_arch {#define HOST_SVE_ENABLED __vcpu_single_flag(sflags, BIT(0))/* SME enabled for EL0 */ #define HOST_SME_ENABLED __vcpu_single_flag(sflags, BIT(1)) +/* Physical CPU not in supported_cpus */ +#define ON_UNSUPPORTED_CPU __vcpu_single_flag(sflags, BIT(2))/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \
@@ -541,7 +543,6 @@ struct kvm_vcpu_arch { })/* vcpu_arch flags field values: */ -#define KVM_ARM64_ON_UNSUPPORTED_CPU (1 << 15)/* Physical CPU not in supported_cpus */ #define KVM_ARM64_WFIT (1 << 17)/* WFIT instruction trapped */ #define KVM_GUESTDBG_VALID_MASK (KVM_GUESTDBG_ENABLE | \ KVM_GUESTDBG_USE_SW_BP | \
@@ -561,13 +562,13 @@ struct kvm_vcpu_arch {#endif #define vcpu_on_unsupported_cpu (vcpu) \ - ((vcpu)->arch.flags & KVM_ARM64_ON_UNSUPPORTED_CPU) + vcpu_get_flag(vcpu, ON_UNSUPPORTED_CPU)#define vcpu_set_on_unsupported_cpu (vcpu) \ - ((vcpu)->arch.flags |= KVM_ARM64_ON_UNSUPPORTED_CPU) + vcpu_set_flag(vcpu, ON_UNSUPPORTED_CPU)#define vcpu_clear_on_unsupported_cpu (vcpu) \ - ((vcpu)->arch.flags &= ~KVM_ARM64_ON_UNSUPPORTED_CPU) + vcpu_clear_flag(vcpu, ON_UNSUPPORTED_CPU)#define vcpu_gp_regs (v) (&(v)->arch.ctxt.regs)
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v2 11/19] KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set
Hi,
Quoted 17 lines · Marc Zyngier
The
ON_UNSUPPORTED_CPUflag is only there to track the sad fact that we have ended-up on a CPU where we cannot really run.Since this is only for the host kernel's use, move it to the state set.
Reviewed-by Fuad Tabba <[email protected]>Signed-off-by Marc Zyngier <[email protected]>--- arch/arm64/include/asm/kvm_host.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)arch/arm64/include/asm/kvm_host.h +0
-0
arch/arm64/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 523
Quoted 5 lines
arch/arm64/include/asm/kvm_host.h +2
-0@@ -519,6 +519,8 @@ struct kvm_vcpu_arch {#define HOST_SVE_ENABLED __vcpu_single_flag(sflags, BIT(0))/* SME enabled for EL0 */ #define HOST_SME_ENABLED __vcpu_single_flag(sflags, BIT(1)) +/* Physical CPU not in supported_cpus */ +#define ON_UNSUPPORTED_CPU __vcpu_single_flag(sflags, BIT(2))
I'm a bit confused here. The ON_UNSUPPORTED_CPU flag ends up in sflags. The comment for sflags says:
+ /* State flags for kernel bookkeeping, unused by the hypervisor code */
+ u64 sflags;
The ON_UNSUPPORT_CPU flag is used exclusively by KVM (it's only used by the file arch/arm64/kvm/arm.c), so why is it part of a set of flags which are supposed to be unused by the hypervisor code?
Thanks,
Alex
Quoted 31 lines
arch/arm64/include/asm/kvm_host.h +3
-4/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \@@ -541,7 +543,6 @@ struct kvm_vcpu_arch { })/* vcpu_arch flags field values: */ -#define KVM_ARM64_ON_UNSUPPORTED_CPU (1 << 15)/* Physical CPU not in supported_cpus */ #define KVM_ARM64_WFIT (1 << 17)/* WFIT instruction trapped */ #define KVM_GUESTDBG_VALID_MASK (KVM_GUESTDBG_ENABLE | \ KVM_GUESTDBG_USE_SW_BP | \@@ -561,13 +562,13 @@ struct kvm_vcpu_arch {#endif #define vcpu_on_unsupported_cpu (vcpu) \ - ((vcpu)->arch.flags & KVM_ARM64_ON_UNSUPPORTED_CPU) + vcpu_get_flag(vcpu, ON_UNSUPPORTED_CPU)#define vcpu_set_on_unsupported_cpu (vcpu) \ - ((vcpu)->arch.flags |= KVM_ARM64_ON_UNSUPPORTED_CPU) + vcpu_set_flag(vcpu, ON_UNSUPPORTED_CPU)#define vcpu_clear_on_unsupported_cpu (vcpu) \ - ((vcpu)->arch.flags &= ~KVM_ARM64_ON_UNSUPPORTED_CPU) + vcpu_clear_flag(vcpu, ON_UNSUPPORTED_CPU)#define vcpu_gp_regs (v) (&(v)->arch.ctxt.regs)Signature · 1 line
2.34.1
Marc Zyngier
maintainerRe: [PATCH v2 11/19] KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set
Quoted 33 lines · Alexandru Elisei
Hi,
Quoted 17 lines · Marc Zyngier
The
ON_UNSUPPORTED_CPUflag is only there to track the sad fact that we have ended-up on a CPU where we cannot really run.Since this is only for the host kernel's use, move it to the state set.
Reviewed-by Fuad Tabba <[email protected]>Signed-off-by Marc Zyngier <[email protected]>--- arch/arm64/include/asm/kvm_host.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)arch/arm64/include/asm/kvm_host.h +0
-0arch/arm64/include/asm/kvm_host.h struct kvm_vcpu_arch { · line 523
Quoted 5 lines
arch/arm64/include/asm/kvm_host.h +2
-0@@ -519,6 +519,8 @@ struct kvm_vcpu_arch {#define HOST_SVE_ENABLED __vcpu_single_flag(sflags, BIT(0))/* SME enabled for EL0 */ #define HOST_SME_ENABLED __vcpu_single_flag(sflags, BIT(1)) +/* Physical CPU not in supported_cpus */ +#define ON_UNSUPPORTED_CPU __vcpu_single_flag(sflags, BIT(2))I'm a bit confused here. The
ON_UNSUPPORTED_CPUflag ends up in sflags. The comment for sflags says:(quoted diff) +2
-0+ /* State flags for kernel bookkeeping, unused by the hypervisor code */ + u64 sflags;
Quoted 3 lines
The
ON_UNSUPPORT_CPUflag is used exclusively by KVM (it's only used by the filearch/arm64/kvm/arm.c), so why is it part of a set of flags which are supposed to be unused by the hypervisor code?
Are we going to have the same terminology discussion we had when you reviewed the NV patches?
These flags are only used by code that isn't involved in any sort of world switching. If you are running nVHE, these flags are not used by the EL2 code.
That's what 'hypervisor code' means in this context.
M.
Signature · 5 lines
Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 12/19 KVM: arm64: Move vcpu WFIT flag to the state flag set
In reply to Marc ZyngierThe host kernel uses the WFIT flag to remember that a vcpu has used this instruction and wake it up as required. Move it to the state set, as nothing in the hypervisor uses this information.
--- arch/arm64/include/asm/kvm_host.h | 4 ++-- arch/arm64/kvm/arch_timer.c | 2 +- arch/arm64/kvm/arm.c | 2 +- arch/arm64/kvm/handle_exit.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
arch/arm64/include/asm/kvm_host.h +2 -2
@@ -521,6 +521,8 @@ struct kvm_vcpu_arch {#define HOST_SME_ENABLED __vcpu_single_flag(sflags, BIT(1))/* Physical CPU not in supported_cpus */ #define ON_UNSUPPORTED_CPU __vcpu_single_flag(sflags, BIT(2)) +/* WFIT instruction trapped */ +#define IN_WFIT __vcpu_single_flag(sflags, BIT(3))/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \
@@ -542,8 +544,6 @@ struct kvm_vcpu_arch { __size_ret; \ }) -/* vcpu_arch flags field values: */ -#define KVM_ARM64_WFIT (1 << 17)/* WFIT instruction trapped */ #define KVM_GUESTDBG_VALID_MASK (KVM_GUESTDBG_ENABLE | \ KVM_GUESTDBG_USE_SW_BP | \ KVM_GUESTDBG_USE_HW | \
arch/arm64/kvm/arch_timer.c +1 -1
@@ -242,7 +242,7 @@ static bool kvm_timer_irq_can_fire(struct arch_timer_context *timer_ctx)static bool vcpu_has_wfit_active (struct kvm_vcpu *vcpu) {return (cpus_have_final_cap (ARM64_HAS_WFXT ) && - (vcpu->arch.flags &KVM_ARM64_WFIT )); +vcpu_get_flag (vcpu,IN_WFIT )); }static u64 wfit_delay_ns (struct kvm_vcpu *vcpu)
arch/arm64/kvm/arm.c +1 -1
@@ -657,7 +657,7 @@ void kvm_vcpu_wfi(struct kvm_vcpu *vcpu)preempt_enable ();kvm_vcpu_halt (vcpu); - vcpu->arch.flags &= ~KVM_ARM64_WFIT ; +vcpu_clear_flag (vcpu,IN_WFIT );kvm_clear_request (KVM_REQ_UNHALT , vcpu);preempt_disable ();
arch/arm64/kvm/handle_exit.c +1 -1
@@ -120,7 +120,7 @@ static int kvm_handle_wfx(struct kvm_vcpu *vcpu)kvm_vcpu_on_spin (vcpu,vcpu_mode_priv (vcpu)); }else {if (esr & ESR_ELx_WFx_ISS_WFxT) - vcpu->arch.flags |=KVM_ARM64_WFIT ; +vcpu_set_flag (vcpu,IN_WFIT );kvm_vcpu_wfi (vcpu); }
Signature · 1 line
2.34.1
Marc Zyngier
maintainerPATCH v2 13/19 KVM: arm64: Kill unused vcpu flags field
In reply to Marc ZyngierHorray, we have now sorted all the preexisting flags, and the 'flags' field is now unused. Get rid of it while nobody is looking.
--- arch/arm64/include/asm/kvm_host.h | 3 --- 1 file changed, 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +0 -3
@@ -332,9 +332,6 @@ struct kvm_vcpu_arch { FP_STATE_GUEST_OWNED, } fp_state; -/* Miscellaneous vcpu state flags */ -u64 flags; -/* Configuration flags, set once and for all before the vcpu can run */ u64 cflags;
Signature · 1 line
2.34.1
Marc Zyngier
maintainerPATCH v2 14/19 KVM: arm64: Convert vcpu sysregs_loaded_on_cpu to a state flag
In reply to Marc ZyngierThe aptly named boolean 'sysregs_loaded_on_cpu' tracks whether some of the vcpu system registers are resident on the physical CPU when running in VHE mode.
This is obviously a flag in hidding, so let's convert it to a state flag, since this is solely a host concern (the hypervisor itself always knows which state we're in).
--- arch/arm64/include/asm/kvm_host.h | 6 ++---- arch/arm64/kvm/hyp/vhe/sysreg-sr.c | 4 ++-- arch/arm64/kvm/sys_regs.c | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-)
arch/arm64/include/asm/kvm_host.h +2 -4
@@ -410,10 +410,6 @@ struct kvm_vcpu_arch {/* Additional reset state */ struct vcpu_reset_state reset_state; -/* True when deferrable sysregs are loaded on the physical CPU, -* see kvm_vcpu_load_sysregs_vhe and kvm_vcpu_put_sysregs_vhe. */ -bool sysregs_loaded_on_cpu; -/* Guest PV state */ struct {u64 last_steal;
@@ -520,6 +516,8 @@ struct kvm_vcpu_arch {#define ON_UNSUPPORTED_CPU __vcpu_single_flag(sflags, BIT(2))/* WFIT instruction trapped */ #define IN_WFIT __vcpu_single_flag(sflags, BIT(3)) +/* vcpu system registers loaded on physical CPU */ +#define SYSREGS_ON_CPU __vcpu_single_flag(sflags, BIT(4))/* Pointer to the vcpu's SVE FFR for sve_{save,load}_state() */ #define vcpu_sve_pffr (vcpu) (kern_hyp_va((vcpu)->arch.sve_state) + \
arch/arm64/kvm/hyp/vhe/sysreg-sr.c +2 -2
@@ -79,7 +79,7 @@ void kvm_vcpu_load_sysregs_vhe(struct kvm_vcpu *vcpu)__sysreg_restore_user_state (guest_ctxt);__sysreg_restore_el1_state (guest_ctxt); - vcpu->arch.sysregs_loaded_on_cpu = true; +vcpu_set_flag (vcpu,SYSREGS_ON_CPU );activate_traps_vhe_load (vcpu); }
@@ -110,5 +110,5 @@ void kvm_vcpu_put_sysregs_vhe(struct kvm_vcpu *vcpu)/* Restore host user state */ __sysreg_restore_user_state (host_ctxt); - vcpu->arch.sysregs_loaded_on_cpu = false; +vcpu_clear_flag (vcpu,SYSREGS_ON_CPU ); }
arch/arm64/kvm/sys_regs.c +2 -2
@@ -72,7 +72,7 @@ u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg) {u64 val =0x8badf00d8badf00d ; -if (vcpu->arch.sysregs_loaded_on_cpu && +if (vcpu_get_flag (vcpu,SYSREGS_ON_CPU ) &&__vcpu_read_sys_reg_from_cpu (reg, &val))return val;
@@ -81,7 +81,7 @@ u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg)void vcpu_write_sys_reg (struct kvm_vcpu *vcpu,u64 val,int reg) { -if (vcpu->arch.sysregs_loaded_on_cpu && +if (vcpu_get_flag (vcpu,SYSREGS_ON_CPU ) &&__vcpu_write_sys_reg_to_cpu (val, reg))return ;
Signature · 1 line
2.34.1
Marc Zyngier
maintainerPATCH v2 15/19 KVM: arm64: Warn when PENDING_EXCEPTION and INCREMENT_PC are set together
In reply to Marc ZyngierWe really don't want PENDING_EXCEPTION and INCREMENT_PC to ever be set at the same time, as they are mutually exclusive. Add checks that will generate a warning should this ever happen.
--- arch/arm64/include/asm/kvm_emulate.h | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/include/asm/kvm_emulate.h +2 -0
@@ -473,11 +473,13 @@ static inline unsigned long vcpu_data_host_to_guest(struct kvm_vcpu *vcpu, static __always_inline void kvm_incr_pc(struct kvm_vcpu *vcpu) { +WARN_ON (vcpu_get_flag (vcpu,PENDING_EXCEPTION ));vcpu_set_flag (vcpu,INCREMENT_PC ); }#define kvm_pend_exception (v, e) \ do { \ + WARN_ON(vcpu_get_flag((v), INCREMENT_PC)); \ vcpu_set_flag((v), PENDING_EXCEPTION); \ vcpu_set_flag((v), e); \ } while (0)
Signature · 1 line
2.34.1
Marc Zyngier
maintainerPATCH v2 16/19 KVM: arm64: Add build-time sanity checks for flags
In reply to Marc ZyngierFlags are great, but flags can also be dangerous: it is easy to encode a flag that is bigger than its container (unless the container is a u64), and it is easy to construct a flag value that doesn't fit in the mask that is associated with it.
Add a couple of build-time sanity checks that ensure we catch these two cases.
--- arch/arm64/include/asm/kvm_host.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/arm64/include/asm/kvm_host.h +16 -0
@@ -433,8 +433,20 @@ struct kvm_vcpu_arch {#define __unpack_flag (_set, _f, _m) _f#define unpack_vcpu_flag (...) __unpack_flag(__VA_ARGS__) +#define __build_check_flag (v, flagset, f, m) \ + do { \ + typeof(v->arch.flagset) *_fset; \ + \ +/* Check that the flags fit in the mask */ \ +BUILD_BUG_ON (HWEIGHT (m) !=HWEIGHT ((f) | (m))); \ +/* Check that the flags fit in the type */ \ +BUILD_BUG_ON ((sizeof (*_fset) *8 ) <=__fls (m)); \ + } while (0) +#define __vcpu_get_flag (v, flagset, f, m) \ ({ \ + __build_check_flag(v, flagset, f, m); \ + \ v->arch.flagset & (m); \ })
@@ -442,6 +454,8 @@ struct kvm_vcpu_arch { do { \ typeof(v->arch.flagset) *fset; \ \ + __build_check_flag(v, flagset, f, m); \ + \ fset = &v->arch.flagset; \ if (HWEIGHT(m) > 1) \ *fset &= ~(m); \
@@ -452,6 +466,8 @@ struct kvm_vcpu_arch {do { \typeof (v->arch.flagset) *fset; \ \ +__build_check_flag (v, flagset, f, m); \ + \ fset = &v->arch.flagset; \ *fset &= ~(m); \ }while (0 )
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 17/19 KVM: arm64: Reduce the size of the vcpu flag members
In reply to Marc ZyngierNow that we can detect flags overflowing their container, reduce the size of all flag set members in the vcpu struct, turning them into 8bit quantities.
Even with the FP state enum occupying 32bit, the whole of the state that was represented by flags is smaller by one byte. Profit!
--- arch/arm64/include/asm/kvm_host.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +3 -3
@@ -333,13 +333,13 @@ struct kvm_vcpu_arch { } fp_state;/* Configuration flags, set once and for all before the vcpu can run */ -u64 cflags; +u8 cflags;/* Input flags to the hypervisor code, potentially cleared after use */ -u64 iflags; +u8 iflags;/* State flags for kernel bookkeeping, unused by the hypervisor code */ -u64 sflags; +u8 sflags;/* * We maintain more than a single set of debug registers to support
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 18/19 KVM: arm64: Document why pause cannot be turned into a flag
In reply to Marc ZyngierIt would be tempting to turn the 'pause' state into a flag.
However, this cannot easily be done as it is updated out of context, while all the flags expect to only be updated from the vcpu thread. Turning it into a flag would require to make all flag updates atomic, which isn't necessary desireable.
Document this, and take this opportunity to move the field next to the flag sets, filling a hole in the vcpu structure.
--- arch/arm64/include/asm/kvm_host.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
arch/arm64/include/asm/kvm_host.h +9 -3
@@ -341,6 +341,15 @@ struct kvm_vcpu_arch {/* State flags for kernel bookkeeping, unused by the hypervisor code */ u8 sflags; +/* +* Don't run the guest (internal implementation need). +* +* Contrary to the flags above, this is set/cleared outside of +* a vcpu context, and thus cannot be mixed with the flags +* themselves (or the flag accesses need to be made atomic). +*/ +bool pause; +/* * We maintain more than a single set of debug registers to support * debugging the guest from the host and to maintain separate host and
@@ -394,9 +403,6 @@ struct kvm_vcpu_arch {/* vcpu power state */ struct kvm_mp_state mp_state; -/* Don't run the guest (internal implementation need) */ -bool pause; -/* Cache some mmu pages needed inside spinlock regions */ struct kvm_mmu_memory_cache mmu_page_cache;
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerPATCH v2 19/19 KVM: arm64: Move the handling of !FP outside of the fast path
In reply to Marc ZyngierWe currently start by assuming that the host owns the FP unit at load time, then check again whether this is the case as we are about to run. Only at this point do we account for the fact that there is a (vanishingly small) chance that we're running on a system without a FPSIMD unit (yes, this is madness).
We can actually move this FPSIMD check as early as load-time, and drop the check at run time.
No intended change in behaviour.
--- arch/arm64/kvm/arm.c | 6 ++++++ arch/arm64/kvm/fpsimd.c | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
arch/arm64/kvm/arm.c +6 -0
@@ -328,6 +328,12 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu) vcpu->arch.mmu_page_cache.gfp_zero = __GFP_ZERO; +/* +* Default value for the FP state, will be overloaded at load +* time if we support FP (pretty likely) +*/ + vcpu->arch.fp_state =FP_STATE_FREE ; +/* Set up the timer */ kvm_timer_vcpu_init (vcpu);
arch/arm64/kvm/fpsimd.c +4 -4
@@ -77,6 +77,9 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)BUG_ON (!current->mm);BUG_ON (test_thread_flag (TIF_SVE )); +if (!system_supports_fpsimd ()) +return ; + vcpu->arch.fp_state =FP_STATE_HOST_OWNED ;vcpu_clear_flag (vcpu,HOST_SVE_ENABLED );
@@ -110,13 +113,10 @@ void kvm_arch_vcpu_load_fp(struct kvm_vcpu *vcpu)* FP while we were preemptible (such as off the back of an interrupt), * then neither the host nor the guest own the FP hardware (and it was the * responsibility of the code that used FP to save the existing state). -* -* Note that not supporting FP is basically the same thing as far as the -* hypervisor is concerned (nothing to save). */ void kvm_arch_vcpu_ctxflush_fp (struct kvm_vcpu *vcpu) { -if (!system_supports_fpsimd () ||test_thread_flag (TIF_FOREIGN_FPSTATE )) +if (test_thread_flag (TIF_FOREIGN_FPSTATE )) vcpu->arch.fp_state =FP_STATE_FREE ; }
Signature · 6 lines
2.34.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Re: [PATCH v2 19/19] KVM: arm64: Move the handling of !FP outside of the fast path
Quoted 7 lines · Marc Zyngier
We currently start by assuming that the host owns the FP unit at load time, then check again whether this is the case as we are about to run. Only at this point do we account for the fact that there is a (vanishingly small) chance that we're running on a system without a FPSIMD unit (yes, this is madness).
Quoted 7 lines
We can actually move this FPSIMD check as early as load-time, and drop the check at run time.
No intended change in behaviour.
Suggested-by Reiji Watanabe <[email protected]>Signed-off-by Marc Zyngier <[email protected]>
For patches 9~19 in the series,
Thanks,
Reiji
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Quoted 15 lines · Marc Zyngier
This is a iteration on [1], which aims at making the vcpu flags suck a bit less.
* From v1 [1]:
- Rebased onto v5.19-rc1
- Took the first two patches into kvmarm-fixes, included here for completeness
- Additional patch to movesystem_supports_fpsimd()outside of the run path (Reiji)
- Expanded on comments (Reiji)
- Newkvm_pend_exception()accessor (Fuad)
- Various bracketing fixups (Reiji)
- Some renaming (Reiji, Broonie)
- Collected RBs, with thanks
Quoted 1 line
[...]
Applied to next, thanks!
[01/19] KVM: arm64: Always start with clearing SVE flag on load
commit: d52d165d67c5aa26c8c89909003c94a66492d23d
[02/19] KVM: arm64: Always start with clearing SME flag on load
commit: 039f49c4cafb785504c678f28664d088e0108d35
[03/19] KVM: arm64: Drop FP_FOREIGN_STATE from the hypervisor code
commit: e9ada6c208c15c907afe5afb1aa82e23e81eb8ba
[04/19] KVM: arm64: Move FP state ownership from flag to a tristate
commit: f8077b0d59230cbb58e0b98839e04b564529a5ac
[05/19] KVM: arm64: Add helpers to manipulate vcpu flags among a set
commit: e87abb73e5946379896cf49b10f6b57e02937a4c
[06/19] KVM: arm64: Add three sets of flags to the vcpu state
commit: 690bacb83bc30d14821bd32cac1c5839b4a9ac6c
[07/19] KVM: arm64: Move vcpu configuration flags into their own set
commit: 4c0680d394d8a77868049931101e4a59372346b5
[08/19] KVM: arm64: Move vcpu PC/Exception flags to the input flag set
commit: 699bb2e0c6f3796549dabac329501df7ffd99439
[09/19] KVM: arm64: Move vcpu debug/SPE/TRBE flags to the input flag set
commit: b1da49088ac68a21c613efd734dada8272ec0b00
[10/19] KVM: arm64: Move vcpu SVE/SME flags to the state flag set
commit: 0affa37fcd1d6f701a0fe805c4ceb7f348d377d5
[11/19] KVM: arm64: Move vcpu ON_UNSUPPORTED_CPU flag to the state flag set
commit: aff3ccd7320eed5814d317fcb80244f474d66a84
[12/19] KVM: arm64: Move vcpu WFIT flag to the state flag set
commit: eebc538d8e07e0ec759823664cbe2011a8bd885d
[13/19] KVM: arm64: Kill unused vcpu flags field
commit: 781e3ae148fd2f9b0cf9b5b94f6c32f2361eb7c0
[14/19] KVM: arm64: Convert vcpu sysregs_loaded_on_cpu to a state flag
commit: 30b6ab45f81334e83dcb440451b6a4c4a753a118
[15/19] KVM: arm64: Warn when PENDING_EXCEPTION and INCREMENT_PC are set together
commit: e19f2c6cd14668c0d5b1cef280632b7ca5893118
[16/19] KVM: arm64: Add build-time sanity checks for flags
commit: 5a3984f4ec73d1c7cf31a4cee46cca7d4c75deee
[17/19] KVM: arm64: Reduce the size of the vcpu flag members
commit: 54ddda919c4bc37c113727034619c4e15c184334
[18/19] KVM: arm64: Document why pause cannot be turned into a flag
commit: 0fa4a3137e943cd6acab386ff26cd8d5e94e9559
[19/19] KVM: arm64: Move the handling of !FP outside of the fast path
commit: b4da91879e98bdd5998ee84f47f02426ac50a729Cheers,
M.
Signature · 1 line
Marc Zyngier <[email protected]>