Skip to content

Commit da6f166

Browse files
christofferdall-armMarc Zyngier
authored andcommitted
KVM: arm64: Make vcpu const in vcpu_read_sys_reg
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>
1 parent 6e14ef1 commit da6f166

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/arm64/include/asm/kvm_host.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ struct kvm_vcpu_arch {
319319
*/
320320
#define __vcpu_sys_reg(v,r) ((v)->arch.ctxt.sys_regs[(r)])
321321

322-
u64 vcpu_read_sys_reg(struct kvm_vcpu *vcpu, int reg);
322+
u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg);
323323
void vcpu_write_sys_reg(struct kvm_vcpu *vcpu, u64 val, int reg);
324324

325325
/*

arch/arm64/kvm/sys_regs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static bool write_to_read_only(struct kvm_vcpu *vcpu,
7676
return false;
7777
}
7878

79-
u64 vcpu_read_sys_reg(struct kvm_vcpu *vcpu, int reg)
79+
u64 vcpu_read_sys_reg(const struct kvm_vcpu *vcpu, int reg)
8080
{
8181
if (!vcpu->arch.sysregs_loaded_on_cpu)
8282
goto immediate_read;

0 commit comments

Comments
 (0)