Skip to content

Commit 1b422dd

Browse files
author
Marc Zyngier
committed
KVM: arm64: Introduce accessor for ctxt->sys_reg
In order to allow the disintegration of the per-vcpu sysreg array, let's introduce a new helper (ctxt_sys_reg()) that returns the in-memory copy of a system register, picked from a given context. __vcpu_sys_reg() is rewritten to use this helper. Signed-off-by: Marc Zyngier <[email protected]>
1 parent efaa5b9 commit 1b422dd

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,17 @@ struct kvm_vcpu_arch {
405405
#define vcpu_gp_regs(v) (&(v)->arch.ctxt.gp_regs)
406406

407407
/*
408-
* Only use __vcpu_sys_reg if you know you want the memory backed version of a
409-
* register, and not the one most recently accessed by a running VCPU. For
410-
* example, for userspace access or for system registers that are never context
411-
* switched, but only emulated.
408+
* Only use __vcpu_sys_reg/ctxt_sys_reg if you know you want the
409+
* memory backed version of a register, and not the one most recently
410+
* accessed by a running VCPU. For example, for userspace access or
411+
* for system registers that are never context switched, but only
412+
* emulated.
412413
*/
413-
#define __vcpu_sys_reg(v,r) ((v)->arch.ctxt.sys_regs[(r)])
414+
#define __ctxt_sys_reg(c,r) (&(c)->sys_regs[(r)])
415+
416+
#define ctxt_sys_reg(c,r) (*__ctxt_sys_reg(c,r))
417+
418+
#define __vcpu_sys_reg(v,r) (ctxt_sys_reg(&(v)->arch.ctxt, (r)))
414419

415420
u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg);
416421
void vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg);

0 commit comments

Comments
 (0)