diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/arm/kvm/psci.c | 20 | ||||
| -rw-r--r-- | arch/arm64/include/asm/kvm_emulate.h | 11 | ||||
| -rw-r--r-- | arch/arm64/kvm/handle_exit.c | 2 |
3 files changed, 14 insertions, 19 deletions
diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c index 0b556968a6da..a9b3b905e661 100644 --- a/arch/arm/kvm/psci.c +++ b/arch/arm/kvm/psci.c | |||
| @@ -75,7 +75,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) | |||
| 75 | unsigned long context_id; | 75 | unsigned long context_id; |
| 76 | phys_addr_t target_pc; | 76 | phys_addr_t target_pc; |
| 77 | 77 | ||
| 78 | cpu_id = *vcpu_reg(source_vcpu, 1) & MPIDR_HWID_BITMASK; | 78 | cpu_id = vcpu_get_reg(source_vcpu, 1) & MPIDR_HWID_BITMASK; |
| 79 | if (vcpu_mode_is_32bit(source_vcpu)) | 79 | if (vcpu_mode_is_32bit(source_vcpu)) |
| 80 | cpu_id &= ~((u32) 0); | 80 | cpu_id &= ~((u32) 0); |
| 81 | 81 | ||
| @@ -94,8 +94,8 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) | |||
| 94 | return PSCI_RET_INVALID_PARAMS; | 94 | return PSCI_RET_INVALID_PARAMS; |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | target_pc = *vcpu_reg(source_vcpu, 2); | 97 | target_pc = vcpu_get_reg(source_vcpu, 2); |
| 98 | context_id = *vcpu_reg(source_vcpu, 3); | 98 | context_id = vcpu_get_reg(source_vcpu, 3); |
| 99 | 99 | ||
| 100 | kvm_reset_vcpu(vcpu); | 100 | kvm_reset_vcpu(vcpu); |
| 101 | 101 | ||
| @@ -114,7 +114,7 @@ static unsigned long kvm_psci_vcpu_on(struct kvm_vcpu *source_vcpu) | |||
| 114 | * NOTE: We always update r0 (or x0) because for PSCI v0.1 | 114 | * NOTE: We always update r0 (or x0) because for PSCI v0.1 |
| 115 | * the general puspose registers are undefined upon CPU_ON. | 115 | * the general puspose registers are undefined upon CPU_ON. |
| 116 | */ | 116 | */ |
| 117 | *vcpu_reg(vcpu, 0) = context_id; | 117 | vcpu_set_reg(vcpu, 0, context_id); |
| 118 | vcpu->arch.power_off = false; | 118 | vcpu->arch.power_off = false; |
| 119 | smp_mb(); /* Make sure the above is visible */ | 119 | smp_mb(); /* Make sure the above is visible */ |
| 120 | 120 | ||
| @@ -134,8 +134,8 @@ static unsigned long kvm_psci_vcpu_affinity_info(struct kvm_vcpu *vcpu) | |||
| 134 | struct kvm *kvm = vcpu->kvm; | 134 | struct kvm *kvm = vcpu->kvm; |
| 135 | struct kvm_vcpu *tmp; | 135 | struct kvm_vcpu *tmp; |
| 136 | 136 | ||
| 137 | target_affinity = *vcpu_reg(vcpu, 1); | 137 | target_affinity = vcpu_get_reg(vcpu, 1); |
| 138 | lowest_affinity_level = *vcpu_reg(vcpu, 2); | 138 | lowest_affinity_level = vcpu_get_reg(vcpu, 2); |
| 139 | 139 | ||
| 140 | /* Determine target affinity mask */ | 140 | /* Determine target affinity mask */ |
| 141 | target_affinity_mask = psci_affinity_mask(lowest_affinity_level); | 141 | target_affinity_mask = psci_affinity_mask(lowest_affinity_level); |
| @@ -209,7 +209,7 @@ int kvm_psci_version(struct kvm_vcpu *vcpu) | |||
| 209 | static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) | 209 | static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) |
| 210 | { | 210 | { |
| 211 | int ret = 1; | 211 | int ret = 1; |
| 212 | unsigned long psci_fn = *vcpu_reg(vcpu, 0) & ~((u32) 0); | 212 | unsigned long psci_fn = vcpu_get_reg(vcpu, 0) & ~((u32) 0); |
| 213 | unsigned long val; | 213 | unsigned long val; |
| 214 | 214 | ||
| 215 | switch (psci_fn) { | 215 | switch (psci_fn) { |
| @@ -273,13 +273,13 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) | |||
| 273 | break; | 273 | break; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | *vcpu_reg(vcpu, 0) = val; | 276 | vcpu_set_reg(vcpu, 0, val); |
| 277 | return ret; | 277 | return ret; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) | 280 | static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) |
| 281 | { | 281 | { |
| 282 | unsigned long psci_fn = *vcpu_reg(vcpu, 0) & ~((u32) 0); | 282 | unsigned long psci_fn = vcpu_get_reg(vcpu, 0) & ~((u32) 0); |
| 283 | unsigned long val; | 283 | unsigned long val; |
| 284 | 284 | ||
| 285 | switch (psci_fn) { | 285 | switch (psci_fn) { |
| @@ -295,7 +295,7 @@ static int kvm_psci_0_1_call(struct kvm_vcpu *vcpu) | |||
| 295 | break; | 295 | break; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | *vcpu_reg(vcpu, 0) = val; | 298 | vcpu_set_reg(vcpu, 0, val); |
| 299 | return 1; | 299 | return 1; |
| 300 | } | 300 | } |
| 301 | 301 | ||
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h index 5a182afab43b..25a40213bd9b 100644 --- a/arch/arm64/include/asm/kvm_emulate.h +++ b/arch/arm64/include/asm/kvm_emulate.h | |||
| @@ -100,15 +100,10 @@ static inline void vcpu_set_thumb(struct kvm_vcpu *vcpu) | |||
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | /* | 102 | /* |
| 103 | * vcpu_reg should always be passed a register number coming from a | 103 | * vcpu_get_reg and vcpu_set_reg should always be passed a register number |
| 104 | * read of ESR_EL2. Otherwise, it may give the wrong result on AArch32 | 104 | * coming from a read of ESR_EL2. Otherwise, it may give the wrong result on |
| 105 | * with banked registers. | 105 | * AArch32 with banked registers. |
| 106 | */ | 106 | */ |
| 107 | static inline unsigned long *vcpu_reg(const struct kvm_vcpu *vcpu, u8 reg_num) | ||
| 108 | { | ||
| 109 | return (unsigned long *)&vcpu_gp_regs(vcpu)->regs.regs[reg_num]; | ||
| 110 | } | ||
| 111 | |||
| 112 | static inline unsigned long vcpu_get_reg(const struct kvm_vcpu *vcpu, | 107 | static inline unsigned long vcpu_get_reg(const struct kvm_vcpu *vcpu, |
| 113 | u8 reg_num) | 108 | u8 reg_num) |
| 114 | { | 109 | { |
diff --git a/arch/arm64/kvm/handle_exit.c b/arch/arm64/kvm/handle_exit.c index 68a0759b1375..15f0477b0d2a 100644 --- a/arch/arm64/kvm/handle_exit.c +++ b/arch/arm64/kvm/handle_exit.c | |||
| @@ -37,7 +37,7 @@ static int handle_hvc(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
| 37 | { | 37 | { |
| 38 | int ret; | 38 | int ret; |
| 39 | 39 | ||
| 40 | trace_kvm_hvc_arm64(*vcpu_pc(vcpu), *vcpu_reg(vcpu, 0), | 40 | trace_kvm_hvc_arm64(*vcpu_pc(vcpu), vcpu_get_reg(vcpu, 0), |
| 41 | kvm_vcpu_hvc_get_imm(vcpu)); | 41 | kvm_vcpu_hvc_get_imm(vcpu)); |
| 42 | 42 | ||
| 43 | ret = kvm_psci_call(vcpu); | 43 | ret = kvm_psci_call(vcpu); |
