Skip to content

Commit 1bded23

Browse files
author
Marc Zyngier
committed
KVM: arm64: Move SP_EL1 to the system register array
SP_EL1 being a VNCR-capable register with ARMv8.4-NV, move it to the system register array and update the accessors. Reviewed-by: James Morse <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
1 parent 98909e6 commit 1bded23

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ enum vcpu_sysreg {
186186
APGAKEYHI_EL1,
187187

188188
ELR_EL1,
189+
SP_EL1,
189190

190191
/* 32bit specific registers. Keep them at the end of the range */
191192
DACR32_EL2, /* Domain Access Control Register */
@@ -240,8 +241,6 @@ enum vcpu_sysreg {
240241
struct kvm_cpu_context {
241242
struct user_pt_regs regs; /* sp = sp_el0 */
242243

243-
u64 sp_el1;
244-
245244
u64 spsr[KVM_NR_SPSR];
246245

247246
struct user_fpsimd_state fp_regs;

arch/arm64/kvm/guest.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void *core_reg_addr(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
129129
return &vcpu->arch.ctxt.regs.pstate;
130130

131131
case KVM_REG_ARM_CORE_REG(sp_el1):
132-
return &vcpu->arch.ctxt.sp_el1;
132+
return __ctxt_sys_reg(&vcpu->arch.ctxt, SP_EL1);
133133

134134
case KVM_REG_ARM_CORE_REG(elr_el1):
135135
return __ctxt_sys_reg(&vcpu->arch.ctxt, ELR_EL1);

arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static inline void __sysreg_save_el1_state(struct kvm_cpu_context *ctxt)
4646
ctxt_sys_reg(ctxt, PAR_EL1) = read_sysreg(par_el1);
4747
ctxt_sys_reg(ctxt, TPIDR_EL1) = read_sysreg(tpidr_el1);
4848

49-
ctxt->sp_el1 = read_sysreg(sp_el1);
49+
ctxt_sys_reg(ctxt, SP_EL1) = read_sysreg(sp_el1);
5050
ctxt_sys_reg(ctxt, ELR_EL1) = read_sysreg_el1(SYS_ELR);
5151
ctxt->spsr[KVM_SPSR_EL1] = read_sysreg_el1(SYS_SPSR);
5252
}
@@ -125,7 +125,7 @@ static inline void __sysreg_restore_el1_state(struct kvm_cpu_context *ctxt)
125125
write_sysreg_el1(ctxt_sys_reg(ctxt, TCR_EL1), SYS_TCR);
126126
}
127127

128-
write_sysreg(ctxt->sp_el1, sp_el1);
128+
write_sysreg(ctxt_sys_reg(ctxt, SP_EL1), sp_el1);
129129
write_sysreg_el1(ctxt_sys_reg(ctxt, ELR_EL1), SYS_ELR);
130130
write_sysreg_el1(ctxt->spsr[KVM_SPSR_EL1], SYS_SPSR);
131131
}

0 commit comments

Comments
 (0)