KVM: arm64: Make vcpu const in vcpu_read_sys_reg
authorChristoffer Dall <christoffer.dall@arm.com>
Thu, 29 Nov 2018 11:20:01 +0000 (12:20 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Wed, 19 Dec 2018 17:47:07 +0000 (17:47 +0000)
vcpu_read_sys_reg should not be modifying the VCPU structure.
Eventually, to handle EL2 sysregs for nested virtualization, we will
call vcpu_read_sys_reg from places that have a const vcpu pointer, which
will complain about the lack of the const modifier on the read path.

Signed-off-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/sys_regs.c

index 7a5035f9c5c3b0a5beade49a5f2cf2775ca24467..c22e50ba347309a2092198e0047b310b87cd023a 100644 (file)
@@ -319,7 +319,7 @@ struct kvm_vcpu_arch {
  */
 #define __vcpu_sys_reg(v,r)    ((v)->arch.ctxt.sys_regs[(r)])
 
-u64 vcpu_read_sys_reg(struct kvm_vcpu *vcpu, int reg);
+u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg);
 void vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg);
 
 /*
index ecbf67ccabf59d3c9d06fbaae1b30a135f7a85b2..965c6f1706d64488bbb91eba444fbe9ce06780fc 100644 (file)
@@ -76,7 +76,7 @@ static bool write_to_read_only(struct kvm_vcpu *vcpu,
        return false;
 }
 
-u64 vcpu_read_sys_reg(struct kvm_vcpu *vcpu, int reg)
+u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg)
 {
        if (!vcpu->arch.sysregs_loaded_on_cpu)
                goto immediate_read;