@@ -469,6 +469,8 @@ struct kvm_vcpu_arch {
#define ctxt_sys_reg(c,r) (*__ctxt_sys_reg(c,r))
+#define __vcpu_sys_reg(v,r) (__ctxt_sys_reg(&(v)->arch.ctxt, (r)))
+
#define vcpu_sys_reg(v,r) (ctxt_sys_reg(&(v)->arch.ctxt, (r)))
u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg);
@@ -148,13 +148,13 @@ static void *core_reg_addr(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
return &vcpu->arch.ctxt.regs.pstate;
case KVM_REG_ARM_CORE_REG(sp_el1):
- return __ctxt_sys_reg(&vcpu->arch.ctxt, SP_EL1);
+ return __vcpu_sys_reg(vcpu, SP_EL1);
case KVM_REG_ARM_CORE_REG(elr_el1):
- return __ctxt_sys_reg(&vcpu->arch.ctxt, ELR_EL1);
+ return __vcpu_sys_reg(vcpu, ELR_EL1);
case KVM_REG_ARM_CORE_REG(spsr[KVM_SPSR_EL1]):
- return __ctxt_sys_reg(&vcpu->arch.ctxt, SPSR_EL1);
+ return __vcpu_sys_reg(vcpu, SPSR_EL1);
case KVM_REG_ARM_CORE_REG(spsr[KVM_SPSR_ABT]):
return &vcpu->arch.ctxt.spsr_abt;
Similar to how __ctxt_sys_reg() returns a reference to a system register, add the __vcpu_sys_reg() macro which returns the pointer, but using a struct kvm_vcpu as a parameter instead of a kvm_cpu_context. Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> --- arch/arm64/include/asm/kvm_host.h | 2 ++ arch/arm64/kvm/guest.c | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-)