Skip to content

Commit 561454e

Browse files
mrutland-armctmarinas
authored andcommitted
arm64/kvm: use ESR_ELx_EC to extract EC
Now that we have a helper to extract the EC from an ESR_ELx value, make use of this in the arm64 KVM code for simplicity and consistency. There should be no functional changes as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Dave P Martin <dave.martin@arm.com> Cc: Huang Shijie <shijie.huang@arm.com> Cc: James Morse <james.morse@arm.com> Cc: Marc Zyngier <marc.zyngier@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: kvmarm@lists.cs.columbia.edu Acked-by: Christoffer Dall <christoffer.dall@linaro.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 275f344 commit 561454e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static inline bool kvm_vcpu_trap_il_is32bit(const struct kvm_vcpu *vcpu)
210210

211211
static inline u8 kvm_vcpu_trap_get_class(const struct kvm_vcpu *vcpu)
212212
{
213-
return kvm_vcpu_get_hsr(vcpu) >> ESR_ELx_EC_SHIFT;
213+
return ESR_ELx_EC(kvm_vcpu_get_hsr(vcpu));
214214
}
215215

216216
static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu)

arch/arm64/kvm/handle_exit.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int kvm_handle_guest_debug(struct kvm_vcpu *vcpu, struct kvm_run *run)
106106
run->exit_reason = KVM_EXIT_DEBUG;
107107
run->debug.arch.hsr = hsr;
108108

109-
switch (hsr >> ESR_ELx_EC_SHIFT) {
109+
switch (ESR_ELx_EC(hsr)) {
110110
case ESR_ELx_EC_WATCHPT_LOW:
111111
run->debug.arch.far = vcpu->arch.fault.far_el2;
112112
/* fall through */
@@ -149,7 +149,7 @@ static exit_handle_fn arm_exit_handlers[] = {
149149
static exit_handle_fn kvm_get_exit_handler(struct kvm_vcpu *vcpu)
150150
{
151151
u32 hsr = kvm_vcpu_get_hsr(vcpu);
152-
u8 hsr_ec = hsr >> ESR_ELx_EC_SHIFT;
152+
u8 hsr_ec = ESR_ELx_EC(hsr);
153153

154154
if (hsr_ec >= ARRAY_SIZE(arm_exit_handlers) ||
155155
!arm_exit_handlers[hsr_ec]) {

arch/arm64/kvm/hyp/switch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ static bool __hyp_text __translate_far_to_hpfar(u64 far, u64 *hpfar)
198198
static bool __hyp_text __populate_fault_info(struct kvm_vcpu *vcpu)
199199
{
200200
u64 esr = read_sysreg_el2(esr);
201-
u8 ec = esr >> ESR_ELx_EC_SHIFT;
201+
u8 ec = ESR_ELx_EC(esr);
202202
u64 hpfar, far;
203203

204204
vcpu->arch.fault.esr_el2 = esr;

0 commit comments

Comments
 (0)