* [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out
@ 2022-12-20 10:50 Dong Bo
2022-12-20 10:15 ` Marc Zyngier
2023-01-23 20:26 ` Oliver Upton
0 siblings, 2 replies; 4+ messages in thread
From: Dong Bo @ 2022-12-20 10:50 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, kvmarm, kvmarm
Cc: Nianyao Tang, Marc Zyngier, James Morse, Alexandru Elisei,
Suzuki K Poulose, Oliver Upton, Catalin Marinas, Will Deacon
From: Nianyao Tang <tangnianyao@huawei.com>
If we have VHE and need to reenable SME for host in
kvm_arch_vcpu_put_fp, CPACR.SMEN is modified from 0 to 1. Trap
control for reading SVCR is modified from enable to disable.
Synchronization is needed before reading SVCR later in
fpsimd_save, or it may cause sync exception which can not be
handled by host.
Cc: Marc Zyngier <maz@kernel.org>
Cc: James Morse <james.morse@arm.com>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Nianyao Tang <tangnianyao@huawei.com>
---
arch/arm64/kvm/fpsimd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c
index 02dd7e9ebd39..f5799f571317 100644
--- a/arch/arm64/kvm/fpsimd.c
+++ b/arch/arm64/kvm/fpsimd.c
@@ -184,6 +184,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)
sysreg_clear_set(CPACR_EL1,
CPACR_EL1_SMEN_EL0EN,
CPACR_EL1_SMEN_EL1EN);
+ isb();
}
if (vcpu->arch.fp_state == FP_STATE_GUEST_OWNED) {
--
1.8.3.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out
2022-12-20 10:50 [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out Dong Bo
@ 2022-12-20 10:15 ` Marc Zyngier
2022-12-21 13:34 ` Mark Brown
2023-01-23 20:26 ` Oliver Upton
1 sibling, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2022-12-20 10:15 UTC (permalink / raw)
To: Dong Bo
Cc: linux-kernel, linux-arm-kernel, kvmarm, kvmarm, Nianyao Tang,
James Morse, Alexandru Elisei, Suzuki K Poulose, Oliver Upton,
Catalin Marinas, Will Deacon, Mark Brown
+ Mark
On Tue, 20 Dec 2022 10:50:24 +0000,
Dong Bo <dongbo4@huawei.com> wrote:
>
> From: Nianyao Tang <tangnianyao@huawei.com>
>
> If we have VHE and need to reenable SME for host in
> kvm_arch_vcpu_put_fp, CPACR.SMEN is modified from 0 to 1. Trap
> control for reading SVCR is modified from enable to disable.
> Synchronization is needed before reading SVCR later in
> fpsimd_save, or it may cause sync exception which can not be
> handled by host.
>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: James Morse <james.morse@arm.com>
> Cc: Alexandru Elisei <alexandru.elisei@arm.com>
> Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
> Cc: Oliver Upton <oliver.upton@linux.dev>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Signed-off-by: Nianyao Tang <tangnianyao@huawei.com>
> ---
> arch/arm64/kvm/fpsimd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm64/kvm/fpsimd.c b/arch/arm64/kvm/fpsimd.c
> index 02dd7e9ebd39..f5799f571317 100644
> --- a/arch/arm64/kvm/fpsimd.c
> +++ b/arch/arm64/kvm/fpsimd.c
> @@ -184,6 +184,7 @@ void kvm_arch_vcpu_put_fp(struct kvm_vcpu *vcpu)
> sysreg_clear_set(CPACR_EL1,
> CPACR_EL1_SMEN_EL0EN,
> CPACR_EL1_SMEN_EL1EN);
> + isb();
> }
>
> if (vcpu->arch.fp_state == FP_STATE_GUEST_OWNED) {
> --
> 1.8.3.1
>
>
--
Without deviation from the norm, progress is not possible.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out
2022-12-20 10:15 ` Marc Zyngier
@ 2022-12-21 13:34 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-12-21 13:34 UTC (permalink / raw)
To: Marc Zyngier
Cc: Dong Bo, linux-kernel, linux-arm-kernel, kvmarm, kvmarm,
Nianyao Tang, James Morse, Alexandru Elisei, Suzuki K Poulose,
Oliver Upton, Catalin Marinas, Will Deacon
[-- Attachment #1.1: Type: text/plain, Size: 480 bytes --]
On Tue, Dec 20, 2022 at 10:15:18AM +0000, Marc Zyngier wrote:
> Dong Bo <dongbo4@huawei.com> wrote:
> > If we have VHE and need to reenable SME for host in
> > kvm_arch_vcpu_put_fp, CPACR.SMEN is modified from 0 to 1. Trap
> > control for reading SVCR is modified from enable to disable.
> > Synchronization is needed before reading SVCR later in
> > fpsimd_save, or it may cause sync exception which can not be
> > handled by host.
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out
2022-12-20 10:50 [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out Dong Bo
2022-12-20 10:15 ` Marc Zyngier
@ 2023-01-23 20:26 ` Oliver Upton
1 sibling, 0 replies; 4+ messages in thread
From: Oliver Upton @ 2023-01-23 20:26 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, kvmarm, kvmarm, Dong Bo
Cc: Oliver Upton, James Morse, Alexandru Elisei, Will Deacon,
Catalin Marinas, Nianyao Tang, Marc Zyngier, Suzuki K Poulose
On Tue, 20 Dec 2022 18:50:24 +0800, Dong Bo wrote:
> From: Nianyao Tang <tangnianyao@huawei.com>
>
> If we have VHE and need to reenable SME for host in
> kvm_arch_vcpu_put_fp, CPACR.SMEN is modified from 0 to 1. Trap
> control for reading SVCR is modified from enable to disable.
> Synchronization is needed before reading SVCR later in
> fpsimd_save, or it may cause sync exception which can not be
> handled by host.
>
> [...]
Applied to kvmarm/next, thanks!
[1/1] KVM: arm64: Synchronize SMEN on vcpu schedule out
https://git.kernel.org/kvmarm/kvmarm/c/59d78a2ec0e9
--
Best,
Oliver
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-23 20:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-20 10:50 [PATCH] KVM: arm64: Synchronize SMEN on vcpu schedule out Dong Bo
2022-12-20 10:15 ` Marc Zyngier
2022-12-21 13:34 ` Mark Brown
2023-01-23 20:26 ` Oliver Upton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).