Skip to content

Commit b720269

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Check for SYSREGS_ON_CPU before accessing the 32bit state
Just like c6e35df ("KVM: arm64: Check for SYSREGS_ON_CPU before accessing the CPU state") fixed the 64bit state access, add a check for the 32bit state actually being on the CPU before writing it. Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Oliver Upton <[email protected]>
1 parent 01860bc commit b720269

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/arm64/kvm/hyp/exception.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ static void __vcpu_write_spsr(struct kvm_vcpu *vcpu, unsigned long target_mode,
5959

6060
static void __vcpu_write_spsr_abt(struct kvm_vcpu *vcpu, u64 val)
6161
{
62-
if (has_vhe())
62+
if (has_vhe() && vcpu_get_flag(vcpu, SYSREGS_ON_CPU))
6363
write_sysreg(val, spsr_abt);
6464
else
6565
vcpu->arch.ctxt.spsr_abt = val;
6666
}
6767

6868
static void __vcpu_write_spsr_und(struct kvm_vcpu *vcpu, u64 val)
6969
{
70-
if (has_vhe())
70+
if (has_vhe() && vcpu_get_flag(vcpu, SYSREGS_ON_CPU))
7171
write_sysreg(val, spsr_und);
7272
else
7373
vcpu->arch.ctxt.spsr_und = val;

0 commit comments

Comments
 (0)