Skip to content

Commit 1cf3e12

Browse files
committed
arm64: Convert HPFAR_EL2 to sysreg table
Switch over to the typical sysreg table for HPFAR_EL2 as we're about to start using more fields in the register. Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20250402201725.2963645-3-oliver.upton@linux.dev Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent fb8a3eb commit 1cf3e12

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,9 @@ static __always_inline unsigned long kvm_vcpu_get_hfar(const struct kvm_vcpu *vc
305305

306306
static __always_inline phys_addr_t kvm_vcpu_get_fault_ipa(const struct kvm_vcpu *vcpu)
307307
{
308-
return ((phys_addr_t)vcpu->arch.fault.hpfar_el2 & HPFAR_MASK) << 8;
308+
u64 hpfar = vcpu->arch.fault.hpfar_el2;
309+
310+
return FIELD_GET(HPFAR_EL2_FIPA, hpfar) << 12;
309311
}
310312

311313
static inline u64 kvm_vcpu_get_disr(const struct kvm_vcpu *vcpu)

arch/arm64/kvm/hyp/nvhe/mem_protect.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ void handle_host_mem_abort(struct kvm_cpu_context *host_ctxt)
578578
return;
579579
}
580580

581-
addr = (fault.hpfar_el2 & HPFAR_MASK) << 8;
581+
addr = FIELD_GET(HPFAR_EL2_FIPA, fault.hpfar_el2) << 12;
582582
ret = host_stage2_idmap(addr);
583583
BUG_ON(ret && ret != -EAGAIN);
584584
}

arch/arm64/tools/sysreg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3433,3 +3433,10 @@ Field 5 F
34333433
Field 4 P
34343434
Field 3:0 Align
34353435
EndSysreg
3436+
3437+
Sysreg HPFAR_EL2 3 4 6 0 4
3438+
Field 63 NS
3439+
Res0 62:48
3440+
Field 47:4 FIPA
3441+
Res0 3:0
3442+
EndSysreg

0 commit comments

Comments
 (0)